when was your last update? was it a clean one? tom static void midiProcessPacket(MIDIPacket *pkt, int uid) { //jt if(pkt) { pthread_mutex_lock (&gLangMutex); //dont know if this is really needed/seems to be more stable.. // it is needed -jamesmcc if (compiledOK) { VMGlobals *g = gMainVMGlobals; uint8 i = 0; while (i < pkt->length) { uint8 status = pkt->data[i] & 0xF0; uint8 chan = pkt->data[i] & 0x0F; g->canCallOS = false; // cannot call the OS ++g->sp; SetObject(g->sp, s_midiin->u.classobj); // Set the class MIDIIn //set arguments: ++g->sp;SetInt(g->sp, uid); //src // ++g->sp; SetInt(g->sp, status); //status ++g->sp; SetInt(g->sp, chan); //chan switch (status) { case 0x80 : //noteOff ++g->sp; SetInt(g->sp, pkt->data[i + 1]); //val1 ++g->sp; SetInt(g->sp, pkt->data[i + 2]); //val2 runInterpreter(g, s_midiNoteOffAction, 5); i += 3; break; case 0x90 : //noteOn ++g->sp; SetInt(g->sp, pkt->data[i + 1]); //val1 ++g->sp; SetInt(g->sp, pkt->data[i + 2]); //val2 runInterpreter(g, pkt->data[i + 2] ? s_midiNoteOnAction : s_midiNoteOffAction, 5); i += 3; break; case 0xA0 : //polytouch ++g->sp; SetInt(g->sp, pkt->data[i + 1]); //val1 ++g->sp; SetInt(g->sp, pkt->data[i + 2]); //val2 runInterpreter(g, s_midiPolyTouchAction, 5); i += 3; break; case 0xB0 : //control ++g->sp; SetInt(g->sp, pkt->data[i + 1]); //val1 ++g->sp; SetInt(g->sp, pkt->data[i + 2]); //val2 runInterpreter(g, s_midiControlAction, 5); i += 3; break; case 0xC0 : //program ++g->sp; SetInt(g->sp, pkt->data[i + 1]); //val1 runInterpreter(g, s_midiProgramAction, 4); i += 2; break; case 0xD0 : //touch ++g->sp; SetInt(g->sp, pkt->data[i + 1]); //val1 runInterpreter(g, s_midiTouchAction, 4); i += 2; break; case 0xE0 : //bend ++g->sp; SetInt(g->sp, (pkt->data[i + 2] << 7) | pkt->data[i + 1]); //val1 runInterpreter(g, s_midiBendAction, 4); i += 3; break; case 0xF0 : midiProcessSystemPacket(pkt, chan); i += 1; break; default : // data byte => continuing sysex message chan = 0; midiProcessSystemPacket(pkt, chan); i += 1; break; } } g->canCallOS = false; } pthread_mutex_unlock (&gLangMutex); } } |