Skip to content

Commit

Permalink
more minor cleanup, before try move lock from shape to channel
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcBoule committed Oct 15, 2023
1 parent 5b085be commit 37e62de
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 43 deletions.
12 changes: 5 additions & 7 deletions src/ShapeMaster/Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,8 @@


Channel::Channel(int _chanNum, bool* _running, uint32_t* _sosEosEoc, ClockDetector* _clockDetector, Input* _inputs, Output* _outputs, Param* _params, ParamQuantity* pqReps, PresetAndShapeManager* _presetAndShapeManager) {
// channelSettings.cc1 = 0;
// channelSettings2.cc1 = 0;
// channelSettings3.cc1 = 0;
// channelSettings4.cc1 = 0;

chanNum = _chanNum;
running = _running;
hpFilter.setParameters(true, 0.1f);
lpFilter.setParameters(false, 0.4f);
if (_inputs) {
inInput = &_inputs[IN_INPUTS + chanNum];
scInput = &_inputs[SIDECHAIN_INPUT];
Expand All @@ -29,6 +22,9 @@ Channel::Channel(int _chanNum, bool* _running, uint32_t* _sosEosEoc, ClockDetect
outOutput = &_outputs[OUT_OUTPUTS + chanNum];
cvOutput = &_outputs[CV_OUTPUTS + chanNum];
}
hpFilter.setParameters(true, 0.1f);
lpFilter.setParameters(false, 0.4f);

paPhase = &_params[PHASE_PARAM + chanNum * NUM_CHAN_PARAMS];
paResponse = &_params[RESPONSE_PARAM + chanNum * NUM_CHAN_PARAMS];
paWarp = &_params[WARP_PARAM + chanNum * NUM_CHAN_PARAMS];
Expand Down Expand Up @@ -59,6 +55,7 @@ void Channel::onReset(bool withParams) {
paHigh->setValue(DEFAULT_HIGH);
paLow->setValue(DEFAULT_LOW);
}
slewLimiter.reset();
setHPFCutoffSqFreq(SC_HPF_SQFREQ_DEF);
setLPFCutoffSqFreq(SC_LPF_SQFREQ_DEF);
sensitivity = DEFAULT_SENSITIVITY;
Expand Down Expand Up @@ -119,6 +116,7 @@ void Channel::resetNonJson() {
warpPhaseResponseAmountCvConnected = false;
xoverSlewWithCv = simd::float_4(paCrossover->getValue(), paHigh->getValue(), paLow->getValue(), paSlew->getValue());
xoverSlewCvConnected = false;
nodeTrigPulseGen.reset();
setCrossoverCutoffFreq();
}

Expand Down
70 changes: 35 additions & 35 deletions src/ShapeMaster/Channel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,25 @@ class Channel {
// none

// need to save, with reset
Param* paPhase = nullptr;
Param* paResponse = nullptr;
Param* paWarp = nullptr;
Param* paAmount = nullptr;
Param* paSlew = nullptr;
Param* paSmooth = nullptr;
Param* paCrossover = nullptr;
Param* paHigh = nullptr;
Param* paLow = nullptr;
Param* paPrevNextPreSha = nullptr;
Param* paPhase;
Param* paResponse;
Param* paWarp;
Param* paAmount;
Param* paSlew;
Param* paSmooth;
Param* paCrossover;
Param* paHigh;
Param* paLow;
Param* paPrevNextPreSha;
SlewLimiterSingle slewLimiter;
float hpfCutoffSqFreq = 0.0f;// always use getter and setter since tied to Biquad
float lpfCutoffSqFreq = 0.0f;// always use getter and setter since tied to Biquad
float sensitivity = 0.0f;
float gainAdjustVca = 0.0f;// this is a gain here (not dB)
float gainAdjustSc = 0.0f;// this is a gain here (not dB)
float nodeTrigDuration = 0.0f;
uint8_t gridX = 0;
int8_t rangeIndex = 0;
float hpfCutoffSqFreq;// always use getter and setter since tied to Biquad
float lpfCutoffSqFreq;// always use getter and setter since tied to Biquad
float sensitivity;
float gainAdjustVca;// this is a gain here (not dB)
float gainAdjustSc;// this is a gain here (not dB)
float nodeTrigDuration;
uint8_t gridX;
int8_t rangeIndex;
public:
PackedBytes4 channelSettings;
PackedBytes4 channelSettings2;
Expand All @@ -110,35 +110,35 @@ class Channel {


// no need to save, with reset
double sampleTime = 0.0f;
double sampleTime;
LinkwitzRileyStereo8xCrossover xover;
float lastCrossoverParamWithCv = 0.0f;
float lastCrossoverParamWithCv;
ButterworthFourthOrder hpFilter;
ButterworthFourthOrder lpFilter;
FirstOrderFilter smoothFilter;
float lastSmoothParam = 0.0f;
double lastProcessXt = 0.0;
bool channelActive = false;
int vcaPreSize = 0;
int vcaPostSize = 0;
float scSignal = 0.0f;// implicitly mono
float scEnvelope = 0.0f;// implicitly mono
float lastSmoothParam;
double lastProcessXt;
bool channelActive;
int vcaPreSize;
int vcaPostSize;
float scSignal;// implicitly mono
float scEnvelope;// implicitly mono
dsp::SlewLimiter scEnvSlewer;
public:
simd::float_4 warpPhaseResponseAmountWithCv;// warp = [0]
bool warpPhaseResponseAmountCvConnected = false;
bool warpPhaseResponseAmountCvConnected;
simd::float_4 xoverSlewWithCv;// xfreq = [0], xhigh = [1], xlow = [2], slew = [3] (slew unrelated to xvoer)
bool xoverSlewCvConnected = false;
bool xoverSlewCvConnected;
private:
dsp::PulseGenerator nodeTrigPulseGen;

// no need to save, no reset
int chanNum = 0;
bool* running = nullptr;
Input* inInput = nullptr;// use only in process() because of channelDirtyCache and possible nullness
Input* scInput = nullptr;// use only in process() because of channelDirtyCache and possible nullness
Output* outOutput = nullptr;// use only in process() because of channelDirtyCache and possible nullness
Output* cvOutput = nullptr;// use only in process() because of channelDirtyCache and possible nullness
int chanNum;
bool* running;
Input* inInput;// use only in process() because of channelDirtyCache and possible nullness
Input* scInput;// use only in process() because of channelDirtyCache and possible nullness
Output* outOutput;// use only in process() because of channelDirtyCache and possible nullness
Output* cvOutput;// use only in process() because of channelDirtyCache and possible nullness
float lengthUnsyncOld = -10.0f;// don't need init nor reset for this, used in caching detection with param that is [-1.0f : 1.0f], used with next line
std::string lengthUnsyncTextOld;// used with previous line
float vcaPre[16] = {};
Expand Down
2 changes: 1 addition & 1 deletion src/ShapeMaster/Shape.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Shape {
~Shape() {
delete lock_shape;
}

void onReset();

void initMinPts();
Expand Down

0 comments on commit 37e62de

Please sign in to comment.