how to know when envelope is done?

Status
Not open for further replies.

mykle

Well-known member
Hello,

A quick question about the envelope object: is there a way to fire a callback when the envelope is completely closed? Working on a polyphonic kbd system, where I want to work with a pool of voices, so I want to free up a voice for reuse when it's done playing. What's the best way of knowing that? I don't see a method for it on the object itself. I guess I could set a timer when I call noteOff(), but there must already be some timer in play ...

-m-
 
I submitted a patch: https://github.com/PaulStoffregen/Audio/pull/175 to provide access to the envelope state in the Audio library. It's not a callback, but you can poll in your loop() on where the envelope is in its state.

Call envelope.getState() and check to see if it returns one of STATE_IDLE, STATE_DELAY, STATE_ATTACK, STATE_HOLD, STATE_DECAY, STATE_SUSTAIN, STATE_RELEASE...
 
Last edited:
I submitted a patch: https://github.com/PaulStoffregen/Audio/pull/175 to provide access to the envelope state in the Audio library. It's not a callback, but you can poll in your loop() on where the envelope is in its state.

Call envelope.getState() and check to see if it returns one of STATE_IDLE, STATE_DELAY, STATE_ATTACK, STATE_HOLD, STATE_DECAY, STATE_SUSTAIN, STATE_RELEASE...

I'm still learning this SW environment....

How can I get a version with this new envelope.getState() method please?
 
Status
Not open for further replies.
Back
Top