From d4b4684b28315cfde1e2554f96017184a3d63f3d Mon Sep 17 00:00:00 2001 From: Jose Diaz Rohena Date: Sat, 25 Nov 2023 18:14:02 +0100 Subject: [PATCH] WIP start using new paramID function --- src/PluginProcessor.cpp | 8 +++++--- src/ValentineParameters.h | 7 ++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/PluginProcessor.cpp b/src/PluginProcessor.cpp index 130b2100..8d45c887 100644 --- a/src/PluginProcessor.cpp +++ b/src/PluginProcessor.cpp @@ -155,7 +155,7 @@ juce::AudioProcessorValueTreeState::ParameterLayout auto stringFromValue = detail::makeStringFromValueFunction (paramType); params.push_back (std::make_unique ( - juce::ParameterID {FFCompParameterID()[i], ValentineParameterVersion}, + juce::ParameterID {valentine::parameterID (i), ValentineParameterVersion}, FFCompParameterLabel()[i], rangeToUse, FFCompParameterDefaults[i], @@ -235,14 +235,16 @@ void ValentineAudioProcessor::changeProgramName (int, const juce::String&) //============================================================================== void ValentineAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock) { + using namespace tote_bag; + const auto oversampleMultiplier = static_cast (pow (2, detail::kOversampleFactor)); processBuffer.setSize (2, samplesPerBlock); processBuffer.clear(); - ffCompressor->setAttack (*treeState.getRawParameterValue ( - FFCompParameterID()[getParameterIndex (VParameter::attack)])); + ffCompressor->setAttack ( + *treeState.getRawParameterValue (valentine::parameterID (VParameter::attack))); ffCompressor->setRelease (*treeState.getRawParameterValue ( FFCompParameterID()[getParameterIndex (VParameter::release)])); ffCompressor->setSampleRate (sampleRate * oversampleMultiplier); diff --git a/src/ValentineParameters.h b/src/ValentineParameters.h index c9c5a652..331cee2b 100644 --- a/src/ValentineParameters.h +++ b/src/ValentineParameters.h @@ -16,7 +16,7 @@ constexpr int ValentineParameterVersion = 1; -enum class VParameter { +enum VParameter { bitCrush = 0, crushEnable, inputGain, @@ -112,6 +112,11 @@ inline const juce::String& parameterID (const size_t index) return parameterIDs[index]; } + +inline const juce::String& parameterID (const VParameter parameter) +{ + return parameterID (static_cast (parameter)); +} } // namespace valentine } // namespace tote_bag