Skip to content

Rework music playback (bug #7172)

Closes #7172 (closed).

Makes apparent behavior of a lot of things about it subjectively make sense.

There are currently three supported playlists: Title (hardcoded), Explore and Battle.
When it comes to playlist switching, pre-0.44.0 logic was this:
Anything => Anything else == Anything else

post-0.44.0 logic is this:
Anything => Anything else (not empty) == Anything else
Anything => Anything else (empty) == Anything

Now it's this:
Anything => Battle (not empty) == Battle
Anything => Battle (empty) == Explore
Anything => Explore/Title == Explore/Title

That is, Explore playlist will replace Battle playlist if the Battle playlist is empty (so as to handle Title => Battle transitions); if Explore playlist is the current playlist, the current track will continue playing like before. This is not quite Morrowind behavior where it doesn't play Explore upon Title => Battle transitions and always restarts Explore playlist upon ending combat but that part of Morrowind behavior is nonsense.

playPlaylist is no longer duplicated for title music, the playlist is defined during sound manager construction instead.
updateMusic should properly support not playing music, that is, always fading out the previous track before playing or not playing something new (which I think was not guaranteed to happen). Handling the end of music that is fading out is closer to how other fading sounds finish playing, instead of relying on the volume settings, which I don't think is quite right.
startRandomTitle kind of supports empty playlists.
Playlists will only use files from directories that share the name with the playlist, not directories the names of which start with the playlist name (i.e. BattleTotallyAwesome and BattleNotThatAwesome are not a part of Battle playlist).

Edited by Alexei Kotov

Merge request reports