I am experimenting with every type of plug-in for FL Studio. I came across an unexpected behavior with Hybrid Generators and I would like to know if it is intended.
A Hybrid Generator calls the function:
int _stdcall Voice_Render( TVoiceHandle Handle, PWAV32FS DestBuffer, int &Length );
to let each individual triggered voice to render itself and write its output in DestBuffer.
From my understanding, the function should return either FVR_Ok or FVR_NoMoreData to let the Host know if it should either carry on or stop calling the Voice_Render function. Taking into account the full cycle of playing a note, the sequence of function calls should be:
- TVoiceHandle _stdcall TriggerVoice( PVoiceParams VoiceParams, intptr_t SetTag ); // once on key press
- int _stdcall Voice_Render( TVoiceHandle Handle, PWAV32FS DestBuffer, int& Length ); // multiple times while it returns FVR_Ok
- void _stdcall Voice_Release( TVoiceHandle Handle ); // once on key release
- int _stdcall Voice_Render( TVoiceHandle Handle, PWAV32FS DestBuffer, int& Length ); // multiple times until it returns FVR_NoMoreData
- void _stdcall Voice_Kill( TVoiceHandle Handle ); // once to allow resource destruction
The behavior I am seeing is that right after releasing the key, Voice_Release is called as expected, but after that Voice_Render is called only 3 times, regardless the return value, then Voice_Kill is called. If this is the intended behavior, it seems that there is no way to account for a Release Stage in a Hybrid Generator. Is it correct or am I missing something?
Thank you very much
Enrico