Skip to content

Commit

Permalink
forgot master in mixmaster in last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcBoule committed Oct 15, 2023
1 parent 15cb22c commit dc89d2f
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 67 deletions.
117 changes: 59 additions & 58 deletions src/MixMaster/MixMaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct MixMaster : Module {
MixerTrack tracks[N_TRK];
MixerGroup groups[N_GRP];
std::vector<MixerAux> aux;// size 4
MixerMaster master;
MixerMaster* master;

// No need to save, with reset
int updateTrackLabelRequest;// 0 when nothing to do, 1 for read names in widget
Expand Down Expand Up @@ -116,7 +116,7 @@ struct MixMaster : Module {
float values20[20];// slow expander
alignas(4) char auxLabels[4 * 4 + 4];// slow expander
GlobalToLocalOp globalToLocalOp;


void sendToMessageBus(bool doTrackMoveInit) {
int8_t vuColors[1 + 16 + 4 + 4];// room for global, tracks, groups, aux
Expand Down Expand Up @@ -147,10 +147,10 @@ struct MixMaster : Module {
}

if (N_TRK < 16) {
mixerMessageBus.sendJr(id + 1, master.masterLabel, trackLabels, &(trackLabels[N_TRK * 4]), auxLabels, vuColors, dispColors, doTrackMoveInit);
mixerMessageBus.sendJr(id + 1, master->masterLabel, trackLabels, &(trackLabels[N_TRK * 4]), auxLabels, vuColors, dispColors, doTrackMoveInit);
}
else {
mixerMessageBus.send(id + 1, master.masterLabel, trackLabels, auxLabels, vuColors, dispColors, doTrackMoveInit);
mixerMessageBus.send(id + 1, master->masterLabel, trackLabels, auxLabels, vuColors, dispColors, doTrackMoveInit);
}
}

Expand Down Expand Up @@ -242,7 +242,7 @@ struct MixMaster : Module {
for (int i = 0; i < 4; i++) {
aux.push_back(MixerAux(i, gInfo, &inputs[0], values20, &auxTaps[i << 1], &stereoPanModeLocalAux.cc4[i]));
}
master.construct(gInfo, &params[0], &inputs[0]);
master = new MixerMaster(gInfo, &params[0], &inputs[0]);
muteTrackWhenSoloAuxRetSlewer.setRiseFall(GlobalConst::antipopSlewFast); // slew rate is in input-units per second
onReset();

Expand All @@ -256,6 +256,7 @@ struct MixMaster : Module {

~MixMaster() {
delete gInfo;
delete master;
if (id > -1) {
mixerMessageBus.deregisterMember(id + 1);
}
Expand All @@ -273,7 +274,7 @@ struct MixMaster : Module {
for (int i = 0; i < 4; i++) {
aux[i].onReset();
}
master.onReset();
master->onReset();
resetNonJson(false);
}
void resetNonJson(bool recurseNonJson) {
Expand All @@ -292,7 +293,7 @@ struct MixMaster : Module {
for (int i = 0; i < 4; i++) {
aux[i].resetNonJson();
}
master.resetNonJson();
master->resetNonJson();
}
for (int i = 0; i < 20; i++) {
values20[i] = 0.0f;
Expand Down Expand Up @@ -327,7 +328,7 @@ struct MixMaster : Module {
aux[i].dataToJson(rootJ);
}
// master
master.dataToJson(rootJ);
master->dataToJson(rootJ);

return rootJ;
}
Expand Down Expand Up @@ -361,7 +362,7 @@ struct MixMaster : Module {
aux[i].dataFromJson(rootJ);
}
// master
master.dataFromJson(rootJ);
master->dataFromJson(rootJ);

resetNonJson(true);
}
Expand Down Expand Up @@ -517,7 +518,7 @@ struct MixMaster : Module {
for (int grp = 0; grp < N_GRP; grp++) {
groups[grp].onSampleRateChange();
}
master.onSampleRateChange();
master->onSampleRateChange();
}


Expand Down Expand Up @@ -570,7 +571,7 @@ struct MixMaster : Module {
}
// Master
if ((sixteenCount & 0x3) == 2) {// master and groupUsage updated once every 4 passes in input proceesing
master.updateSlowValues();
master->updateSlowValues();
gInfo->updateGroupUsage();
}

Expand Down Expand Up @@ -638,7 +639,7 @@ struct MixMaster : Module {
}
}
// Master
master.process(mix, ecoStagger4);// stagger 4
master->process(mix, ecoStagger4);// stagger 4

// Set master outputs
outputs[MAIN_OUTPUTS + 0].setVoltage(mix[0]);
Expand Down Expand Up @@ -757,7 +758,7 @@ struct MixMaster : Module {
// auxSends[] has room for 16+4 or 8+2 stereo values of the sends to the aux panel (Trk1L, Trk1R, Trk2L, Trk2R ... Trk16L, Trk16R, Grp1L, Grp1R ... Grp4L, Grp4R)
// populate auxSends[0..39]: Take the trackTaps/groupTaps indicated by the Aux sends mode (with per-track option)

float masterGain = gInfo->masterFaderScalesSends == 0 ? 1.0f : (master.gainMatrixSlewers.out[1] + master.gainMatrixSlewers.out[2]) * master.chainGainAndMuteSlewers.out[2];
float masterGain = gInfo->masterFaderScalesSends == 0 ? 1.0f : (master->gainMatrixSlewers.out[1] + master->gainMatrixSlewers.out[2]) * master->chainGainAndMuteSlewers.out[2];

// tracks
if ( gInfo->auxSendsMode < 4 && gInfo->masterFaderScalesSends == 0 && (gInfo->groupsControlTrackSendLevels == 0 || gInfo->groupUsage[N_GRP] == 0) ) {
Expand Down Expand Up @@ -972,7 +973,7 @@ struct MixMaster : Module {
// master mute
state = muteSoloCvTriggers[N_TRK * 2 + N_GRP * 2].process(inputs[GRPM_MUTESOLO_INPUT].getVoltage(N_GRP * 2));
if (state != 0) {
if (gInfo->directOutPanStereoMomentCvLinearVol.cc4[2] >= 2 ? master.momentCvMuteLocal : gInfo->directOutPanStereoMomentCvLinearVol.cc4[2]) {
if (gInfo->directOutPanStereoMomentCvLinearVol.cc4[2] >= 2 ? master->momentCvMuteLocal : gInfo->directOutPanStereoMomentCvLinearVol.cc4[2]) {
if (state == 1) {
float newParam = 1.0f - params[MAIN_MUTE_PARAM].getValue();// toggle
params[MAIN_MUTE_PARAM].setValue(newParam);
Expand All @@ -985,7 +986,7 @@ struct MixMaster : Module {
// master dim
state = muteSoloCvTriggers[N_TRK * 2 + N_GRP * 2 + 1].process(inputs[GRPM_MUTESOLO_INPUT].getVoltage(N_GRP * 2 + 1));
if (state != 0) {
if (gInfo->directOutPanStereoMomentCvLinearVol.cc4[2] >= 2 ? master.momentCvDimLocal : gInfo->directOutPanStereoMomentCvLinearVol.cc4[2]) {
if (gInfo->directOutPanStereoMomentCvLinearVol.cc4[2] >= 2 ? master->momentCvDimLocal : gInfo->directOutPanStereoMomentCvLinearVol.cc4[2]) {
if (state == 1) {
float newParam = 1.0f - params[MAIN_DIM_PARAM].getValue();// toggle
params[MAIN_DIM_PARAM].setValue(newParam);
Expand All @@ -998,7 +999,7 @@ struct MixMaster : Module {
// master mono
state = muteSoloCvTriggers[N_TRK * 2 + N_GRP * 2 + 2].process(inputs[GRPM_MUTESOLO_INPUT].getVoltage(N_GRP * 2 + 2));
if (state != 0) {
if (gInfo->directOutPanStereoMomentCvLinearVol.cc4[2] >= 2 ? master.momentCvMonoLocal : gInfo->directOutPanStereoMomentCvLinearVol.cc4[2]) {
if (gInfo->directOutPanStereoMomentCvLinearVol.cc4[2] >= 2 ? master->momentCvMonoLocal : gInfo->directOutPanStereoMomentCvLinearVol.cc4[2]) {
if (state == 1) {
float newParam = 1.0f - params[MAIN_MONO_PARAM].getValue();// toggle
params[MAIN_MONO_PARAM].setValue(newParam);
Expand Down Expand Up @@ -1270,20 +1271,20 @@ struct MixMasterWidget : ModuleWidget {
// Master label
addChild(masterDisplay = createWidget<MasterDisplay>(mm2px(Vec(294.82 - 7.25, 31.25 - 2.65))));
if (module) {
masterDisplay->dcBlock = &(module->master.dcBlock);
masterDisplay->clipping = &(module->master.clipping);
masterDisplay->fadeRate = &(module->master.fadeRate);
masterDisplay->fadeProfile = &(module->master.fadeProfile);
masterDisplay->vuColorThemeLocal = &(module->master.vuColorThemeLocal);
masterDisplay->dcBlock = &(module->master->dcBlock);
masterDisplay->clipping = &(module->master->clipping);
masterDisplay->fadeRate = &(module->master->fadeRate);
masterDisplay->fadeProfile = &(module->master->fadeProfile);
masterDisplay->vuColorThemeLocal = &(module->master->vuColorThemeLocal);
masterDisplay->directOutPanStereoMomentCvLinearVol = &(module->gInfo->directOutPanStereoMomentCvLinearVol);
masterDisplay->momentCvMuteLocal = &(module->master.momentCvMuteLocal);
masterDisplay->momentCvDimLocal = &(module->master.momentCvDimLocal);
masterDisplay->momentCvMonoLocal = &(module->master.momentCvMonoLocal);
masterDisplay->dispColorLocal = &(module->master.dispColorLocal);
masterDisplay->chainOnly = &(module->master.chainOnly);
masterDisplay->dimGain = &(module->master.dimGain);
masterDisplay->masterLabel = module->master.masterLabel;
masterDisplay->dimGainIntegerDB = &(module->master.dimGainIntegerDB);
masterDisplay->momentCvMuteLocal = &(module->master->momentCvMuteLocal);
masterDisplay->momentCvDimLocal = &(module->master->momentCvDimLocal);
masterDisplay->momentCvMonoLocal = &(module->master->momentCvMonoLocal);
masterDisplay->dispColorLocal = &(module->master->dispColorLocal);
masterDisplay->chainOnly = &(module->master->chainOnly);
masterDisplay->dimGain = &(module->master->dimGain);
masterDisplay->masterLabel = module->master->masterLabel;
masterDisplay->dimGainIntegerDB = &(module->master->dimGainIntegerDB);
masterDisplay->colorAndCloak = &(module->gInfo->colorAndCloak);
masterDisplay->idSrc = &(module->id);
masterDisplay->masterFaderScalesSendsSrc = &(module->gInfo->masterFaderScalesSends);
Expand All @@ -1294,27 +1295,27 @@ struct MixMasterWidget : ModuleWidget {
if (module) {
// VU meter
VuMeterMaster *newVU = createWidgetCentered<VuMeterMaster>(mm2px(Vec(294.82, 70.3)));
newVU->srcLevels = module->master.vu.vuValues;
newVU->srcMuteGhost = &(module->master.fadeGainScaled);
newVU->srcLevels = module->master->vu.vuValues;
newVU->srcMuteGhost = &(module->master->fadeGainScaled);
newVU->colorThemeGlobal = &(module->gInfo->colorAndCloak.cc4[vuColorGlobal]);
newVU->colorThemeLocal = &(module->master.vuColorThemeLocal);
newVU->clippingPtr = &(module->master.clipping);
newVU->colorThemeLocal = &(module->master->vuColorThemeLocal);
newVU->clippingPtr = &(module->master->clipping);
addChild(newVU);
// Fade pointer
CvAndFadePointerMaster *newFP = createWidgetCentered<CvAndFadePointerMaster>(mm2px(Vec(294.82 - 3.4, 70.3)));
newFP->srcParam = &(module->params[TMixMaster::MAIN_FADER_PARAM]);
newFP->srcParamWithCV = &(module->master.paramWithCV);
newFP->srcParamWithCV = &(module->master->paramWithCV);
newFP->colorAndCloak = &(module->gInfo->colorAndCloak);
newFP->srcFadeGain = &(module->master.fadeGain);
newFP->srcFadeRate = &(module->master.fadeRate);
newFP->srcFadeGain = &(module->master->fadeGain);
newFP->srcFadeRate = &(module->master->fadeRate);
addChild(newFP);
}

// Master mute
MmMuteFadeButton* newMuteFade;
addParam(newMuteFade = createParamCentered<MmMuteFadeButton>(mm2px(Vec(294.82, 109.8)), module, TMixMaster::MAIN_MUTE_PARAM));
if (module) {
newMuteFade->type = &(module->master.fadeRate);
newMuteFade->type = &(module->master->fadeRate);
}

// Master dim
Expand Down Expand Up @@ -1577,20 +1578,20 @@ struct MixMasterJrWidget : ModuleWidget {
// Master label
addChild(masterDisplay = createWidget<MasterDisplay>(mm2px(Vec(294.82 - 12.7 * 10 - 7.25, 31.25 - 2.65))));
if (module) {
masterDisplay->dcBlock = &(module->master.dcBlock);
masterDisplay->clipping = &(module->master.clipping);
masterDisplay->fadeRate = &(module->master.fadeRate);
masterDisplay->fadeProfile = &(module->master.fadeProfile);
masterDisplay->vuColorThemeLocal = &(module->master.vuColorThemeLocal);
masterDisplay->dcBlock = &(module->master->dcBlock);
masterDisplay->clipping = &(module->master->clipping);
masterDisplay->fadeRate = &(module->master->fadeRate);
masterDisplay->fadeProfile = &(module->master->fadeProfile);
masterDisplay->vuColorThemeLocal = &(module->master->vuColorThemeLocal);
masterDisplay->directOutPanStereoMomentCvLinearVol = &(module->gInfo->directOutPanStereoMomentCvLinearVol);
masterDisplay->momentCvMuteLocal = &(module->master.momentCvMuteLocal);
masterDisplay->momentCvDimLocal = &(module->master.momentCvDimLocal);
masterDisplay->momentCvMonoLocal = &(module->master.momentCvMonoLocal);
masterDisplay->dispColorLocal = &(module->master.dispColorLocal);
masterDisplay->chainOnly = &(module->master.chainOnly);
masterDisplay->dimGain = &(module->master.dimGain);
masterDisplay->masterLabel = module->master.masterLabel;
masterDisplay->dimGainIntegerDB = &(module->master.dimGainIntegerDB);
masterDisplay->momentCvMuteLocal = &(module->master->momentCvMuteLocal);
masterDisplay->momentCvDimLocal = &(module->master->momentCvDimLocal);
masterDisplay->momentCvMonoLocal = &(module->master->momentCvMonoLocal);
masterDisplay->dispColorLocal = &(module->master->dispColorLocal);
masterDisplay->chainOnly = &(module->master->chainOnly);
masterDisplay->dimGain = &(module->master->dimGain);
masterDisplay->masterLabel = module->master->masterLabel;
masterDisplay->dimGainIntegerDB = &(module->master->dimGainIntegerDB);
masterDisplay->colorAndCloak = &(module->gInfo->colorAndCloak);
masterDisplay->idSrc = &(module->id);
masterDisplay->masterFaderScalesSendsSrc = &(module->gInfo->masterFaderScalesSends);
Expand All @@ -1601,27 +1602,27 @@ struct MixMasterJrWidget : ModuleWidget {
if (module) {
// VU meter
VuMeterMaster *newVU = createWidgetCentered<VuMeterMaster>(mm2px(Vec(294.82 - 12.7 * 10, 70.3)));
newVU->srcLevels = module->master.vu.vuValues;
newVU->srcMuteGhost = &(module->master.fadeGainScaled);
newVU->srcLevels = module->master->vu.vuValues;
newVU->srcMuteGhost = &(module->master->fadeGainScaled);
newVU->colorThemeGlobal = &(module->gInfo->colorAndCloak.cc4[vuColorGlobal]);
newVU->colorThemeLocal = &(module->master.vuColorThemeLocal);
newVU->clippingPtr = &(module->master.clipping);
newVU->colorThemeLocal = &(module->master->vuColorThemeLocal);
newVU->clippingPtr = &(module->master->clipping);
addChild(newVU);
// Fade pointer
CvAndFadePointerMaster *newFP = createWidgetCentered<CvAndFadePointerMaster>(mm2px(Vec(294.82 - 12.7 * 10 - 3.4, 70.3)));
newFP->srcParam = &(module->params[TMixMaster::MAIN_FADER_PARAM]);
newFP->srcParamWithCV = &(module->master.paramWithCV);
newFP->srcParamWithCV = &(module->master->paramWithCV);
newFP->colorAndCloak = &(module->gInfo->colorAndCloak);
newFP->srcFadeGain = &(module->master.fadeGain);
newFP->srcFadeRate = &(module->master.fadeRate);
newFP->srcFadeGain = &(module->master->fadeGain);
newFP->srcFadeRate = &(module->master->fadeRate);
addChild(newFP);
}

// Master mute
MmMuteFadeButton* newMuteFade;
addParam(newMuteFade = createParamCentered<MmMuteFadeButton>(mm2px(Vec(294.82 - 12.7 * 10, 109.8)), module, TMixMaster::MAIN_MUTE_PARAM));
if (module) {
newMuteFade->type = &(module->master.fadeRate);
newMuteFade->type = &(module->master->fadeRate);
}

// Master dim
Expand Down
5 changes: 4 additions & 1 deletion src/MixMaster/MixMaster.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,18 +440,21 @@ struct MixerMaster {
Input *inChain;
Input *inVol;


float calcFadeGain() {return params[MAIN_MUTE_PARAM].getValue() >= 0.5f ? 0.0f : 1.0f;}
bool isFadeMode() {return fadeRate >= GlobalConst::minFadeRate;}


void construct(GlobalInfo *_gInfo, Param *_params, Input *_inputs) {
MixerMaster(GlobalInfo *_gInfo, Param *_params, Input *_inputs) {
gInfo = _gInfo;
params = _params;
inChain = &_inputs[CHAIN_INPUTS];
inVol = &_inputs[GRPM_MUTESOLO_INPUT];
gainMatrixSlewers.setRiseFall(simd::float_4(GlobalConst::antipopSlewSlow)); // slew rate is in input-units per second (ex: V/s)
chainGainAndMuteSlewers.setRiseFall(simd::float_4(GlobalConst::antipopSlewFast)); // slew rate is in input-units per second (ex: V/s)
dcBlockerStereo.setParameters(true, 0.1f);

onReset();
}


Expand Down
16 changes: 8 additions & 8 deletions src/MixMaster/MixMasterWidget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void step() override {
// Track labels (pull from module)
if (module->updateTrackLabelRequest != 0) {// pull request from module
// master display
masterDisplay->text = std::string(&(module->master.masterLabel[0]), 6);
masterDisplay->text = std::string(&(module->master->masterLabel[0]), 6);
// track displays
for (int trk = 0; trk < N_TRK; trk++) {
trackDisplays[trk]->text = std::string(&(module->trackLabels[trk * 4]), 4);
Expand Down Expand Up @@ -234,7 +234,7 @@ void step() override {
for (int i = 0; i < N_GRP; i++) {
module->groups[i].vuColorThemeLocal = module->globalToLocalOp.operand;
}
module->master.vuColorThemeLocal = module->globalToLocalOp.operand;
module->master->vuColorThemeLocal = module->globalToLocalOp.operand;
break;
}
case (GTOL_LABELCOL) : {
Expand All @@ -244,7 +244,7 @@ void step() override {
for (int i = 0; i < N_GRP; i++) {
module->groups[i].dispColorLocal = module->globalToLocalOp.operand;
}
module->master.dispColorLocal = module->globalToLocalOp.operand;
module->master->dispColorLocal = module->globalToLocalOp.operand;
break;
}
case (GTOL_STEREOPAN) : {
Expand Down Expand Up @@ -292,9 +292,9 @@ void step() override {
module->groups[i].momentCvMuteLocal = module->globalToLocalOp.operand;
module->groups[i].momentCvSoloLocal = module->globalToLocalOp.operand;
}
module->master.momentCvMuteLocal = module->globalToLocalOp.operand;
module->master.momentCvDimLocal = module->globalToLocalOp.operand;
module->master.momentCvMonoLocal = module->globalToLocalOp.operand;
module->master->momentCvMuteLocal = module->globalToLocalOp.operand;
module->master->momentCvDimLocal = module->globalToLocalOp.operand;
module->master->momentCvMonoLocal = module->globalToLocalOp.operand;
break;
}
}
Expand Down Expand Up @@ -371,12 +371,12 @@ void step() override {
snprintf(strBuf, 32, "%s LPF cutoff", groupLabel.c_str());
module->paramQuantities[TMixMaster::GROUP_LPCUT_PARAMS + i]->name = strBuf;
}
std::string masterLabel = std::string(module->master.masterLabel, 6);
std::string masterLabel = std::string(module->master->masterLabel, 6);
// Fader
snprintf(strBuf, 32, "%s level", masterLabel.c_str());
module->paramQuantities[TMixMaster::MAIN_FADER_PARAM]->name = strBuf;
// Mute/fade
if (module->master.isFadeMode()) {
if (module->master->isFadeMode()) {
snprintf(strBuf, 32, "%s fade", masterLabel.c_str());
}
else {
Expand Down

0 comments on commit dc89d2f

Please sign in to comment.