commit ea3a6263c909268a146fc1e86485480b8f216637
parent 542b708ac7f7b5a6d14482a9067a45fb8ffa9250
Author: Johannes Lorenz <j.git@lorenz-ho.me>
Date: Sun, 9 Mar 2025 15:36:27 +0100
Chorus/Reverse: Put enums into class
Diffstat:
3 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/src/DSP/Reverter.h b/src/DSP/Reverter.h
@@ -21,11 +21,6 @@ namespace zyn {
AUTO,\
HOST
-enum SyncMode
-{
- SYNCMODES
-};
-
// State Machine for the modes NOTEON and NOTEONOFF
// Sync-Event leads to a cycle of RECORDING->PLAYING->IDLE
//
@@ -37,11 +32,6 @@ enum SyncMode
PLAYING,\
IDLE
-enum State
-{
- STATES
-};
-
/**
* @brief Reverse Delay effect class
*
@@ -51,6 +41,16 @@ enum State
class Reverter
{
public:
+ enum SyncMode
+ {
+ SYNCMODES
+ };
+
+ enum State
+ {
+ STATES
+ };
+
/**
* @brief Constructor for the Reverter class.
*
diff --git a/src/Effects/Chorus.h b/src/Effects/Chorus.h
@@ -37,14 +37,14 @@ namespace zyn {
TRIPLE,\
DUAL
-enum {
- CHORUS_MODES
-};
-
/**Chorus and Flange effects*/
class Chorus final:public Effect
{
public:
+ enum ChorusModes {
+ CHORUS_MODES
+ };
+
Chorus(EffectParams pars);
/**Destructor*/
~Chorus();
diff --git a/src/Effects/Reverse.cpp b/src/Effects/Reverse.cpp
@@ -63,7 +63,8 @@ rtosc::Ports Reverse::ports = {
#undef rObject
Reverse::Reverse(EffectParams pars, const AbsTime *time_)
- :Effect(pars),Pvolume(insertion?64:32),Pdelay(25),Pphase(64), Pcrossfade(32), PsyncMode(NOTEON), Pstereo(0),time(time_), tick_hist(0)
+ :Effect(pars),Pvolume(insertion?64:32),Pdelay(25),Pphase(64), Pcrossfade(32),
+ PsyncMode(Reverter::SyncMode::NOTEON), Pstereo(0),time(time_), tick_hist(0)
{
float tRef = float(time->time());
reverterL = memory.alloc<Reverter>(&memory, float(Pdelay+1)/128.0f*MAX_REV_DELAY_SECONDS, samplerate, buffersize, tRef, time);
@@ -102,7 +103,7 @@ void Reverse::out(const Stereo<float *> &input)
// process external timecode for syncing to host beat
// but only if we have timing info, speedfactor is set and we are in host mode.
- if (time->tempo && speedfactor && (PsyncMode == HOST)) {
+ if (time->tempo && speedfactor && (PsyncMode == Reverter::SyncMode::HOST)) {
// in host mode we want to find out if (condition) and when (position) a beat happens inside the buffer
// and call sync at that position
// condition: at the end of the buffer: ticks % ticks_per_beat < ticks_per buffer
@@ -179,8 +180,9 @@ void Reverse::out(const Stereo<float *> &input)
void Reverse::update()
{
+ using SyncMode = Reverter::SyncMode;
// process noteon trigger
- if( (PsyncMode == NOTEON || PsyncMode == NOTEONOFF) ) {
+ if( (PsyncMode == SyncMode::NOTEON || PsyncMode == SyncMode::NOTEONOFF) ) {
reverterL->sync(0.0f);
if(Pstereo) reverterR->sync(0.0f);
}
@@ -228,6 +230,7 @@ void Reverse::setcrossfade(unsigned char value)
void Reverse::setsyncMode(unsigned char value)
{
PsyncMode = value;
+ using SyncMode = Reverter::SyncMode;
reverterL->setsyncMode((SyncMode)value);
reverterR->setsyncMode((SyncMode)value);
}
@@ -238,11 +241,11 @@ unsigned char Reverse::getpresetpar(unsigned char npreset, unsigned int npar)
#define NUM_PRESETS 3
static const unsigned char presets[NUM_PRESETS][PRESET_SIZE] = {
//NOTEON
- {64, 64, 25, 0, 64, 32, NOTEON},
+ {64, 64, 25, 0, 64, 32, Reverter::NOTEON},
//NOTEONOFF
- {64, 64, 25, 0, 64, 16, NOTEONOFF},
+ {64, 64, 25, 0, 64, 16, Reverter::NOTEONOFF},
//AUTO
- {64, 64, 25, 0, 64, 50, AUTO}
+ {64, 64, 25, 0, 64, 50, Reverter::AUTO}
};
if(npreset < NUM_PRESETS && npar < PRESET_SIZE) {
if (npar == 0 && insertion == 0) {