You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Ambient sounds automatically fade in and out when played or stopped. They also don't allow a sound to be played if an instance of it is already active.
I think this generally works without issue, but I recently worked on a project with an ambient effect that we wanted active / inactive based on a player action (whether a button was hovered or not, to be specific). The ambient sound would play properly the first time the player triggered it, but it wouldn't replay if they attempted to stop & re-trigger it in within a short window of time (happened when the player quickly hovered/left/re-hovered the button).
The ambient sounds player would start fading out, and subsequent attempts to restart it couldn't succeed until it completely finished.
Describe the solution you'd like
Instead, I would like the ability to make re-playing a fading out ambient noise cause it to fade back in. This could be accomplished by stopping its fade-out tween & starting a new one to fade it back in - basically just let the AmbinetSoundsPlayer make a call to fade_volume if the active player is in the middle of fading out.
(or, if you wanted to keep it really simple, just always call fade_volume on the already-active player. It already cancels the current tween and starts a new one.)
If we want to have the rate of volume increase consistent with the normal -80db -> 0db, it might also be good to add a little extra computation to AbstractAudioPlayerPool.fade_volume() - the duration of the newly created tween would be something like
current_volume / to_volume * duration
so a sound that's half faded-out only takes half of the requested "full duration" to fade back in
Describe alternatives you've considered
I'm not sure if this matches exactly what you originally intended with ambient sounds.
It might be preferable to not count fading out audio players as "active" instead, that way they don't prevent us from starting a new instance.
Any feature added might also be something you want to make optional - off the top of my head, this seems to make sense as the default setting, but I don't actually know how other folks have used ambient sounds.
Is your feature request related to a problem? Please describe.
Ambient sounds automatically fade in and out when played or stopped. They also don't allow a sound to be played if an instance of it is already active.
I think this generally works without issue, but I recently worked on a project with an ambient effect that we wanted active / inactive based on a player action (whether a button was hovered or not, to be specific). The ambient sound would play properly the first time the player triggered it, but it wouldn't replay if they attempted to stop & re-trigger it in within a short window of time (happened when the player quickly hovered/left/re-hovered the button).
The ambient sounds player would start fading out, and subsequent attempts to restart it couldn't succeed until it completely finished.
Describe the solution you'd like
Instead, I would like the ability to make re-playing a fading out ambient noise cause it to fade back in. This could be accomplished by stopping its fade-out tween & starting a new one to fade it back in - basically just let the
AmbinetSoundsPlayer
make a call tofade_volume
if the active player is in the middle of fading out.(or, if you wanted to keep it really simple, just always call
fade_volume
on the already-active player. It already cancels the current tween and starts a new one.)If we want to have the rate of volume increase consistent with the normal -80db -> 0db, it might also be good to add a little extra computation to
AbstractAudioPlayerPool.fade_volume()
- the duration of the newly created tween would be something likeso a sound that's half faded-out only takes half of the requested "full duration" to fade back in
Describe alternatives you've considered
I'm not sure if this matches exactly what you originally intended with ambient sounds.
It might be preferable to not count fading out audio players as "active" instead, that way they don't prevent us from starting a new instance.
Any feature added might also be something you want to make optional - off the top of my head, this seems to make sense as the default setting, but I don't actually know how other folks have used ambient sounds.
Additional context
Links to relevant parts of the codebase:
The text was updated successfully, but these errors were encountered: