Skip to content

Commit

Permalink
reset plugin processor and editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Augnos committed Jan 22, 2024
1 parent 74f3d1d commit ea93229
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 30 deletions.
8 changes: 4 additions & 4 deletions plugin/include/PS1-Reverb/PluginEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ namespace audio_plugin {

class AudioPluginAudioProcessorEditor : public juce::AudioProcessorEditor {
public:
explicit AudioPluginAudioProcessorEditor(AudioPluginAudioProcessor &);
explicit AudioPluginAudioProcessorEditor(AudioPluginAudioProcessor&);
~AudioPluginAudioProcessorEditor() override;

void paint(juce::Graphics &) override;
void paint(juce::Graphics&) override;
void resized() override;

private:
// This reference is provided as a quick way for your editor to
// access the processor object that created it.
AudioPluginAudioProcessor &processorRef;
AudioPluginAudioProcessor& processorRef;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AudioPluginAudioProcessorEditor)
};
} // namespace audio_plugin
} // namespace audio_plugin
14 changes: 7 additions & 7 deletions plugin/include/PS1-Reverb/PluginProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class AudioPluginAudioProcessor : public juce::AudioProcessor {
void prepareToPlay(double sampleRate, int samplesPerBlock) override;
void releaseResources() override;

bool isBusesLayoutSupported(const BusesLayout &layouts) const override;
bool isBusesLayoutSupported(const BusesLayout& layouts) const override;

void processBlock(juce::AudioBuffer<float> &, juce::MidiBuffer &) override;
void processBlock(juce::AudioBuffer<float>&, juce::MidiBuffer&) override;
using AudioProcessor::processBlock;

juce::AudioProcessorEditor *createEditor() override;
juce::AudioProcessorEditor* createEditor() override;
bool hasEditor() const override;

const juce::String getName() const override;
Expand All @@ -30,12 +30,12 @@ class AudioPluginAudioProcessor : public juce::AudioProcessor {
int getCurrentProgram() override;
void setCurrentProgram(int index) override;
const juce::String getProgramName(int index) override;
void changeProgramName(int index, const juce::String &newName) override;
void changeProgramName(int index, const juce::String& newName) override;

void getStateInformation(juce::MemoryBlock &destData) override;
void setStateInformation(const void *data, int sizeInBytes) override;
void getStateInformation(juce::MemoryBlock& destData) override;
void setStateInformation(const void* data, int sizeInBytes) override;

private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AudioPluginAudioProcessor)
};
} // namespace audio_plugin
} // namespace audio_plugin
6 changes: 3 additions & 3 deletions plugin/source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace audio_plugin {
AudioPluginAudioProcessorEditor::AudioPluginAudioProcessorEditor(
AudioPluginAudioProcessor &p)
AudioPluginAudioProcessor& p)
: AudioProcessorEditor(&p), processorRef(p) {
juce::ignoreUnused(processorRef);
// Make sure that before the constructor has finished, you've set the
Expand All @@ -13,7 +13,7 @@ AudioPluginAudioProcessorEditor::AudioPluginAudioProcessorEditor(

AudioPluginAudioProcessorEditor::~AudioPluginAudioProcessorEditor() {}

void AudioPluginAudioProcessorEditor::paint(juce::Graphics &g) {
void AudioPluginAudioProcessorEditor::paint(juce::Graphics& g) {
// (Our component is opaque, so we must completely fill the background with a
// solid colour)
g.fillAll(
Expand All @@ -29,4 +29,4 @@ void AudioPluginAudioProcessorEditor::resized() {
// This is generally where you'll want to lay out the positions of any
// subcomponents in your editor..
}
} // namespace audio_plugin
} // namespace audio_plugin
36 changes: 20 additions & 16 deletions plugin/source/PluginProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@ bool AudioPluginAudioProcessor::isMidiEffect() const {
#endif
}

double AudioPluginAudioProcessor::getTailLengthSeconds() const { return 0.0; }
double AudioPluginAudioProcessor::getTailLengthSeconds() const {
return 0.0;
}

int AudioPluginAudioProcessor::getNumPrograms() {
return 1; // NB: some hosts don't cope very well if you tell them there are 0
// programs, so this should be at least 1, even if you're not really
// implementing programs.
return 1; // NB: some hosts don't cope very well if you tell them there are 0
// programs, so this should be at least 1, even if you're not
// really implementing programs.
}

int AudioPluginAudioProcessor::getCurrentProgram() { return 0; }
int AudioPluginAudioProcessor::getCurrentProgram() {
return 0;
}

void AudioPluginAudioProcessor::setCurrentProgram(int index) {
juce::ignoreUnused(index);
Expand All @@ -64,7 +68,7 @@ const juce::String AudioPluginAudioProcessor::getProgramName(int index) {
}

void AudioPluginAudioProcessor::changeProgramName(int index,
const juce::String &newName) {
const juce::String& newName) {
juce::ignoreUnused(index, newName);
}

Expand All @@ -81,7 +85,7 @@ void AudioPluginAudioProcessor::releaseResources() {
}

bool AudioPluginAudioProcessor::isBusesLayoutSupported(
const BusesLayout &layouts) const {
const BusesLayout& layouts) const {
#if JucePlugin_IsMidiEffect
juce::ignoreUnused(layouts);
return true;
Expand All @@ -104,8 +108,8 @@ bool AudioPluginAudioProcessor::isBusesLayoutSupported(
#endif
}

void AudioPluginAudioProcessor::processBlock(juce::AudioBuffer<float> &buffer,
juce::MidiBuffer &midiMessages) {
void AudioPluginAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer,
juce::MidiBuffer& midiMessages) {
juce::ignoreUnused(midiMessages);

juce::ScopedNoDenormals noDenormals;
Expand All @@ -128,39 +132,39 @@ void AudioPluginAudioProcessor::processBlock(juce::AudioBuffer<float> &buffer,
// Alternatively, you can process the samples with the channels
// interleaved by keeping the same state.
for (int channel = 0; channel < totalNumInputChannels; ++channel) {
auto *channelData = buffer.getWritePointer(channel);
auto* channelData = buffer.getWritePointer(channel);
juce::ignoreUnused(channelData);
// ..do something to the data...
}
}

bool AudioPluginAudioProcessor::hasEditor() const {
return true; // (change this to false if you choose to not supply an editor)
return true; // (change this to false if you choose to not supply an editor)
}

juce::AudioProcessorEditor *AudioPluginAudioProcessor::createEditor() {
juce::AudioProcessorEditor* AudioPluginAudioProcessor::createEditor() {
return new AudioPluginAudioProcessorEditor(*this);
}

void AudioPluginAudioProcessor::getStateInformation(
juce::MemoryBlock &destData) {
juce::MemoryBlock& destData) {
// You should use this method to store your parameters in the memory block.
// You could do that either as raw data, or use the XML or ValueTree classes
// as intermediaries to make it easy to save and load complex data.
juce::ignoreUnused(destData);
}

void AudioPluginAudioProcessor::setStateInformation(const void *data,
void AudioPluginAudioProcessor::setStateInformation(const void* data,
int sizeInBytes) {
// You should use this method to restore your parameters from this memory
// block, whose contents will have been created by the getStateInformation()
// call.
juce::ignoreUnused(data, sizeInBytes);
}
} // namespace audio_plugin
} // namespace audio_plugin

// This creates new instances of the plugin.
// This function definition must be in the global namespace.
juce::AudioProcessor *JUCE_CALLTYPE createPluginFilter() {
juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter() {
return new audio_plugin::AudioPluginAudioProcessor();
}

0 comments on commit ea93229

Please sign in to comment.