Skip to content

Commit 9dd2fab

Browse files
committed
Update SDL_native_midi_macos.c
1 parent f704a68 commit 9dd2fab

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/SDL_native_midi_macos.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -340,16 +340,27 @@ void NativeMidi_Stop(void)
340340
bool NativeMidi_Active(void)
341341
{
342342
MusicTimeStamp currentTime = 0;
343-
if (currentsong == NULL) {
343+
NativeMidi_Song* song = currentsong ? currentsong : paused_song;
344+
345+
if (song == NULL) {
344346
return false;
345347
}
348+
349+
if (paused_song) {
350+
currentTime = paused_time;
351+
} else {
352+
MusicPlayerGetTime(song->player, &currentTime);
353+
}
346354

347-
MusicPlayerGetTime(currentsong->player, &currentTime);
348-
if ((currentTime < currentsong->endTime) || (currentTime >= kMusicTimeStamp_EndOfTrack)) {
355+
if ((currentTime < song->endTime) || (currentTime >= kMusicTimeStamp_EndOfTrack)) {
349356
return true;
350-
} else if (currentsong->loops) {
351-
--currentsong->loops;
352-
MusicPlayerSetTime(currentsong->player, 0);
357+
} else if (song->loops) {
358+
--song->loops;
359+
if (paused_song) {
360+
paused_time = 0;
361+
} else {
362+
MusicPlayerSetTime(song->player, 0);
363+
}
353364
return true;
354365
}
355366
return false;

0 commit comments

Comments
 (0)