Skip to content

Commit

Permalink
WIP start using new paramID function
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseDiazRohena committed Nov 25, 2023
1 parent e89641b commit d4b4684
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/PluginProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ juce::AudioProcessorValueTreeState::ParameterLayout
auto stringFromValue = detail::makeStringFromValueFunction (paramType);

params.push_back (std::make_unique<juce::AudioParameterFloat> (
juce::ParameterID {FFCompParameterID()[i], ValentineParameterVersion},
juce::ParameterID {valentine::parameterID (i), ValentineParameterVersion},
FFCompParameterLabel()[i],
rangeToUse,
FFCompParameterDefaults[i],
Expand Down Expand Up @@ -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<int> (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);
Expand Down
7 changes: 6 additions & 1 deletion src/ValentineParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

constexpr int ValentineParameterVersion = 1;

enum class VParameter {
enum VParameter {
bitCrush = 0,
crushEnable,
inputGain,
Expand Down Expand Up @@ -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<size_t> (parameter));
}
} // namespace valentine
} // namespace tote_bag

Expand Down

0 comments on commit d4b4684

Please sign in to comment.