Audio library and polyphonic synth.

Phm78

Member
Hello all,
I am currently developing an 8-channel synth using Teensy 4.1, SGT5000 and the audio.h library.
Instead of creating eight independent channels, is it possible to index the name of the different modules (oscillator, envelope, filter), so that I can write, for example VCA_ENV.noteOn();
And if so, how to declare the AudioConnection.
 
You need to use code tags for even the most trivial of examples, otherwise your use of [i] will just become invisible while turning all following text italic...

You have to create your own array, such as
Code:
AudioEffectEnvelope* pVCA_ENV[8] = {&env1,&env2,&env3,&env4,&env5,&env6,&env7,&env8};

...

{
    pVCA_ENV[i]->noteOn();
}

env1 to env8 can have been created using the Design Tool, including the connections. Note you can't have an array of references in C++, so you have to store pointers. The purists will probably say to use std::array, but it come to the same thing, really.

Creating AudioConnection objects and re-connecting them is documented at https://www.pjrc.com/teensy/td_libs_AudioConnection.html, though note the syntax for creating a new, unconnected one is incorrect: it should be AudioConnection myConnection;, without the empty brackets.
 
Back
Top