Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add music api #441

Merged
merged 1 commit into from
Nov 21, 2024
Merged

Add music api #441

merged 1 commit into from
Nov 21, 2024

Conversation

JiepengTan
Copy link
Collaborator

@JiepengTan JiepengTan commented Nov 20, 2024

1. implement:

2. test project: (please build your engine from source before run it)

16-BGM.zip

3. scene config:

{
  "bgm":"bgm",
  "zorder": [
    "Bullet"
  ]
}

4. demo script:

onStart => {
	println "onStart"
	wait 1
	play "bgm", {Music:true, Action: PlayPause}
	println "PlayPause"
	wait 1
	play "bgm", {Music:true, Action: PlayResume}
	println "PlayResume"
	wait 1
	play "bgm", {Music:true, Action: PlayStop}
	println "PlayStop"
	wait 3
	play "bgm", {Music:true, Action: PlayRewind}
	println "PlayRewind"
}

5. demo video: please download this video and play it (github can not play audio)

ispx2_music.mp4

@JiepengTan JiepengTan requested a review from nighca November 20, 2024 10:44
if opts.Music {
err = p.playBgm(media, opts.Action)
} else {
err = p.playSfx(media)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a breaking change for existed API Game.Play?

If Game.Play is called with the original way (without specifying field Music), that results in different behavior than spx v1.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, audio only has a play function, (and pause, resume, etc., have been removed). From a typical game development perspective, the need to pause audio is unnecessary. I've developed many games and never needed it.

If you all consistently believe that this SFX needs a pause feature, I'll add it later.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you all strongly believe that this SFX requires a pause feature

I'm uncertain about the necessity of a pause feature, actually I haven't used that either. But I don't think it's the right time to implement a breaking change to the APIs now.

I will add it later.

No problem.

@JiepengTan JiepengTan requested a review from nighca November 21, 2024 01:41
@nighca nighca merged commit f32e9f1 into goplus:dev Nov 21, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants