In the processBlock, I have to access the instance labeled MPEVoices directly to capture some events and conditions. This is why I do add MPEvoices with unique pointer to the mpesynth object.
Everything runs on the app the way I want, but I could not avoid the crash of MPESynthesiser when I quit the app. I have also tried to construct the MPEVoices with OwnedArray and add it to mpesynth object, again the same crash.
Could you please enlighten me how deconstruct the MPESyntheiser during the quit operation. And actually any information why this is happening on the mpesynth object ?
void MPESynthesiser::addVoice ( MPESynthesiserVoice * newVoice )
Adds a new voice to the synth.
All the voices should be the same class of object and are treated equally.
The object passed in will be managed by the synthesiser, which will delete it later on when no longer needed. The caller should not retain a pointer to the voice.
You don’t want to use unique_ptr for your voices. Just new a new voice and pass it to the synth.
I have subclassed an MPESynthesiservoice with public variables and overridden methods, which I do have to access in processor block.
When I do add these voices to mpesynth as you say, I cannot access my voice instances through
mpesynth->getVoice(i)->
which I don’t understand. It seems that only if I have ownership to the voice pointers, only then I can access my voice class. But then it leads to a crash when quitting the app.
I don’t understand the design of MPESynthesiser in that case, or I am missing something in how to access a subclasses voice instance through mpe sythesiser instance.