Skip to content

Commit

Permalink
Refactor parameterID getting
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseDiazRohena committed Nov 25, 2023
1 parent 699f3f2 commit e89641b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/PluginProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ ValentineAudioProcessor::~ValentineAudioProcessor()
juce::AudioProcessorValueTreeState::ParameterLayout
ValentineAudioProcessor::createParameterLayout()
{
using namespace tote_bag;

std::vector<std::unique_ptr<juce::RangedAudioParameter>> params;

for (size_t i = 0; i < numParams; ++i)
Expand All @@ -138,7 +140,7 @@ juce::AudioProcessorValueTreeState::ParameterLayout
const bool defaultValue = FFCompParameterDefaults[i] > 0.5f;

params.push_back (std::make_unique<juce::AudioParameterBool> (
juce::ParameterID {FFCompParameterID()[i], ValentineParameterVersion},
juce::ParameterID {valentine::parameterID (i), ValentineParameterVersion},
FFCompParameterLabel()[i],
defaultValue));
}
Expand Down
26 changes: 26 additions & 0 deletions src/ValentineParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,32 @@ inline constexpr std::array<float, kNumRatioControlPoints> kThresholdControlPoin

static constexpr auto numParams = static_cast<int> (VParameter::TOTAL_NUM_PARAMETERS);

namespace tote_bag
{
namespace valentine
{
inline const juce::String& parameterID (const size_t index)
{
static const std::array<juce::String, numParams> parameterIDs = {
"Crush",
"CrushEnable",
"Compress",
"Saturate",
"SaturateEnable",
"Ratio",
"AttackTime",
"ReleaseTime",
"Makeup",
"Mix",
"Bypass",
"OutputClipEnable",
};

return parameterIDs[index];
}
} // namespace valentine
} // namespace tote_bag

inline const std::array<juce::String, numParams>& FFCompParameterID()
{
static const std::array<juce::String, numParams> parameterIDs = {
Expand Down

0 comments on commit e89641b

Please sign in to comment.