[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] Re: sc_coremidi bug



On Mar 2, 2006, at 10:29 AM, Chris Brown wrote:

Sorry I can't help with alleviating  this process, but thought I'd point out that this bugger's still not working properly.   Events with exact  same input time are now received, but not differentiated properly.  For example, two notes received at exactly the same time now have the same note numbers and velocities.

Hmm... this is what I have on my box, and it matches cvs exactly (cvs diff printed nothing). Since all the packet references are now based on i (the index to the current MIDI message), I'm not sure where it's broken.

Are you using the most up-to-date build?

Busy tonight, over the weekend I'll download the latest from Wesleyan and test it myself...?

hjh

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 += 2;
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);
}
}


: H. James Harkins
: jamshark70@xxxxxxxxxxxxxxxxx
: http://www.dewdrop-world.net
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal." -- Whitman