Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16979
Modified Files: Tag: desiredata s_midi_pm.c Log Message: part of a osx portmidi patch from Nathaniel Dose.
Index: s_midi_pm.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_midi_pm.c,v retrieving revision 1.4.4.1.2.8.2.3 retrieving revision 1.4.4.1.2.8.2.4 diff -C2 -d -r1.4.4.1.2.8.2.3 -r1.4.4.1.2.8.2.4 *** s_midi_pm.c 24 Jul 2007 02:23:28 -0000 1.4.4.1.2.8.2.3 --- s_midi_pm.c 24 Jul 2007 03:21:47 -0000 1.4.4.1.2.8.2.4 *************** *** 4,11 **** * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
! this file calls portmidi to do MIDI I/O for MSW and Mac OSX.
*/
#include "m_pd.h" #include "s_stuff.h" --- 4,13 ---- * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
! this file calls portmidi to do MIDI I/O for MSW and Mac OSX. ! applied sysexin/midiin patch by Nathaniel Dose, july 2007.
*/
+ #include "m_pd.h" #include "s_stuff.h" *************** *** 99,108 **** writemidi4(mac_midioutdevlist[portno], byte, 0, 0, 0); else if (byte == 0xf0) { ! mess[0] = 0xf7; nbytes = 1; sysex = 1; } else if (byte == 0xf7) { mess[nbytes] = byte; ! for (i = nbytes+1; i < 4; i++) mess[i] = 0; writemidi4(mac_midioutdevlist[portno], mess[0], mess[1], mess[2], mess[3]); sysex = 0; --- 101,110 ---- writemidi4(mac_midioutdevlist[portno], byte, 0, 0, 0); else if (byte == 0xf0) { ! mess[0] = 0xf0; nbytes = 1; sysex = 1; } else if (byte == 0xf7) { mess[nbytes] = byte; ! for (i = nbytes+1; i<4; i++) mess[i] = 0; writemidi4(mac_midioutdevlist[portno], mess[0], mess[1], mess[2], mess[3]); sysex = 0; *************** *** 121,126 **** nbytes++; if (nbytes == 4) { ! writemidi4(mac_midioutdevlist[portno], ! mess[0], mess[1], mess[2], mess[3]); nbytes = 0; } --- 123,127 ---- nbytes++; if (nbytes == 4) { ! writemidi4(mac_midioutdevlist[portno], mess[0], mess[1], mess[2], mess[3]); nbytes = 0; } *************** *** 145,148 **** --- 146,160 ---- }
+ /* 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() { PmEvent buffer; *************** *** 186,191 **** sys_midibytein(i, Pm_MessageData2(msg)); break; } - break; } } --- 198,209 ---- sys_midibytein(i, Pm_MessageData2(msg)); break; + case 0xf7: // from Nathaniel; don't know whether it'll work in this context. + nd_sysex_mode=1; + nd_sysex_inword(i, status, data1, data2, data3); + break; + default: // from Nathaniel too. + if (nd_sysex_mode) nd_sysex_inword(i, status, data1, data2, data3); + break; } } }