Skip to content

Commit

Permalink
refactored code, added licence header
Browse files Browse the repository at this point in the history
  • Loading branch information
vitonol committed Jan 2, 2024
1 parent abbc87b commit e753f21
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 68 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FetchContent_MakeAvailable(JUCE)
juce_add_plugin(
ReverbProject
PLUGIN_MANUFACTURER_CODE VTNL
FORMATS VST3 Standalone
FORMATS VST3 Standalone AU
COMPANY_NAME "vitonol"
PRODUCT_NAME "ReverbProject"
VERSION "1.0.0"
Expand Down
55 changes: 35 additions & 20 deletions source/PluginProcessor.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
/*
==============================================================================
This file contains the basic framework code for a JUCE plugin processor.
Copyright 2023, 2024 Vitalii Voronkin
Reverb Project is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Reverb Project is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Simple Reverb. If not, see <http://www.gnu.org/licenses/>.
==============================================================================
*/
Expand All @@ -18,6 +31,7 @@ namespace ParamIDs
inline constexpr auto mix{"mix"};
inline constexpr auto freeze{"freeze"};
inline constexpr auto diffFeedbck{"diffFeedbck"};
// inline constexpr auto color{"color"};

}

Expand Down Expand Up @@ -72,7 +86,7 @@ static juce::AudioProcessorValueTreeState::ParameterLayout createParamLayout()

layout.add(std::make_unique<juce::AudioParameterFloat>(juce::ParameterID{ParamIDs::diffFeedbck, 1},
ParamIDs::diffFeedbck,
juce::NormalisableRange<float>{0.0f, 100.0f, 0.01f, 1.0f},
juce::NormalisableRange<float>{20.0f, 80.0f, 0.01f, 1.0f},
50.0f,
juce::String(),
juce::AudioProcessorParameter::genericParameter,
Expand All @@ -83,20 +97,16 @@ static juce::AudioProcessorValueTreeState::ParameterLayout createParamLayout()
ParamIDs::freeze,
false));

juce::StringArray stringArray;
juce::String str;
// for (int i = 0; i < 3; i++)
// {
// str << (1 + i);
// // str << " some Kind Of Value";
// stringArray.add(str);
// }
// Choice parameter. Could be used for sound "color" selection.
// juce::StringArray stringArray;
// juce::String str;

stringArray.add(" juce::dsp::Reverb ");
stringArray.add(" juce::Reverb ");
// stringArray.add(" 3 ");
// stringArray.add(" dark ");
// stringArray.add(" bright ");
// stringArray.add(" 70ies ");
// stringArray.add(" 80ies ");

layout.add(std::make_unique<juce::AudioParameterChoice>("Reverb Version", "Reverb Version", stringArray, 0));
// layout.add(std::make_unique<juce::AudioParameterChoice>("color", "color", stringArray, 0));

return layout;
}
Expand Down Expand Up @@ -134,6 +144,14 @@ ReverbProjectAudioProcessor::ReverbProjectAudioProcessor()
};

storeBoolParam(freeze, ParamIDs::freeze);

// auto storeChoiceParam = [&apvts = this->apvts](auto &param, const auto &paramID)
// {
// param = dynamic_cast<juce::AudioParameterChoice *>(apvts.getParameter(paramID));
// jassert(param != nullptr);
// };

// storeChoiceParam(color, ParamIDs::color);
}

ReverbProjectAudioProcessor::~ReverbProjectAudioProcessor()
Expand Down Expand Up @@ -220,8 +238,6 @@ void ReverbProjectAudioProcessor::prepareToPlay(double sampleRate, int samplesPe
#elif !MYVERS
r2.setSampleRate(specs.sampleRate);
#endif

// r1.prepare(specs);
}

void ReverbProjectAudioProcessor::releaseResources()
Expand Down Expand Up @@ -267,11 +283,12 @@ void ReverbProjectAudioProcessor::updateReverbParams()
#if MYVERS
params.diffusionFeedback = diffFeedbck->get() * 0.01f;
r3.setParameters(params);

// params.color = color;

#elif !MYVERS
r2.setParameters(params);
#endif

// r1.setParameters(params);
}

// Settings getSettings(juce::AudioProcessorValueTreeState &vts)
Expand All @@ -297,8 +314,6 @@ void ReverbProjectAudioProcessor::processBlock(juce::AudioBuffer<float> &buffer,
juce::dsp::AudioBlock<float> block(buffer);
juce::dsp::ProcessContextReplacing<float> ctx(block);

// r1.process(ctx);

const auto &inputBlock = ctx.getInputBlock();
auto &outputBlock = ctx.getOutputBlock();
const auto numInChannels = inputBlock.getNumChannels();
Expand Down
30 changes: 20 additions & 10 deletions source/PluginProcessor.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
/*
==============================================================================
This file contains the basic framework code for a JUCE plugin processor.
Copyright 2023, 2024 Vitalii Voronkin
Reverb Project is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Reverb Project is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Simple Reverb. If not, see <http://www.gnu.org/licenses/>.
==============================================================================
*/

#pragma once

#include <JuceHeader.h>
#include "ReverbFX.h"

// @TODO remove JuceHeader and only add classes that you will need:
// #include <juce_audio_processors/juce_audio_processors.h>
// #include <juce_dsp/juce_dsp.h>
// #include <juce_audio_basics/juce_audio_basics.h>
// #include <juce_gui_basics/juce_gui_basics.h>

#include "ReverbFX.h"

#define MYVERS 1
#define MYVERS 1 // toggles between juce::reverb and my modified version, for comparasing

//==============================================================================
/**
Expand Down Expand Up @@ -68,8 +82,9 @@ class ReverbProjectAudioProcessor : public juce::AudioProcessor
juce::AudioParameterFloat *damp{nullptr};
juce::AudioParameterFloat *width{nullptr};
juce::AudioParameterFloat *mix{nullptr};
juce::AudioParameterFloat *diffFeedbck{nullptr};
juce::AudioParameterBool *freeze{nullptr};
juce::AudioParameterFloat *diffFeedbck{nullptr};
// juce::AudioParameterChoice *color{nullptr};

void updateReverbParams();

Expand All @@ -83,12 +98,7 @@ class ReverbProjectAudioProcessor : public juce::AudioProcessor
juce::Reverb r2;
#endif

// juce::dsp::Reverb r1;

juce::UndoManager undoManager;

// HeapBlock<float> buffer;
// std::vector<float> dnBuffer;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ReverbProjectAudioProcessor)
};
Loading

0 comments on commit e753f21

Please sign in to comment.