Godot: AudioStreamPlayer usability

Created on 28 Aug 2017  Â·  24Comments  Â·  Source: godotengine/godot

The node should fire signals such as "start", "stop" at least. Any other ideas are welcome :)

archived enhancement audio editor usability

Most helpful comment

Don't agree with you, what about if you want some NPC to have reactions to some sounds being played? In any case, I think we both made our cases and since you're not against the signals to begin with, we'll leave it at that :)

All 24 comments

Oh yeah, we should also have an option for playback in the editor.

Potentially done by a1c03a69d2940fb69d7221800e919f4a183fec0c/#9928?

Duplicate of #9928. a1c03a6 partially fixed this in that it implemented a "finished" signal, but signals for starting or looping would be desirable too.

cc @reduz

I discovered that playback is possible through the playing option the inspector, but I think playing and autoplay are a bit misleading. I would have thought that ticking playing in the editor will mean that the sound starts playing when the game starts (so in other words, no need for autoplay). It's a bit confusing.

I think I'd prefer to have only autoplay in the inspector since that clearly signifies that the sound starts playing when the game starts. And have a separate play button for previewing the sound in the editor only.

I'd say keep this issue open since it's more general than #9928, we're talking about UI and usability as well, not just signals.

A start signal is weird, usually one knows when starts because starts when play.
If finished and has looping enabled, that means it is starting too, unless I'm missing something.

Not necessarily, if you for example start playback via animation (not on frame 0) how would you know when it starts? I mean you could calculate it but it makes much more sense to have signals handle it

Is the same, when play is called.
Playing sound is usually a reaction of something that happened and not the other way around, I think.
It won't hurt to have it but I don't see a "normal" use for that.

What do you mean it's the same as when play is called? Say for example I want to start an animation at the exact moment the sound starts, but do it with a random chance so it doesn't play every time.

The sound starts at say 3 seconds in some other animation. I'd have to keep track of time just for correlating with the sound playback. Just as the animation player has a signal for animation start, the audio player should have too. It's also a matter of consistency, why would animation player have a start signal, but not the audio player?

Useful for rhythm-based games too. If you have random events that may occur if a different sound is played, they could be triggered by signals.

My point is that those built in signals are useful for things the dev do not have control (like area enter, or sound track finished playing), if your animation player starts a sound, the animation player starts the sound, can do something else too.

Animation player can come from a blend, so the time where starts can be out of control.
Is just my point of view of the way to work with sounds (sound never start things, things start sounds).

Don't agree with you, what about if you want some NPC to have reactions to some sounds being played? In any case, I think we both made our cases and since you're not against the signals to begin with, we'll leave it at that :)

You can emit your own signal when you play the sound. The engine core really avoids to have signals for user-controlled events.

I honestly don't understand you guys. So @vnen, tell me then, why is there an animation started signal in the animation player? Isn't that the same thing? Also, what makes you think that the only way to start the sound would be through code? Cause that's what you're implying.

Signal on start does not make sense, and the playing property can be used from animation

Script on the audio player node:

extends AudioStreamPlayer3D

signal sound_started

func play():
    emit_signal("sound_started")
    .play()

AnimationPlayer can blend many tracks (unlike the sound players) playing one after the other as I said before, "started" announce a new track and finish once, you can't have control of this with code.

I never added the animation started signal actually, i wonder who did

On Wed, Aug 30, 2017 at 9:33 PM, Răzvan Cosmin Rădulescu <
[email protected]> wrote:

I honestly don't understand you guys. So @vnen https://github.com/vnen,
tell me then, why is there an animation started signal in the animation
player? Isn't that the same thing? Also, what makes you think that the only
way to start the sound would be through code? Cause that's what you're
implying.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/10729#issuecomment-326156006,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AF-Z22Qx8wt_NHJZ37gjXq-jVySU0R7wks5sdf9dgaJpZM4PEyW-
.

guess it should probably be removed

On Wed, Aug 30, 2017 at 10:30 PM, Juan Linietsky reduzio@gmail.com wrote:

I never added the animation started signal actually, i wonder who did

On Wed, Aug 30, 2017 at 9:33 PM, Răzvan Cosmin Rădulescu <
[email protected]> wrote:

I honestly don't understand you guys. So @vnen https://github.com/vnen,
tell me then, why is there an animation started signal in the animation
player? Isn't that the same thing? Also, what makes you think that the only
way to start the sound would be through code? Cause that's what you're
implying.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/10729#issuecomment-326156006,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AF-Z22Qx8wt_NHJZ37gjXq-jVySU0R7wks5sdf9dgaJpZM4PEyW-
.

@reduz and leave track change only? (I guess start is redundant)

I'm pretty sure you can add a call func track on the AnimationPlayer to call emit_signal().

@eon-s Yeah.
@razvanc-r I could never get a justification for a use case, same as with a start signal here... you call the function yourself, so you can call something else

I have not tested the (audio) "finished" signal, it works in loops too or when stops only?

When it stops, a signal for loops is pretty difficult to add, so you will
have to check this manually

On Aug 30, 2017 10:41 PM, "eon-s" notifications@github.com wrote:

I have not tested the "finished" signal, it works in loops too or when
stops?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/10729#issuecomment-326165254,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AF-Z2zvAlNGXe4rkKrEAdmto_o4OTvndks5sdg9lgaJpZM4PEyW-
.

Leaving this open as only the finished signal was implemented, and according to the linked thread at least a looping signal would be desireable.

Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine.

The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker.

If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bojidar-bg picture bojidar-bg  Â·  3Comments

RebelliousX picture RebelliousX  Â·  3Comments

timoschwarzer picture timoschwarzer  Â·  3Comments

testman42 picture testman42  Â·  3Comments

ndee85 picture ndee85  Â·  3Comments