Navigation Menu

Skip to content

Commit

Permalink
Fixed|Audio: Map music stops when map reloaded
Browse files Browse the repository at this point in the history
If the correct music is already playing, it isn’t an error if the same music is requested to be played.
  • Loading branch information
skyjake committed Nov 14, 2018
1 parent 008e5f8 commit 6fbe344
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions doomsday/apps/client/include/audio/audiosystem.h
Expand Up @@ -131,11 +131,11 @@ class AudioSystem : public de::System
/**
* Start playing a song. The chosen interface depends on what's available and what
* kind of resources have been associated with the song. Any previously playing song
* is stopped.
* is stopped. If the song is already playing, no changes are applied.
*
* @param definition Music definition describing which associated music file to play.
*
* @return Non-zero if the song is successfully played.
* @return Non-zero if the song is successfully played (or already playing).
*/
int playMusic(de::Record const &definition, bool looped = false);

Expand Down
5 changes: 4 additions & 1 deletion doomsday/apps/client/src/audio/base/audiosystem.cpp
Expand Up @@ -1759,7 +1759,10 @@ dint AudioSystem::playMusic(Record const &definition, bool looped)

// We will not restart the currently playing song.
if (definition.gets("id") == d->musCurrentSong && musicIsPlaying())
return false;
{
// This is not a failure, though, since the right music is played.
return true;
}

// Stop the currently playing song.
stopMusic();
Expand Down

0 comments on commit 6fbe344

Please sign in to comment.