allegroflare / allegro_flare

Application toolkit for Allegro 5
https://clubcatt.com/allegroflare
MIT License
35 stars 6 forks source link

Revise AudioController #228

Open MarkOates opened 2 years ago

MarkOates commented 2 years ago

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 to sound_effects and music, consider adding a separate ambience.

Some basics ideas:

Sound needs:

AudioController needs:

AllegroFlare/AudioRepositoryElement needs:

Here, an overplay_strategy can be one of the following. That is, "if the audio is currently playing...":

MarkOates commented 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.

MarkOates commented 2 years ago

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

MarkOates commented 2 years ago

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)

MarkOates commented 2 years ago

Consider renaming this to Jukebox and Soundboard.