braingdx icon indicating copy to clipboard operation
braingdx copied to clipboard

Introduce music playlists

Open bitbrain opened this issue 4 years ago • 0 comments

Motivation

It is currently very cumbersome to define music playing in a screen. In order to do that you need to start the music, set it to looping and make sure that it fades out before the screen exits, otherwise it is going to continue at the end of a screen.

⭐ Design

// loop through the following music tracks, also fade it out 
// when the screen either exits or fades out
// this should be the default behavior.
context.getAudioManager().loopMusic(Musics.SONG_1, Musics.SONG_2, true);

Requirements

  • overload AudioManager methods to accept asset ids
  • calling loopMusic should stop all other currently playing music
  • when looping method, it should loop from left to right (no shuffle play mode for now)
  • when the screen is faded out with ScreenTransitions use the same fade out interval to fade out the music
  • when the screen is simply changed, stop the music instead

bitbrain avatar Mar 27 '20 17:03 bitbrain