23#include <juce_audio_processors/juce_audio_processors.h>
28#ifndef JucePlugin_IsSynth
29#error "JucePlugin_IsSynth must be defined. Use this class inside of a JUCE project."
30const auto JucePlugin_IsSynth =
false;
33#ifndef JucePlugin_Name
34#error "JucePlugin_Name must be defined. Use this class inside of a JUCE project."
35const auto JucePlugin_Name =
"";
38#ifndef JucePlugin_WantsMidiInput
39#error "JucePlugin_WantsMidiInput must be defined. Use this class inside of a JUCE project."
40const auto JucePlugin_WantsMidiInput =
false;
43#ifndef JucePlugin_ProducesMidiOutput
44#error "JucePlugin_ProducesMidiOutput must be defined. Use this class inside of a JUCE project."
45const auto JucePlugin_ProducesMidiOutput =
false;
48#ifndef JucePlugin_IsMidiEffect
49#error "JucePlugin_IsMidiEffect must be defined. Use this class inside of a JUCE project."
50const auto JucePlugin_IsMidiEffect =
false;
97template<
class StateManager>
108 juce::AudioChannelSet
inputs = juce::AudioChannelSet::disabled();
111 auto hasInputs() const ->
bool {
return inputs != juce::AudioChannelSet::disabled(); }
116 : AudioProcessor(conf.hasInputs() ? BusesProperties()
117 .withInput(
"Input", conf.inputs, true)
118 .withOutput(
"Output", conf.outputs, true)
119 : BusesProperties().withOutput(
"Output", conf.outputs, true))
130 return layouts.getMainInputChannelSet().size() == _conf.
inputs.size() &&
131 layouts.getMainOutputChannelSet().size() == _conf.
outputs.size();
143 juce::ignoreUnused(sampleRate);
144 juce::ignoreUnused(maxSamplesPerBlock);
156 const juce::String
getName()
const override {
return _name; }
167 virtual std::unique_ptr<juce::AudioProcessorEditor>
customEditor() {
return {}; }
217 if (
const auto xml = getXmlFromBinary(data, sizeInBytes))
231 juce::AudioProcessorEditor* createEditor() final
234 return editor.release();
235 return new juce::GenericAudioProcessorEditor(*
this);
238 inline static const auto _isSynth =
bool{ JucePlugin_IsSynth };
239 inline static const auto _name = juce::String{ JucePlugin_Name };
240 inline static const auto _wantsMidi =
bool{ JucePlugin_WantsMidiInput };
241 inline static const auto _producesMidi =
bool{ JucePlugin_ProducesMidiOutput };
242 inline static const auto _isMidiEffect =
bool{ JucePlugin_IsMidiEffect };
244 juce::ScopedNoDenormals _disableDenormals;
The base class for all fsh::stk plugins.
Definition Processor.h:99
void releaseResources() override
Called by the DAW when the user stops playback.
Definition Processor.h:150
int getCurrentProgram() override
Returns the index of the current program (preset).
Definition Processor.h:185
void getStateInformation(juce::MemoryBlock &destData) override
Saves the entire plugin state to a binary blob.
Definition Processor.h:207
const juce::String getProgramName(int) override
Returns the name of the program at the given index.
Definition Processor.h:189
int getNumPrograms() override
Returns the number of programs (presets) supported by the plugin.
Definition Processor.h:181
bool hasEditor() const override
Returns whether the plugin has an editor. (It does, by default.)
Definition Processor.h:162
StateManager _params
Use this to access the plugin's parameters.
Definition Processor.h:224
bool isBusesLayoutSupported(const BusesLayout &layouts) const override
Used to tell the DAW whether a given channel layout is supported by the plugin.
Definition Processor.h:128
bool acceptsMidi() const override
Returns whether the plugin accepts MIDI input (as specified in the JUCE project settings)
Definition Processor.h:170
bool producesMidi() const override
Returns whether the plugin produces MIDI output (as specified in the JUCE project settings)
Definition Processor.h:173
void setCurrentProgram(int) override
Returns the name of the current program (preset).
Definition Processor.h:193
void prepareToPlay(double sampleRate, int maxSamplesPerBlock) override
Called by the DAW when the user starts playback.
Definition Processor.h:141
bool isMidiEffect() const override
Returns whether the plugin is a MIDI effect (as specified in the JUCE project settings)
Definition Processor.h:176
Processor(const Config &conf)
Construct a plugin instance.
Definition Processor.h:115
void changeProgramName(int, const juce::String &) override
Renames the program at the given index.
Definition Processor.h:200
const juce::String getName() const override
Get the plugin name (as specified in the JUCE project settings)
Definition Processor.h:156
void setStateInformation(const void *data, int sizeInBytes) override
Recalls the entire plugin state from a (valid) binary blob.
Definition Processor.h:215
double getTailLengthSeconds() const override
Return the plugin's audio tail length. The default implementation returns 0.0.
Definition Processor.h:159
virtual std::unique_ptr< juce::AudioProcessorEditor > customEditor()
Provide custom editor instead of GenericAudioProcessorEditor.
Definition Processor.h:167
Base class for storing plugin state.
Definition StateManager.h:39
auto getState() -> juce::XmlElement
Called by the PluginBase class to save the plugin state.
Definition StateManager.cpp:31
void setState(const juce::XmlElement &xml)
Called by the PluginBase class to restore the plugin state.
Definition StateManager.cpp:40
The input/output configuration struct for the plugin. This is passed to the constructor.
Definition Processor.h:103
juce::AudioChannelSet inputs
Input channel set (optional)
Definition Processor.h:108
auto hasInputs() const -> bool
Returns true if the configuration has enabled inputs.
Definition Processor.h:111
juce::AudioChannelSet outputs
Output channel set.
Definition Processor.h:105