View Single Post
Old 01-08-2012, 12:35 PM   #11
captain_caveman
Human being with feelings
 
captain_caveman's Avatar
 
Join Date: Dec 2011
Posts: 999
Default

I hope you don't mind but I've updated your code with something that should almost certainly (I can't test it at the mo) fix the hanging notes issue....
Code:
//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
			);
         );
captain_caveman is offline   Reply With Quote