TonicAudio / Tonic

Easy and efficient audio synthesis in C++
The Unlicense
523 stars 63 forks source link

newbie question...polyphonic synth #242

Closed SamsonYoung closed 9 years ago

SamsonYoung commented 10 years ago

hi there! I apologise in advance for asking a newbie question...this is probably super obvious, but I wasn't able to figure this out...

I need to manage up to 8 voices of sound, sorta like making 8 independent synths that would stop and start independently of each other. New voices need to be added and subtracted from the final output dynamically. I saw that there are mixer / channel subclasses inside of BufferFiller.h, but I wasn't able to figure them out on my own. I also looked through the example synths and didn't see these subclasses being used... could you give me some pointers? Thanks a ton!

morganpackard commented 10 years ago

Hi. Are you talking about a voice manager type thing that you would use to start voices when keys on a keyboard were pressed? And be able to manage multiple instances of the same synth class?

@Dewb wrote a nice voice manager class a while ago that I'm having trouble finding. We haven't rolled anything like that in to the tonic Tonic core, but this code by @Dewb may do what you're looking for:

https://github.com/Dewb/Tonic/tree/midi/Demo/Standalone/PolyMIDIDemo

Dewb commented 10 years ago

Yes, that's the one, you should be able to take PolySynth.cpp/.h and drop them into your own project.