[PD-dev] [ pure-data-Patches-1755720 ] patch: OS X sysexin/midiin support #3

SourceForge.net noreply at sourceforge.net
Fri Apr 25 01:05:09 CEST 2008


Patches item #1755720, was opened at 2007-07-17 16:51
Message generated for change (Settings changed) made by eighthave
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1755720&group_id=55736

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: puredata
Group: bugfix
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Nathaniel Dose (dosena2)
Assigned to: Miller Puckette (millerpuckette)
Summary: patch: OS X sysexin/midiin support #3

Initial Comment:
Here is changed file 3 of 3 for enabling "sysexin" and "midiin". This is the most extensive patch of the 3, but is still small. Attached is a udiff. 

Basically sys_poll_midi had only 1 byte of sysex as state at one time - now it keeps track of a whole (multibyte) sysex message. I was told to post here by the dev mailing list.

Please change the value of the file-local variables nd_sysex* as needed! I am not familiar yet with your naming conventions.

$ cvs status s_midi_pm.c 
===================================================================
File: s_midi_pm.c       Status: Locally Modified

   Working revision:    1.6
   Repository revision: 1.6     /cvsroot/pure-data/pd/src/s_midi_pm.c,v
   Sticky Tag:          stable_0_40 (branch: 1.6.2)
   Sticky Date:         (none)
   Sticky Options:      (none)


$ cvs diff -u s_midi_pm.c 
Index: s_midi_pm.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_midi_pm.c,v
retrieving revision 1.6
diff -u -r1.6 s_midi_pm.c
--- s_midi_pm.c 8 Jul 2005 00:02:45 -0000       1.6
+++ s_midi_pm.c 17 Jul 2007 20:48:27 -0000
@@ -140,7 +140,7 @@
         writemidi4(mac_midioutdevlist[portno], byte, 0, 0, 0);
     else if (byte == 0xf0)
     {
-        mess[0] = 0xf7;
+        mess[0] = 0xf0;
         nbytes = 1;
         sysex = 1;
     }
@@ -209,6 +209,38 @@
     }
 }
 
+/* this is non-zero if we are in the middle of transmitting sysex */
+
+int nd_sysex_mode=0;
+
+/* send in 4 bytes of sysex data. if one of the bytes is 0xF7 (sysex end) stop and unset nd_sysex_mode */ 
+void nd_sysex_inword(int midiindev, int status, int data1, int data2, int data3)
+{
+    if (nd_sysex_mode) {
+        sys_midibytein(midiindev, status);
+        if (status == 0xF7)
+            nd_sysex_mode = 0;
+    }
+
+    if (nd_sysex_mode) {
+        sys_midibytein(midiindev, data1);
+        if (data1 == 0xF7)
+            nd_sysex_mode = 0;
+    }
+
+    if (nd_sysex_mode) {
+        sys_midibytein(midiindev, data2);
+        if (data2 == 0xF7)
+            nd_sysex_mode = 0;
+    }
+
+    if (nd_sysex_mode) {
+        sys_midibytein(midiindev, data3);
+        if (data3 == 0xF7)
+            nd_sysex_mode = 0;
+    }
+}
+
 void sys_poll_midi(void)
 {
     int i, nmess;
@@ -221,6 +253,7 @@
             int status = Pm_MessageStatus(buffer.message);
             int data1  = Pm_MessageData1(buffer.message);
             int data2  = Pm_MessageData2(buffer.message);
+            int data3 = ((buffer.message >> 24) & 0xFF);
             int msgtype = (status >> 4) - 8;
             switch (msgtype)
             {
@@ -239,8 +272,12 @@
                 sys_midibytein(i, data1);
                 break;
             case 7:
-                sys_midibytein(i, status);
+                nd_sysex_mode=1;
+                nd_sysex_inword(i, status, data1, data2, data3);
                 break; 
+            default:
+                if (nd_sysex_mode)
+                    nd_sysex_inword(i, status, data1, data2, data3);
             }
         }
     }


----------------------------------------------------------------------

>Comment By: Hans-Christoph Steiner (eighthave)
Date: 2008-04-24 19:05

Message:
Logged In: YES 
user_id=27104
Originator: NO

included in Pd-0.41-4

----------------------------------------------------------------------

Comment By: Mathieu Bouchard (matju)
Date: 2007-12-07 14:18

Message:
Logged In: YES 
user_id=801174
Originator: NO

this was merged into desiredata last summer. i didn't post about it here
right away because I had a policy not to post on the sf bugtracker about
desiredata. I changed my mind.

----------------------------------------------------------------------

Comment By: Nathaniel Dose (dosena2)
Date: 2007-08-04 05:33

Message:
Logged In: YES 
user_id=1845257
Originator: YES

The other two patches are on HEAD (August 2/see below), not 0.41-test05
(which I assume is the same as v0-41-0test05)

Is this planned or is a tag missing?

pmmacosxcm.c: rev 1.22
x_midi.c: rev 1.5

----------------------------------------------------------------------

Comment By: Miller Puckette (millerpuckette)
Date: 2007-07-29 16:41

Message:
Logged In: YES 
user_id=313747
Originator: NO

These three should be reflected in 0.41-test05.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1755720&group_id=55736




More information about the Pd-dev mailing list