MIDI In : handle none System Exclusive messages

Emmanuel Maillard mahanuu at free.fr
Fri Apr 27 05:10:57 CDT 2007


Changelog :
- Handle none System Exclusive messages

-------------- next part --------------
From bb3dfcde2677083095adec40f8b30f2c8606ea45 Mon Sep 17 00:00:00 2001
From: Emmanuel Maillard <mahanuu at free.fr>
Date: Fri, 27 Apr 2007 12:07:54 +0200
Subject: [PATCH] - handle none System Exclusive messages

---
 dlls/winecoreaudio.drv/midi.c |   53 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/dlls/winecoreaudio.drv/midi.c b/dlls/winecoreaudio.drv/midi.c
index 91d1432..36e9dba 100644
--- a/dlls/winecoreaudio.drv/midi.c
+++ b/dlls/winecoreaudio.drv/midi.c
@@ -842,8 +842,10 @@ static CFDataRef MIDIIn_MessageHandler(C
 {
     MIDIMessage *msg = NULL;
     int i = 0;
-    FIXME("\n");
-
+    MIDISource *src = NULL;
+    DWORD sendData = 0;
+    
+    TRACE("\n");
     switch (msgid)
     {
         case 0:
@@ -853,11 +855,58 @@ static CFDataRef MIDIIn_MessageHandler(C
                 TRACE("%02X ", msg->data[i]);
             }
             TRACE("\n");
+            src = &sources[msg->devID];
+            if (src->state < 1)
+            {
+                TRACE("input not started, thrown away\n");
+                goto done;
+            }
+            /* FIXME skipping SysEx */
+            if (msg->data[0] == 0xF0)
+            {
+                FIXME("Starting System Exclusive\n");
+                src->state |= 2;
+                for (i = 0; i < msg->length; ++i)
+                {
+                    if (msg->data[i] == 0xF7)
+                    {
+                        FIXME("Ending System Exclusive\n");
+                        src->state &= ~2;
+                    }
+                }                
+                goto done;
+            }
+            if (src->state & 2)
+            {
+                for (i = 0; i < msg->length; ++i)
+                {
+                    if (msg->data[i] == 0xF7)
+                    {
+                        FIXME("Ending System Exclusive\n");
+                        src->state &= ~2;
+                    }
+                }
+                goto done;
+            }
+            EnterCriticalSection(&midiInLock);
+            if (msg->length == 3)
+            {
+                sendData = (msg->data[2] << 16) |
+                            (msg->data[1] <<  8) |
+                            (msg->data[0] <<  0);
+            }
+            if (msg->length == 2)
+            {
+                sendData = (msg->data[1] <<  8) | (msg->data[0] <<  0);
+            }
+            MIDI_NotifyClient(msg->devID, MIM_DATA, sendData, GetTickCount() - src->startTime);
+            LeaveCriticalSection(&midiInLock);
             break;
         default:
             CFRunLoopStop(CFRunLoopGetCurrent());
             break;
     }
+done:
     return NULL;
 }
 
-- 
1.4.4



More information about the wine-patches mailing list