Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv859
Modified Files: Tag: devel_0_39 s_midi_pm.c Log Message: fixing midi input
Index: s_midi_pm.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_midi_pm.c,v retrieving revision 1.4.4.1.2.5 retrieving revision 1.4.4.1.2.6 diff -C2 -d -r1.4.4.1.2.5 -r1.4.4.1.2.6 *** s_midi_pm.c 7 Aug 2006 11:31:31 -0000 1.4.4.1.2.5 --- s_midi_pm.c 29 Aug 2006 22:38:38 -0000 1.4.4.1.2.6 *************** *** 220,224 **** void sys_poll_midi(void) { ! int i, nmess; PmEvent buffer; for (i = 0; i < mac_nmidiindev; i++) --- 220,224 ---- void sys_poll_midi(void) { ! int i, j, nmess; PmEvent buffer; for (i = 0; i < mac_nmidiindev; i++) *************** *** 227,254 **** if (nmess > 0) { ! int status = Pm_MessageStatus(buffer.message); ! int data1 = Pm_MessageData1(buffer.message); ! int data2 = Pm_MessageData2(buffer.message); ! int msgtype = (status >> 4) - 8; ! switch (msgtype) ! { ! case 0: ! case 1: ! case 2: ! case 3: ! case 6: ! sys_midibytein(i, status); ! sys_midibytein(i, data1); ! sys_midibytein(i, data2); ! break; ! case 4: ! case 5: ! sys_midibytein(i, status); ! sys_midibytein(i, data1); ! break; ! case 7: ! sys_midibytein(i, status); ! break; ! } } } --- 227,274 ---- if (nmess > 0) { ! PmMessage msg = buffer.message; ! int status = Pm_MessageStatus(msg); ! if(status == 0xf0 || !(status&0x80)) { ! // sysex ! for(j = 0; j < 4; ++j,msg >>= 8) { ! int data = msg&0xff; ! sys_midibytein(i, data); ! if(data == 0xf7) break; //sysex end ! } ! } ! else { ! // non-sysex ! sys_midibytein(i, status); ! ! switch(status>>4) ! { ! case 0x8: // note off ! case 0x9: // note on ! case 0xa: // poly pressure ! case 0xb: // control change ! case 0xe: // pitch bend ! sys_midibytein(i, Pm_MessageData1(msg)); ! sys_midibytein(i, Pm_MessageData2(msg)); ! break; ! case 0xc: // program change ! case 0xd: // channel pressure ! sys_midibytein(i, Pm_MessageData1(msg)); ! break; ! case 0xf: // system common/realtime messages ! switch(status) ! { ! case 0xf1: // time code ! case 0xf3: // song select ! case 0xf6: // tune request ! sys_midibytein(i, Pm_MessageData1(msg)); ! break; ! case 0xf2: // song position pointer ! sys_midibytein(i, Pm_MessageData1(msg)); ! sys_midibytein(i, Pm_MessageData2(msg)); ! break; ! } ! break; ! } ! } } }