Some audio features - pause, resume, play after, detect playback

  • Pause / resume audio as an option instead of stopping it
  • Being able to tell an audio track to play after a certain amount of time
  • Being able to detect if an audio component is currently playing any audio
  • Being able to get the amount of an audio file has played through already
sound.get_time_played(audio_component) -- returns amount of time that an audio component has played so far if it is still playing audio, returns false if not playing audio?
sound.is_playing(audio_component) -- returns true if a component is currently playing audio, false if it is not

msg.post("#sound", "pause_sound") -- pause any playing audio - as a convenience for handling pause screens for example
msg.post("#sound", "resume_sound") -- resume any playing audio that has been paused
msg.post("#sound", "play_sound_after", {time = 1.25, delay = 0, gain = 0.5}) -- be able to skip a portion of an audio file when playing

Or add something like “time” as a field for normal play_sound.

“loop” should also probably be a field in play_sound too and not just as a setting in the component properties. Then if it’s a value passed in as 1 or 0 override the property value.

Are there any existing audio tickets?

8 Likes

some other good ideas:
sound.get_file_name(audio_component) --returns the filename of the file that is being played

and an “atlas” or similar system for audio, that way we can keep 1 audio source object for the whole UI system for example;
That way we could change audios with ease through something like “play_clip” to play a section of the “atlas”;

also audio streaming (from file or other source), instead of loading it directly to the memory could be a killer~~
for games with many levels, that makes development easier since you can abstract away the sound object to play instead of setting up a new one all the time, also adds dynamism to the sound system in case you want to actually mess with the sound data arrays~~ :smiley:

1 Like

Maybe an audio proxy component too? That way we can async load/unload sounds directly without needed to put them into their own Collections. Maybe have audio proxy be able to be what can enable streaming of audio without needing to fully load.

Might already be DEF-1967 for part of this one.

2 Likes

Remembered another thing that would be handy is to be able to set the gain for left/right stereo for a sound as it plays with play_sound. This way we can make audio more 3d. If an explosion happens on the left side of screen have left stereo be louder.

1 Like

Pausing and resuming a sound is covered by: DEF-1558

We have a several other audio related tickets in our backlog as well, some of which cover things mentioned here.

2 Likes

Absolutely agree with @Pkeod I also need a pause, a play and a current time method for sounds in my game.

In ideal world will be cool have markers for sounds (it’s a metadata with tags/markers. Many sound engines support it, for example fmod : http://www.fmod.org/adaptive-music-fmod-studio-transition-markers-logic/)
Great solution for adaptive sounds in games.

1 Like

Now we try to make interactive sound design (when sounds depend on current music time).
And without those features it’s really hard to do.
sound_end event will be great, too. (as I understand it’s DEF-1549 )

1 Like