Skip to content

Commit

Permalink
butano: music ending detection fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
GValiente committed Oct 19, 2023
1 parent fd896e6 commit 1639847
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
5 changes: 0 additions & 5 deletions butano/hw/include/bn_hw_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ namespace bn::hw::audio

inline void play_music(int id, bool loop)
{
if(mmActive())
{
mmStop();
}

mmStart(mm_word(id), loop ? MM_PLAY_LOOP : MM_PLAY_ONCE);
}

Expand Down
1 change: 1 addition & 0 deletions butano/include/bn_documentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -2162,6 +2162,7 @@
* See the `audio` example to learn how to stop, release and setup sound effects with them.
* * bn::jingle and jingle actions added.
* * Audio commands generation optimized.
* * Music ending detection fixed.
*
*
* @section changelog_15_9_0 15.9.0
Expand Down
8 changes: 6 additions & 2 deletions butano/src/bn_audio_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ void execute_commands()

data.commands_count = 0;

if(data.music_playing)
if(data.music_playing && ! data.music_paused)
{
if(hw::audio::music_playing())
{
Expand All @@ -1302,7 +1302,7 @@ void execute_commands()
data.jingle_playing = false;
}

if(data.dmg_music_data)
if(data.dmg_music_data && ! data.dmg_music_paused)
{
int pattern;
int row;
Expand All @@ -1312,6 +1312,10 @@ void execute_commands()
{
data.dmg_music_position = bn::dmg_music_position(pattern, row);
}
else
{
data.dmg_music_data = nullptr;
}
}

for(auto it = data.sound_map.begin(), end = data.sound_map.end(); it != end; )
Expand Down
2 changes: 1 addition & 1 deletion docs/changelog.html

Large diffs are not rendered by default.

0 comments on commit 1639847

Please sign in to comment.