View Single Post
Old 01-08-2012, 01:17 PM   #12
stephane
Human being with feelings
 
Join Date: May 2010
Location: France
Posts: 97
Default

Helly captain

I tried your code, but the probleme is not fixed

Code:
while( midirecv(offset,msg1,msg23) ? (

	// Extract note and status value
	note = msg23&$x7F;
	statusLo = (msg1/16)|0;
	status = msg1&$xF0;

	//If we recieve a note on message
	statusLo ==9 ? (
		note == ks1 ? channel = 0;
		note == ks2 ? channel = 1;
		note == ks3 ? channel = 2;
		note == ks4 ? channel = 3;
		note == ks5 ? channel = 4;
		note == ks6 ? channel = 5;
		note == ks7 ? channel = 6;
		note == ks8 ? channel = 7;
		note == ks9 ? channel = 8;
		note == ks10 ? channel = 9;
		note == ks11 ? channel = 10;
		note == ks12 ? channel = 11;
		note == ks13 ? channel = 12;
		note == ks14 ? channel = 13;
		note == ks15 ? channel = 14;
		note == ks16 ? channel = 15;
		playednotes[note] = channel+1; //add one to the channel so unplayed slots will be zero
	);

	//If we receive a note off message
	statusLo == 8 ? (
		//if the slot is >0 it means this note on has been played so retrieve note on channel
		playednotes[note] > 0 ? (
			channel = playednotes[note]-1;
			playednotes[note]=0; //reset the slot
		);
	);

	msg1 = status + channel;	//Route to new MIDI Channel
	midisend(offset, msg1, msg23); )// Send message on with channel adjustment

);
stephane is offline   Reply With Quote