From a0c20971955b053131e0c4f3e607a95f44c4ba5a Mon Sep 17 00:00:00 2001 From: MarcBoule Date: Sat, 14 Oct 2023 14:18:44 -0400 Subject: [PATCH] more small clean and refactor PM and EQ --- src/EqMaster/EqMaster.cpp | 40 ++++++++++------- src/EqMaster/EqMasterCommon.hpp | 73 +++++++++++++++---------------- src/EqMaster/EqMenus.hpp | 2 +- src/MindMeldModular.hpp | 6 +-- src/PatchSet/MasterChannel.cpp | 58 +++++++++++++----------- src/PatchSet/PatchMaster.cpp | 4 +- src/PatchSet/PatchMasterBlank.cpp | 12 ++--- src/ShapeMaster/ShapeMaster.hpp | 2 +- 8 files changed, 104 insertions(+), 93 deletions(-) diff --git a/src/EqMaster/EqMaster.cpp b/src/EqMaster/EqMaster.cpp index 1e5e57f..ac02540 100644 --- a/src/EqMaster/EqMaster.cpp +++ b/src/EqMaster/EqMaster.cpp @@ -33,7 +33,7 @@ struct EqMaster : Module { MfeExpInterface expMessages[2];// messages from eq-expander, see enum in EqCommon.hpp // Constants - int numChannels16 = 16;// avoids warning that happens when hardcode 16 (static const or directly use 16 in code below) + const int numChannels16 = 16;// avoids warning that happens when hardcode 16 (static const or directly use 16 in code below) int8_t cloakedMode = 0x0; // Need to save, no reset @@ -44,7 +44,7 @@ struct EqMaster : Module { char trackLabels[24 * 4 + 1];// needs to be saved in case we are detached int8_t trackLabelColors[24]; int8_t trackVuColors[24]; - TrackEq trackEqs[24]; + std::vector trackEqs;// size 24 PackedBytes4 miscSettings;// cc4[0] is ShowBandCurvesEQ, cc4[1] is fft type (0 = off, 1 = pre, 2 = post, 3 = freeze), cc4[2] is momentaryCvButtons (1 = yes (original rising edge only version), 0 = level sensitive (emulated with rising and falling detection)), cc4[3] is detailsShow PackedBytes4 miscSettings2;// cc4[0] is band label colours, cc4[1] is decay rate (0 = slow, 1 = med, 2 = fast), cc[2] is hide eq curves when bypassed, cc[3] is unused PackedBytes4 showFreqAsNotes; @@ -150,7 +150,11 @@ struct EqMaster : Module { configBypass(SIG_INPUTS + i, SIG_OUTPUTS + i); } - onReset(); + trackEqs.reserve(24); + float sr = APP->engine->getSampleRate(); + for (int t = 0; t < 24; t++) { + trackEqs.push_back(TrackEq(t, sr, &cvConnected)); + } ffts = pffft_new_setup(FFT_N, PFFFT_REAL); fftIn[0] = static_cast(pffft_aligned_malloc(FFT_N * 4)); @@ -164,6 +168,8 @@ struct EqMaster : Module { drawBufLin[i] = 0.0f; } windowFunc = allocateAndCalcWindowFunc(); + + onReset(); } ~EqMaster() { @@ -185,15 +191,15 @@ struct EqMaster : Module { void onReset() override final { mappedId = 0; - initTrackLabelsAndColors(); + initTrackLabelsAndColors();// trackLabels[], trackLabelColors[], trackVuColors[] for (int t = 0; t < 24; t++) { - trackEqs[t].init(t, APP->engine->getSampleRate(), &cvConnected); + trackEqs[t].onReset(); } miscSettings.cc4[0] = 0x1;// show band curves by default miscSettings.cc4[1] = SPEC_MASK_ON | SPEC_MASK_POST; miscSettings.cc4[2] = 0x1; // momentary by default miscSettings.cc4[3] = 0x7; // detailsShow - miscSettings2.cc4[0] = 0;// band label colours + miscSettings2.cc4[0] = 0;// band label colors miscSettings2.cc4[1] = 2;// decay rate fast miscSettings2.cc4[2] = 0;// hide eq curves when bypassed miscSettings2.cc4[3] = 0;// unused @@ -900,7 +906,7 @@ struct EqMasterWidget : ModuleWidget { trackLabel->mappedId = &(module->mappedId); trackLabel->trackLabelsSrc = module->trackLabels; trackLabel->trackParamSrc = &(module->params[TRACK_PARAM]); - trackLabel->trackEqsSrc = module->trackEqs; + trackLabel->trackEqsSrc = &(module->trackEqs[0]); trackLabel->updateTrackLabelRequestSrc = &(module->updateTrackLabelRequest); } // Track knob @@ -908,7 +914,7 @@ struct EqMasterWidget : ModuleWidget { addParam(trackKnob = createParamCentered(mm2px(Vec(leftX, 22.7f)), module, TRACK_PARAM)); if (module) { trackKnob->updateTrackLabelRequestSrc = &(module->updateTrackLabelRequest); - trackKnob->trackEqsSrc = module->trackEqs; + trackKnob->trackEqsSrc = &(module->trackEqs[0]); trackKnob->polyInputs = &(module->inputs[EqMaster::SIG_INPUTS]); } // Active switch @@ -916,7 +922,7 @@ struct EqMasterWidget : ModuleWidget { addParam(activeSwitch = createParamCentered(mm2px(Vec(leftX, 48.775f)), module, TRACK_ACTIVE_PARAM)); if (module) { activeSwitch->trackParamSrc = &(module->params[TRACK_PARAM]); - activeSwitch->trackEqsSrc = module->trackEqs; + activeSwitch->trackEqsSrc = &(module->trackEqs[0]); } // Global bypass switch addParam(createParamCentered(mm2px(Vec(leftX, 67.7f)), module, GLOBAL_BYPASS_PARAM)); @@ -943,7 +949,7 @@ struct EqMasterWidget : ModuleWidget { addChild(eqCurveAndGrid = createWidgetCentered(mm2px(Vec(71.12f, 45.47f - 0.5f)))); if (module) { eqCurveAndGrid->trackParamSrc = &(module->params[TRACK_PARAM]); - eqCurveAndGrid->trackEqsSrc = module->trackEqs; + eqCurveAndGrid->trackEqsSrc = &(module->trackEqs[0]); eqCurveAndGrid->miscSettingsSrc = &(module->miscSettings); eqCurveAndGrid->miscSettings2Src = &(module->miscSettings2); eqCurveAndGrid->globalBypassParamSrc = &(module->params[GLOBAL_BYPASS_PARAM]); @@ -960,7 +966,7 @@ struct EqMasterWidget : ModuleWidget { addChild(bigNumbersEq = createWidgetCentered(mm2px(Vec(71.12f, 68.0f)))); if (module) { bigNumbersEq->trackParamSrc = &(module->params[TRACK_PARAM]); - bigNumbersEq->trackEqsSrc = module->trackEqs; + bigNumbersEq->trackEqsSrc = &(module->trackEqs[0]); bigNumbersEq->lastMovedKnobIdSrc = &lastMovedKnobId; bigNumbersEq->lastMovedKnobTimeSrc = &lastMovedKnobTime; } @@ -983,7 +989,7 @@ struct EqMasterWidget : ModuleWidget { if (module) { for (int b = 0; b < 4; b++) { peakShelfSwitches[b]->trackParamSrc = &(module->params[TRACK_PARAM]); - peakShelfSwitches[b]->trackEqsSrc = module->trackEqs; + peakShelfSwitches[b]->trackEqsSrc = &(module->trackEqs[0]); peakShelfSwitches[b]->isLF = (b < 2); } } @@ -998,7 +1004,7 @@ struct EqMasterWidget : ModuleWidget { for (int b = 0; b < 4; b++) { bandSwitches[b]->trackParamSrc = &(module->params[TRACK_PARAM]); bandSwitches[b]->freqActiveParamsSrc = &(module->params[FREQ_ACTIVE_PARAMS]); - bandSwitches[b]->trackEqsSrc = module->trackEqs; + bandSwitches[b]->trackEqsSrc = &(module->trackEqs[0]); } } @@ -1032,7 +1038,7 @@ struct EqMasterWidget : ModuleWidget { bandKnobs[c]->cloakedModeSrc = &cloakedMode; bandKnobs[c]->detailsShowSrc = &(module->miscSettings.cc4[3]); bandKnobs[c]->trackParamSrc = &(module->params[TRACK_PARAM]); - bandKnobs[c]->trackEqsSrc = module->trackEqs; + bandKnobs[c]->trackEqsSrc = &(module->trackEqs[0]); bandKnobs[c]->lastMovedKnobIdSrc = & lastMovedKnobId; bandKnobs[c]->lastMovedKnobTimeSrc = &lastMovedKnobTime; } @@ -1049,7 +1055,7 @@ struct EqMasterWidget : ModuleWidget { for (int i = 0; i < 12; i++) { bandLabels[i]->bandLabelColorsSrc = &(module->miscSettings2.cc4[0]); bandLabels[i]->trackParamSrc = &(module->params[TRACK_PARAM]); - bandLabels[i]->trackEqsSrc = module->trackEqs; + bandLabels[i]->trackEqsSrc = &(module->trackEqs[0]); bandLabels[i]->band = (i % 4); } for (int i = 0; i < 4; i++) { @@ -1075,7 +1081,7 @@ struct EqMasterWidget : ModuleWidget { addParam(trackGainKnob = createParamCentered(mm2px(Vec(rightX, 67.0f)), module, TRACK_GAIN_PARAM)); if (module) { trackGainKnob->trackParamSrc = &(module->params[TRACK_PARAM]); - trackGainKnob->trackEqsSrc = module->trackEqs; + trackGainKnob->trackEqsSrc = &(module->trackEqs[0]); trackGainKnob->detailsShowSrc = &(module->miscSettings.cc4[3]); trackGainKnob->cloakedModeSrc = &(module->cloakedMode); } @@ -1179,7 +1185,7 @@ struct EqMasterWidget : ModuleWidget { if (message.tm.tmSep[0] != 0 && message.tm.tmTot != module->lastTrackMove) { // has valid and fresh move module->lastTrackMove = message.tm.tmTot;// avoids doing the move again until a new fresh move is detected - moveTrack(module->trackEqs, message.tm.tmSep[1], message.tm.tmSep[2]); + moveTrack(&(module->trackEqs[0]), message.tm.tmSep[1], message.tm.tmSep[2]); // DEBUG("Track move from %i to %i", message.tm.tmSep[1], message.tm.tmSep[2]); } diff --git a/src/EqMaster/EqMasterCommon.hpp b/src/EqMaster/EqMasterCommon.hpp index c887809..1347cd4 100644 --- a/src/EqMaster/EqMasterCommon.hpp +++ b/src/EqMaster/EqMasterCommon.hpp @@ -15,7 +15,7 @@ struct MfeExpInterface {// for messages to mother from expander int trackCvsIndex6 = 0; int trackEnableIndex = 0; int trackCvsConnected = 0;// only 4 lsbits used - float trackCvs[16 * 4] = {0.0f};// room for 4 poly cables + float trackCvs[16 * 4] = {};// room for 4 poly cables float trackEnable = 0.0f;// one of the 24+1 enable cvs }; @@ -71,17 +71,17 @@ static const NVGcolor SCHEME_GRAY = nvgRGB(130, 130, 130); class TrackEq { static constexpr float antipopSlewLogHz = 8.0f;// calibrated to properly slew a log(Hz) float in the rough range 1.3f to 4.3f (but less since freq knobs not full spectrum) static constexpr float antipopSlewDb = 200.0f;// calibrated to properly slew a dB float in the range -20.0f to 20.0f for antipop - int trackNum = 0; - float sampleRate = 0.0f; - float sampleTime = 0.0f; - uint32_t *cvConnected = nullptr; + int trackNum; + float sampleRate; + float sampleTime; + uint32_t *cvConnected; // automatically managed internally by member functions int dirty;// 4 bits, one for each band (automatically managed by member methods, no need to handle in init() and copyFrom()) - QuattroBiQuad::Type bandTypes[4]; // only [0] and [3] are dependants, [1] and [2] are set to their permanent values in init() + QuattroBiQuad::Type bandTypes[4]; // only [0] and [3] are dependents, [1] and [2] are set to their permanent values in init() // need saving - bool trackActive = false; + bool trackActive; simd::float_4 bandActive;// 0.0f or 1.0f values: frequency band's eq is active, one for LF, LMF, HMF, HF simd::float_4 freq;// in log(Hz) to match params, converted to scaled linear freq before pushing params to eq simd::float_4 gain;// in dB to match params, is converted to linear before pushing params to eqs @@ -101,7 +101,7 @@ class TrackEq { simd::float_4 gainCv;// adding-type cvs simd::float_4 qCv;// adding-type cvs - // dependants + // dependents QuattroBiQuad eqs; TSlewLimiterSingle freqSlewers;// in log(Hz) TSlewLimiterSingle gainSlewers;// in dB @@ -110,44 +110,29 @@ class TrackEq { public: - TrackEq() { - lowPeak = !DEFAULT_lowPeak;// to force bandTypes[0] to be set when first init() will call setLowPeak() + TrackEq(int _trackNum, float _sampleRate, uint32_t *_cvConnected) { + trackNum = _trackNum; + updateSampleRate(_sampleRate);// sampleRate, sampleTime + cvConnected = _cvConnected; + + dirty = 0xF; bandTypes[1] = QuattroBiQuad::PEAK; bandTypes[2] = QuattroBiQuad::PEAK; - highPeak = !DEFAULT_highPeak;// to force bandTypes[3] to be set when first init() will call setLowPeak() - trackGain = 0.0f; - freqSlewers.setRiseFall(simd::float_4(antipopSlewLogHz)); // slew rate is in input-units per second (ex: V/s) - gainSlewers.setRiseFall(simd::float_4(antipopSlewDb)); // slew rate is in input-units per second (ex: V/s) - trackGainSlewer.setRiseFall(antipopSlewDb); - // the following are just set here to dummy values since there are test and sets in their initializations further below, and this is just to get rid of uninit warning, good values will be set in init()'s onReset() trackActive = false; - dirty = 0xF; bandActive = simd::float_4(0.0f); freq = simd::float_4(0.0f); gain = simd::float_4(0.0f); q = simd::float_4(0.0f); - } - - void init(int _trackNum, float _sampleRate, uint32_t *_cvConnected) { - trackNum = _trackNum; - sampleRate = _sampleRate; - sampleTime = 1.0f / sampleRate; - cvConnected = _cvConnected; + lowPeak = !DEFAULT_lowPeak;// to force bandTypes[0] to be set when first onReset() will call setLowPeak() + highPeak = !DEFAULT_highPeak;// to force bandTypes[3] to be set when first onReset() will call setLowPeak() + freqSlewers.setRiseFall(simd::float_4(antipopSlewLogHz)); // slew rate is in input-units per second (ex: V/s) + gainSlewers.setRiseFall(simd::float_4(antipopSlewDb)); // slew rate is in input-units per second (ex: V/s) + trackGainSlewer.setRiseFall(antipopSlewDb); onReset(); - - // don't need saving - freqCv = 0.0f; - gainCv = 0.0f; - qCv = 0.0f; - - // dependants - eqs.reset(); - freqSlewers.reset(); - gainSlewers.reset(); - trackGainSlewer.reset(); } + void onReset() { // need saving setTrackActive(DEFAULT_trackActive); @@ -156,13 +141,25 @@ class TrackEq { setFreq(i, DEFAULT_logFreq[i]); setGain(i, DEFAULT_gain); setQ(i, DEFAULT_q[i]); - freqCvAtten[i] = 1.0f; - gainCvAtten[i] = 1.0f; - qCvAtten[i] = 1.0f; } setLowPeak(DEFAULT_lowPeak); setHighPeak(DEFAULT_highPeak); setTrackGain(DEFAULT_trackGain); + + freqCvAtten = simd::float_4(1.0f); + gainCvAtten = simd::float_4(1.0f); + qCvAtten = simd::float_4(1.0f); + + // don't need saving + freqCv = 0.0f; + gainCv = 0.0f; + qCv = 0.0f; + + // dependents + eqs.reset(); + freqSlewers.reset(); + gainSlewers.reset(); + trackGainSlewer.reset(); } bool getTrackActive() {return trackActive;} diff --git a/src/EqMaster/EqMenus.hpp b/src/EqMaster/EqMenus.hpp index 3dce49f..d663cdd 100644 --- a/src/EqMaster/EqMenus.hpp +++ b/src/EqMaster/EqMenus.hpp @@ -164,7 +164,7 @@ struct CopyTrackSettingsItem : MenuItem { void moveTrack(TrackEq *trackEqsSrc, int trackNumSrc, int trackNumDest) { // does not check for trackNumSrc == trackNumDest - TrackEq buffer1; + TrackEq buffer1(0, 0.0f, nullptr); buffer1.copyFrom(&trackEqsSrc[trackNumSrc]); if (trackNumDest < trackNumSrc) { diff --git a/src/MindMeldModular.hpp b/src/MindMeldModular.hpp index 22551ed..fd5fb6b 100644 --- a/src/MindMeldModular.hpp +++ b/src/MindMeldModular.hpp @@ -180,7 +180,7 @@ struct SlewLimiterFast { }; struct HoldDetect { - long modeHoldDetect;// 0 when not detecting, downward counter when detecting + long modeHoldDetect = 0l;// 0 when not detecting, downward counter when detecting void reset() { modeHoldDetect = 0l; @@ -207,7 +207,7 @@ struct HoldDetect { }; struct DispTwoColorItem : MenuItem { - int8_t *srcColor; + int8_t *srcColor = nullptr; Menu *createChildMenu() override { Menu *menu = new Menu; @@ -225,7 +225,7 @@ struct DispTwoColorItem : MenuItem { // poly stereo menu item struct PolyStereoItem : MenuItem { - int8_t *polyStereoSrc; + int8_t *polyStereoSrc = nullptr; Menu *createChildMenu() override { Menu *menu = new Menu; diff --git a/src/PatchSet/MasterChannel.cpp b/src/PatchSet/MasterChannel.cpp index 60105f3..116d65c 100644 --- a/src/PatchSet/MasterChannel.cpp +++ b/src/PatchSet/MasterChannel.cpp @@ -46,6 +46,11 @@ struct McGlobalInfo { // no need to save, no reset // none + + + McGlobalInfo() { + onReset(); + } void onReset() { directOutPanStereoMomentCvLinearVol.cc4[0] = 3; // directOutsMode: post-solo by default @@ -124,21 +129,21 @@ struct McCore { // none // need to save, with reset - bool dcBlock = false; - int clipping = 0; // 0 is soft, 1 is hard (must be single ls bit) - float fadeRate = 0.0f; // mute when < minFadeRate, fade when >= minFadeRate. This is actually the fade time in seconds - float fadeProfile = 0.0f; // exp when +1, lin when 0, log when -1 - int8_t vuColorThemeLocal = 0; - int8_t dispColorLocal = 0; - int8_t momentCvMuteLocal = 0; - int8_t momentCvDimLocal = 0; - int8_t momentCvMonoLocal = 0; - float dimGain = 0.0f;// slider uses this gain, but displays it in dB instead of linear + bool dcBlock; + int clipping; // 0 is soft, 1 is hard (must be single ls bit) + float fadeRate; // mute when < minFadeRate, fade when >= minFadeRate. This is actually the fade time in seconds + float fadeProfile; // exp when +1, lin when 0, log when -1 + int8_t vuColorThemeLocal; + int8_t dispColorLocal; + int8_t momentCvMuteLocal; + int8_t momentCvDimLocal; + int8_t momentCvMonoLocal; + float dimGain;// slider uses this gain, but displays it in dB instead of linear std::string masterLabel; // no need to save, with reset private: - float mute = 0.0f; + float mute; simd::float_4 gainMatrix;// L, R, RinL, LinR (used for fader-mono block) // float volCv; public: @@ -148,28 +153,32 @@ struct McCore { FirstOrderStereoFilter dcBlockerStereo;// 6dB/oct public: VuMeterAllDual vu;// use mix[0..1] - float fadeGain = 0.0f; // target of this gain is the value of the mute/fade button's param (i.e. 0.0f or 1.0f) - float target = 0.0f;// used detect button press (needed to reset fadeGainXr and VUs) - float fadeGainX = 0.0f;// absolute X value of fade, between 0.0f and 1.0f (for symmetrical fade) - float fadeGainXr = 0.0f;// reset X value of fade, between 0.0f and 1.0f (for asymmetrical fade) - float fadeGainScaled = 0.0f; - float paramWithCV = 0.0f; - float dimGainIntegerDB = 0.0f;// corresponds to dimGain, converted to dB, then rounded, then back to linear + float fadeGain; // target of this gain is the value of the mute/fade button's param (i.e. 0.0f or 1.0f) + float target;// used detect button press (needed to reset fadeGainXr and VUs) + float fadeGainX;// absolute X value of fade, between 0.0f and 1.0f (for symmetrical fade) + float fadeGainXr;// reset X value of fade, between 0.0f and 1.0f (for asymmetrical fade) + float fadeGainScaled; + float paramWithCV; + float dimGainIntegerDB;// corresponds to dimGain, converted to dB, then rounded, then back to linear // no need to save, no reset McGlobalInfo *gInfo = nullptr; Param *params = nullptr; + + float calcFadeGain() {return params[McGlobalInfo::MAIN_MUTE_PARAM].getValue() >= 0.5f ? 0.0f : 1.0f;} bool isFadeMode() {return fadeRate >= GlobalConst::minFadeRate;} - void construct(McGlobalInfo *_gInfo, Param *_params) { + McCore(McGlobalInfo *_gInfo, Param *_params) { gInfo = _gInfo; params = _params; gainMatrixSlewers.setRiseFall(simd::float_4(GlobalConst::antipopSlewSlow)); // slew rate is in input-units per second (ex: V/s) muteSlewer.setRiseFall(GlobalConst::antipopSlewFast); // slew rate is in input-units per second (ex: V/s) dcBlockerStereo.setParameters(true, 0.1f); + + onReset(); } @@ -191,10 +200,10 @@ struct McCore { void resetNonJson() { mute = 0.0f; - gainMatrix = 0.0f; + gainMatrix = simd::float_4(0.0f); gainMatrixSlewers.reset(); muteSlewer.reset(); - setupDcBlocker(); + setupDcBlocker();// dcBlockerStereo dcBlockerStereo.reset(); vu.reset(); fadeGain = calcFadeGain(); @@ -492,7 +501,7 @@ struct MasterChannel : Module { RefreshCounter refresh; - MasterChannel() { + MasterChannel() : master(&gInfo, ¶ms[0]) { config(McGlobalInfo::NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); // Fader @@ -513,10 +522,7 @@ struct MasterChannel : Module { configBypass(IN_INPUTS + 0, OUT_OUTPUTS + 0); configBypass(IN_INPUTS + 1, OUT_OUTPUTS + 1); - - // gInfo.construct(); - master.construct(&gInfo, ¶ms[0]); - + onReset(); } diff --git a/src/PatchSet/PatchMaster.cpp b/src/PatchSet/PatchMaster.cpp index f4df1e5..d92dbc1 100644 --- a/src/PatchSet/PatchMaster.cpp +++ b/src/PatchSet/PatchMaster.cpp @@ -34,7 +34,7 @@ struct PatchMaster : Module { }; // Constants - NVGcolor paramCol = nvgRGB(0xff, 0xff, 0x40); + const NVGcolor paramCol = nvgRGB(0xff, 0xff, 0x40); // Need to save, no reset // none @@ -804,7 +804,7 @@ struct PatchMaster : Module { struct TileChoiceItem : MenuItem { - PatchMaster* module = NULL; + PatchMaster* module = nullptr; int t = -1; int order = -1; uint8_t info = 0; diff --git a/src/PatchSet/PatchMasterBlank.cpp b/src/PatchSet/PatchMasterBlank.cpp index df6c9fc..4a6da12 100644 --- a/src/PatchSet/PatchMasterBlank.cpp +++ b/src/PatchSet/PatchMasterBlank.cpp @@ -44,8 +44,8 @@ struct PatchMasterBlank : Module { struct PatchMasterBlankWidget : ModuleWidget { SvgPanel* svgPanel; PanelBorder* panelBorder; - std::shared_ptr svgs[2] = {}; - int lastFacePlate = 0; + std::shared_ptr svgs[2]; + int lastFacePlate; void appendContextMenu(Menu *menu) override { PatchMasterBlank *module = static_cast(this->module); @@ -63,10 +63,12 @@ struct PatchMasterBlankWidget : ModuleWidget { PatchMasterBlankWidget(PatchMasterBlank *module) { setModule(module); - svgs[0] = APP->window->loadSvg(asset::plugin(pluginInstance, "res/dark/patchset/pm-vsep-bg.svg")); - setPanel(svgs[0]); svgPanel = static_cast(getPanel()); panelBorder = findBorder(svgPanel->fb); + svgs[0] = APP->window->loadSvg(asset::plugin(pluginInstance, "res/dark/patchset/pm-vsep-bg.svg")); + setPanel(svgs[0]); + svgs[1] = nullptr; + lastFacePlate = 0; } @@ -91,7 +93,7 @@ struct PatchMasterBlankWidget : ModuleWidget { if (facePlate != lastFacePlate) { lastFacePlate = facePlate; - if (svgs[1] == NULL) { + if (svgs[1] == nullptr) { svgs[1] = APP->window->loadSvg(asset::plugin(pluginInstance, "res/dark/patchset/pm-vsep-bg-noline.svg")); } SvgPanel* panel = static_cast(getPanel()); diff --git a/src/ShapeMaster/ShapeMaster.hpp b/src/ShapeMaster/ShapeMaster.hpp index c7a87f7..e4f5dd6 100644 --- a/src/ShapeMaster/ShapeMaster.hpp +++ b/src/ShapeMaster/ShapeMaster.hpp @@ -147,7 +147,7 @@ struct ShapeMasterWidget : ModuleWidget { void onHoverKey(const event::HoverKey& e) override { if (e.action == GLFW_PRESS) { if ( e.key == GLFW_KEY_L && ((e.mods & RACK_MOD_CTRL) != 0) ) { - ShapeMaster *module = dynamic_cast(this->module); + ShapeMaster *module = static_cast(this->module); module->miscSettings2.cc4[2] ^= 0x1; e.consume(this); return;