Patches item #1755720, was opened at 2007-07-17 22:51 Message generated for change (Comment added) made by dosena2 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1755720...
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: Open Resolution: None Priority: 5 Private: No Submitted By: Nathaniel Dose (dosena2) Assigned to: Nobody/Anonymous (nobody) 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: Nathaniel Dose (dosena2)
Date: 2007-08-04 11: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 22: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...