Creating custom "wrapper" audio objects

Status
Not open for further replies.

floretan

Member
I have a teensy-based synth project (see https://www.youtube.com/watch?v=MxDHKpysxYs for a demo of the work in progress, since then I added a monophonic/polyphonic/arpeggiator mode selector), and as I add more components my code is getting a bit too complex. I have many repeated structures, which leads me ending up with a bunch of pointers to manage them (see https://github.com/floretan/bontempi/blob/master/synth_main/src/synth.cpp for example if you care about seeing the code).

What I would like to do ideally is to create custom audio objects that can themselves contain multiple standard audio objects. An example: create a SynthVoice that contains two oscillators, a mixer and an envelope, the latter then being connected to the "output" of the group. Then I could create multiple SynthVoice objects and connect them to a mixer for my polyphonic synth.

After giving the code a try and extending the AudioStream class, I can add internal components and connect them together, but I'm unsure how I would go about creating a connection between the internal component and the output of the wrapper object. It seems like there might need to be some direct passing around of audio blocks.

I also tried
Code:
AudioConnection(this->outputMixer, 0, *this, 0);
inside of a class that extends AudioStream (where outputMixer is a property of type AudioMixer4). It compiles fine, but there will obviously be conflicts between internal and external connections, so it might be a bad idea.

Any idea on what the best approach might be?
 
Status
Not open for further replies.
Back
Top