Open MarkOates opened 2 years ago
Here's the location where streams stop playing if the play position is greater than the length: https://github.com/liballeg/allegro5/blob/4aa54e6c994af21bc63d8b593673ab3df62390f8/addons/audio/kcm_voice.c#L221
It's also possible that manual audio stopping would occur in other locations, including resetting the stream, etc...
I'm not sure yet where the implicit stopping/starting occurs for ALLEGRO_SAMPLE_INSTANCE
.
Allegro has ALLEGRO_EVENT_AUDIO_STREAM_FINISHED
:
https://liballeg.org/a5docs/trunk/audio.html#allegro_event_audio_stream_finished.
As a similar feature, there also exists ALLEGRO_EVENT_VIDEO_FINISHED
here: https://liballeg.org/a5docs/trunk/video.html#allegro_event_video_finished
Might be nice to have a "pause" feature, along with preferences on what to do on a pause (continue music @ 50%, stop ambience, mute/hold currently playing samples & sample replay queues)
Consider renaming this to Jukebox and Soundboard.
During TINS 2022, some features felt like they were needed in
AudioController
. Namely "overplay" features (options on what to do when a sound is triggered even though it is currently playing). Also, in addition tosound_effects
andmusic
, consider adding a separateambience
.Some basics ideas:
Sound
needs:AudioController
poll currently active samples.AudioController
needs:AudioRepositoryElement
containingAllegroFlare/AudioRepositoryElement
needs:Here, an
overplay_strategy
can be one of the following. That is, "if the audio is currently playing...":ignore
: ...do nothingrestart
: ...stop the current playing instance of the sample, and restart it.restart_if_delay
: ...restart the current instance of the sample if an amount of time has passed from the time it was started (will need to take "pause" into account). If the amount of time has not passed when the request is processed, then the request will be ignored.enqueue
: ...enqueue an additional subsequent replaying of the sample. This replaying will be triggered after the current sample has ended. Replaying will continue untilAudioRepositoryElement::replays_remaining
reaches0
.enqueue_restart_on_delay
: ...same asenqueue
, but will replay after a delay rather than waiting until the previous sample has finished.