Ok with some digging I've come up with a sort-of solution.
For the pathological "I have data and I want it processed" case, one can:
- Make a channel with a custom source providing your input data. (mute the channel if you don't want to hear the processing.)
- Add the effect with which you want to process that data to that channel.
- Add a custom effect to capture the processed data. You can also un-mute the channel, or use a delay line afterwards if you want to send that to some other audio channel.
It feels supremely hack-y compared to having a single, in-line function to process data, and requires managing a multi-threaded producer/consumer scenario since all the processing still has to be done on the audio thread, but it does technically work.
For the polyphonic synth case, it's appears to be missing a key component.
If you add
PDSynths to individual channels, it's possible to get polyphonic effects. In the case of the sybtractive synth voice, I can:
- Add a new
- Add the filter and
PDSynth to the channel
- Set the envelope to modulate the
TwoPoleFilter cut off.
- set the envelope to modulate parameter 0 of the synth This one is key.
PDSynth parameters are 1-indexed, but parameter 0 still gets note-on/off events, so you can set a modulator there which doesn't affect the generator, but can sill react to what the
PDSynth is doing.
- Almost Profit.
The problem I'm running into now is that
PDSynth voices cannot be added to both a
Channel and a
PDSynthInstrument at the same time, meaning I have to roll my own note/voice management.
If I add the
PDSynth voice to a channel before adding it to a
PDSynthInstrument I get an error "Failed to add voice to instrument":
m_Synth.addVoice(m_Voice, 0.0f, 127.0f, 0.0f); // Get an error here.
and the other way around results in error-less silence:
m_Synth.addVoice(m_Voice, 0.0f, 127.0f, 0.0f);
m_Synth.noteOn(33, 1.0f); // No error, but no sound either.
(Using the C++ API here for examples, but they are one-for-one with what you'd expect the C API do be doing under the hood)
If each voice could be sent to an independent channel, and a
PDSynthInstrument could be relied upon to manage notes, pitch-bend, etc., then the above solution would work.