From 6d9e1d24fd5551bf4f63ea6d9388cd8ae9e7a3b6 Mon Sep 17 00:00:00 2001
From: Mark Kunka <[EMAIL REDACTED]>
Date: Fri, 27 Jun 2025 18:05:00 -0700
Subject: [PATCH] make paused song active for macos
---
src/SDL_native_midi_macos.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/SDL_native_midi_macos.c b/src/SDL_native_midi_macos.c
index 556e7cb..61456ad 100644
--- a/src/SDL_native_midi_macos.c
+++ b/src/SDL_native_midi_macos.c
@@ -340,16 +340,27 @@ void NativeMidi_Stop(void)
bool NativeMidi_Active(void)
{
MusicTimeStamp currentTime = 0;
- if (currentsong == NULL) {
+ NativeMidi_Song* song = currentsong ? currentsong : paused_song;
+
+ if (song == NULL) {
return false;
}
+
+ if (paused_song) {
+ currentTime = paused_time;
+ } else {
+ MusicPlayerGetTime(song->player, ¤tTime);
+ }
- MusicPlayerGetTime(currentsong->player, ¤tTime);
- if ((currentTime < currentsong->endTime) || (currentTime >= kMusicTimeStamp_EndOfTrack)) {
+ if ((currentTime < song->endTime) || (currentTime >= kMusicTimeStamp_EndOfTrack)) {
return true;
- } else if (currentsong->loops) {
- --currentsong->loops;
- MusicPlayerSetTime(currentsong->player, 0);
+ } else if (song->loops) {
+ --song->loops;
+ if (paused_song) {
+ paused_time = 0;
+ } else {
+ MusicPlayerSetTime(song->player, 0);
+ }
return true;
}
return false;