Skip to content

Commit

Permalink
use enum values
Browse files Browse the repository at this point in the history
  • Loading branch information
vberthiaume committed Jul 9, 2024
1 parent e444df1 commit 5aa09b4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions source/DSP/GainedOscillator.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class GainedOscillator
osc.setFrequency (newValue, force);
}

void setOscShape (int newShape) { nextOsc.store (newShape); }
void setOscShape (OscShape::Values newShape) { nextOsc.store (newShape); }

/**
* @brief Sets the gain for the oscillator in the processorChain.
Expand Down Expand Up @@ -83,8 +83,7 @@ class GainedOscillator
gainIndex
};

//TODO: these need to be enums, I need to use proper enums instead of ints
std::atomic<int> currentOsc { OscShape::none }, nextOsc { { OscShape::saw } };
std::atomic<OscShape::Values> currentOsc { OscShape::none }, nextOsc { { OscShape::saw } };

void updateOscillators();

Expand Down
8 changes: 4 additions & 4 deletions source/DSP/PhatOscillators.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class PhatOscillators : public juce::AudioProcessorValueTreeState::Listener
}

void setOscFreq (OscId oscNum, int newMidiNote);
void setOscShape (OscId oscNum, int newShape);
void setOscShape (OscId oscNum, OscShape::Values newShape);
void setOscTuning (OscId oscNum, float newTuning);

void setOscSub (float newSub)
Expand Down Expand Up @@ -203,9 +203,9 @@ void PhatOscillators<T>::parameterChanged (const juce::String& parameterID, floa
else if (parameterID == osc2TuningID.getParamID ())
setOscTuning (OscId::osc2Index, newValue);
else if (parameterID == osc1ShapeID.getParamID ())
setOscShape (OscId::osc1Index, (int) newValue);
setOscShape (OscId::osc1Index, static_cast<OscShape::Values> (newValue));
else if (parameterID == osc2ShapeID.getParamID ())
setOscShape (OscId::osc2Index, (int) newValue);
setOscShape (OscId::osc2Index, static_cast<OscShape::Values> (newValue));
else if (parameterID == oscSubID.getParamID ())
setOscSub (newValue);
else if (parameterID == oscMixID.getParamID ())
Expand Down Expand Up @@ -318,7 +318,7 @@ void PhatOscillators<T>::setOscFreq (OscId oscNum, int newMidiNote)
}

template <std::floating_point T>
void PhatOscillators<T>::setOscShape (OscId oscNum, int newShape)
void PhatOscillators<T>::setOscShape (OscId oscNum, OscShape::Values newShape)
{
switch (oscNum)
{
Expand Down
2 changes: 1 addition & 1 deletion source/Utility/Helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ struct Selection

struct OscShape : public Selection
{
enum
enum Values
{
none = 0,
saw,
Expand Down

0 comments on commit 5aa09b4

Please sign in to comment.