Initial plugin version
This commit is contained in:
43
Source/AudioEngine.h
Normal file
43
Source/AudioEngine.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include "SynthVoice.h"
|
||||
#include <JuceHeader.h>
|
||||
|
||||
class NeuralAudioEngine : public juce::MPESynthesiser
|
||||
{
|
||||
public:
|
||||
static constexpr auto maxNumVoices = 4;
|
||||
|
||||
//==============================================================================
|
||||
NeuralAudioEngine(NeuralSharedParams &sp)
|
||||
{
|
||||
for (auto i = 0; i < maxNumVoices; ++i)
|
||||
addVoice(new NeuralSynthVoice(sp));
|
||||
|
||||
setVoiceStealingEnabled(true);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void prepare(const juce::dsp::ProcessSpec& spec) noexcept
|
||||
{
|
||||
setCurrentPlaybackSampleRate(spec.sampleRate);
|
||||
|
||||
for (auto* v : voices)
|
||||
dynamic_cast<NeuralSynthVoice*> (v)->prepare(spec);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
template <typename VoiceFunc>
|
||||
void applyToVoices(VoiceFunc&& fn) noexcept
|
||||
{
|
||||
for (auto* v : voices)
|
||||
fn(dynamic_cast<NeuralSynthVoice*> (v));
|
||||
}
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
void renderNextSubBlock(juce::AudioBuffer<float>& outputAudio, int startSample, int numSamples) override
|
||||
{
|
||||
MPESynthesiser::renderNextSubBlock(outputAudio, startSample, numSamples);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user