foxygit / doom Log in
commit e11bed18c3aa6caf65165159ee78f2e29fa08aec
Author:     ceski <56656010+ceski-1@users.noreply.github.com>
AuthorDate: Mon May 15 10:10:09 2023 -0700
Commit:     ceski <56656010+ceski-1@users.noreply.github.com>
CommitDate: Mon May 15 10:10:09 2023 -0700

    Clean up EMIDI device handling
---
 src/i_winmusic.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/i_winmusic.c b/src/i_winmusic.c
index 9271064e..4cfa43f5 100644
--- a/src/i_winmusic.c
+++ b/src/i_winmusic.c
@@ -90,9 +90,6 @@ static HANDLE hPlayerThread;
 // MS GS Wavetable Synth Device ID.
 static int ms_gs_synth = MIDI_MAPPER;

-// EMIDI device for track designation.
-static int emidi_device;
-
 // This is a reduced Windows MIDIEVENT structure for MEVT_F_SHORT
 // type of events.

@@ -452,9 +449,6 @@ static void ResetDevice(void)
     MIDI_ResetFallback();
     use_fallback = (reset_type == RESET_TYPE_GS);

-    // Assign EMIDI device for track designation.
-    emidi_device = (reset_type == RESET_TYPE_GS);
-
     switch (reset_type)
     {
         case RESET_TYPE_NONE:
@@ -671,9 +665,6 @@ static void SendSysExMsg(int time, const byte *data, int length)
         // GS (SC-88 or higher). Preserve the composer's intent.
         MIDI_ResetFallback();
         use_fallback = false;
-
-        // Use default device for EMIDI.
-        emidi_device = EMIDI_DEVICE_GENERAL_MIDI;
     }
 }

@@ -796,7 +787,8 @@ static boolean AddToBuffer(unsigned int delta_time, midi_event_t *event,
             return true;
     }

-    if (track->emidi_designated && (emidi_device & ~track->emidi_device_flags))
+    if (track->emidi_designated &&
+        (EMIDI_DEVICE_GENERAL_MIDI & ~track->emidi_device_flags))
     {
         // Send NOP if this device has been excluded from this track.
         SendNOPMsg(delta_time);