FahlGrahn Audio v1.0.0
Loading...
Searching...
No Matches
PluginProcessor.h
1#pragma once
2
3#include <juce_audio_processors/juce_audio_processors.h>
4#include "Oscillator.h"
5#include "SynthVoice.h"
6
7//==============================================================================
8class SynthAudioProcessor final : public juce::AudioProcessor, juce::AudioProcessorValueTreeState::Listener
9{
10public:
11 //==============================================================================
13 ~SynthAudioProcessor() override;
14
15 //==============================================================================
16 void prepareToPlay(double sampleRate, int samplesPerBlock) override;
17 void releaseResources() override;
18
19 bool isBusesLayoutSupported(const BusesLayout &layouts) const override;
20
21 void processBlock(juce::AudioBuffer<float> &, juce::MidiBuffer &) override;
22 using AudioProcessor::processBlock;
23
24 //==============================================================================
25 juce::AudioProcessorEditor *createEditor() override;
26 bool hasEditor() const override;
27
28 //==============================================================================
29 const juce::String getName() const override;
30
31 bool acceptsMidi() const override;
32 bool producesMidi() const override;
33 bool isMidiEffect() const override;
34 double getTailLengthSeconds() const override;
35
36 //==============================================================================
37 int getNumPrograms() override;
38 int getCurrentProgram() override;
39 void setCurrentProgram(int index) override;
40 const juce::String getProgramName(int index) override;
41 void changeProgramName(int index, const juce::String &newName) override;
42
43 //==============================================================================
44 void getStateInformation(juce::MemoryBlock &destData) override;
45 void setStateInformation(const void *data, int sizeInBytes) override;
46
47 void parameterChanged(const juce::String &parameter, float newValue) override;
48
49 juce::AudioProcessorValueTreeState parameters;
50 juce::MidiKeyboardState keyboardState;
51
52private:
53 std::atomic<bool> requiresUpdate{false};
54 juce::Synthesiser synth;
55 static constexpr int numOfVoices = 3;
56 juce::AudioParameterInt* oscTypeParameter;
57
58 //==============================================================================
59 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SynthAudioProcessor)
60};
Definition PluginProcessor.h:9