View Single Post
Old 01-10-2012, 06:17 AM   #32
reddiesel41264
Human being with feelings
 
reddiesel41264's Avatar
 
Join Date: Jan 2012
Location: North East UK
Posts: 493
Default

Quote:
Originally Posted by captain_caveman View Post
Cool, if I could just point out one tiny, weeny last buglet...

You didn't have to shuffle my code around btw, just add a check for note-ons @ 0 vel to the note-off and a vel >0 bit to the note-on bit. Anyhoo, the way you have done it is very nearly correct, except...
Code:
//Check if we have recieved a note off message.
  statusLo == 8 || velocity==0 ? (
... checks for a note off or for any other message with a value of 0 (remember that value is only velocity if the message is a note), so whenever any MIDI message of value 0 was received it would cut off the corresponding note, if one was playing (eg note 82 would be cut off by a CC82 message at value 0).

So...
Code:
statusLo == 8 || (statusLo == 9 && velocity == 0) ? (
... will stop that happening.

For the record, this was the bit missing from my code to check for note-offs that are note-ons at zero velocity, as well as a bit to make sure these messages are not confused with actual note-ons....
Code:
statusLo ==9 && velocity > 0 ? (
... but of course, since you have put this section in an else (once you've added the note-off check above), you don't need to put that in since the initial if statement will have executed with a note-on @ zero velocity.
A yes, I will update the code now. Thanks again.
__________________
http://librewave.com - Freedom respecting instruments and effects
http://xtant-audio.com/ - Purveyor of fine sample libraries (and Kontakt scripting tutorials)
reddiesel41264 is offline   Reply With Quote