Created
July 19, 2020 16:33
-
-
Save Xenakios/42d8374516847e273de351a9f31d8c49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class APGWrapper | |
{ | |
public: | |
AudioProcessorGraph graph; | |
void prepare (const dsp::ProcessSpec& spec) | |
{ | |
helperbuf.setSize(spec.numChannels, spec.maximumBlockSize); | |
graph.prepareToPlay(spec.sampleRate, spec.maximumBlockSize); | |
} | |
void process (const dsp::ProcessContextReplacing<float>& context) noexcept | |
{ | |
auto& outblock = context.getOutputBlock(); | |
helperbuf.setSize((int)outblock.getNumChannels(), (int)outblock.getNumSamples(), false, false, true); | |
outblock.copyTo(helperbuf); | |
graph.processBlock(helperbuf, midibuf); | |
outblock.copyFrom(helperbuf); | |
} | |
private: | |
AudioBuffer<float> helperbuf; | |
MidiBuffer midibuf; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment