Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design More Options for Audio with Jukebox and Soundboard #203

Open
MarkOates opened this issue Jun 23, 2022 · 1 comment
Open

Design More Options for Audio with Jukebox and Soundboard #203

MarkOates opened this issue Jun 23, 2022 · 1 comment

Comments

@MarkOates
Copy link
Collaborator

MarkOates commented Jun 23, 2022

Right now, all sound effects and music are managed with the AudioController. AudioController works in the following way:

AudioController Assumptions

  • Music - Only one music track plays at a time. It either plays once, or loops forever (depending on the loop bool that was set at load time). Starting a different music track would stop the currently playing one suddenly. (Starting the currently running one if it is already playing will do nothing).
  • Sound Effects - Different sound effects can be played at the same time, but the same sound effect will only have one instance playing at a time. If an instance of a sound effect is called multiple times very quickly, then the sound effect will repeat at minimum after a 0.1 second delay, "interrupting" the previous play of the sound effect until all calls have been played. If the sound effect is currently playing, then nothing will happen and it will continue playing.

(note: currently, music and sound effects cannot be stopped through this interface. Issue here)

Problem

The above are good defaults for quick game making, but there are cases where more elaborate preferences are desired. Consider the following features:

  • Playing atmospheric ambiences behind music (note: can be done as a looped sound effect)
  • Music track layering, or atmospheric layering
  • Crossfading in and out layers
  • Crossfading out music
  • Being notified when a music track has finished playing (e.g. ALLEGRO_FLARE_EVENT_MUSIC_TRACK_HAS_STOPPED)
  • Sync layers to specific time points or audio time markers
  • Positioned audio sources in 2d or 3d space
  • Environment filters to sound effects
  • Starting a "sound effect repeat stream" (for example, when tallying a high score but it needs to stop once the tallying has completed).
  • Configurable sound effect repeat rate
  • Variable sound effect speed playback
  • One "sound effect" plays randomly from a set of n sound effects, not repeating the previously played sound effect, or n-previously played sound effects.
  • "pausing" music (opening another window) but then resuming it from the same point when returning
  • lowering current music volume (for example during pause)

Proposed Solution

Basic idea is to create new Jukebox And Soundboard classes, each could be used to handle these more elaborate scenarios. AudioController would remain the same.

@MarkOates
Copy link
Collaborator Author

Additional ideas listed in #228

@MarkOates MarkOates pinned this issue Aug 9, 2022
@MarkOates MarkOates unpinned this issue Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant