Page 1 of 1

How to know if a Note ID is still valid

Posted: Sun May 26, 2019 9:55 pm
by dorremifasol
Greetings.

Is there a way to know if a given NoteID is still valid or if the voice has stopped playing completely (after the envelope release phase)? Thanks.

Re: How to know if a Note ID is still valid

Posted: Wed May 29, 2019 10:49 am
by misohoza
dorremifasol wrote:
Sun May 26, 2019 9:55 pm
Greetings.

Is there a way to know if a given NoteID is still valid or if the voice has stopped playing completely (after the envelope release phase)? Thanks.
Probably not, at least not directly.

There are functions like waitForRelease and isNoteHeld which can help you find out if note has received a note off message. But if the envelope is set to oneshot mode then it's possible the voice will be released (stop playing) even if the note is still held. There are couple of functions that deal with used voices. So you could keep track of the number of used voices and update the value with each new note on and note off. You could also read the values of amp envelope and work out the total time you need to wait since note on and then check for used voices. However this can get complicated if you use quick controls to offset envelope times.

Re: How to know if a Note ID is still valid

Posted: Wed May 29, 2019 6:11 pm
by dorremifasol
Thank you for the reply. Yeah I thought about checking the amp envelope values, but I can't find anything that I could use to check if the envelope has finished. It's a pity that Halion doesn't provide a function to query any kind of information about a given Note ID.