Skip to content

Commit bcc76e2

Browse files
committed
RM 5 to 1 add output poly mode setting for issue #115
1 parent 5d8f0e9 commit bcc76e2

File tree

1 file changed

+40
-3
lines changed

1 file changed

+40
-3
lines changed

src/PatchSet/RouteMaster.cpp

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ struct RouteMaster : Module {
135135
}
136136
miscSettings.cc4[0] = 0x0;// name color
137137
miscSettings.cc4[1] = 0x1;// get labels from param mapping
138-
miscSettings.cc4[2] = 0x0;// unused
138+
miscSettings.cc4[2] = 0x0;// mux out poly mode: 0x0 = max of num chans of active inputs, 0x1 = num chans of selected input
139139
miscSettings.cc4[3] = 0x0;// unused
140140

141141
resetNonJson();
@@ -232,8 +232,16 @@ struct RouteMaster : Module {
232232
// 5 to 1 mux
233233
for (int w = 0; w < WIDTH; w++) {
234234
int maxInChans = -1;
235-
for (int i = 0; i < INS; i++) {
236-
maxInChans = std::max(maxInChans, inputs[IN_INPUTS + i + (INS * w)].getChannels());
235+
// mux out poly mode:
236+
if (miscSettings.cc4[2] == 0) {
237+
// mux out poly mode is max of num chans of active inputs
238+
for (int i = 0; i < INS; i++) {
239+
maxInChans = std::max(maxInChans, inputs[IN_INPUTS + i + (INS * w)].getChannels());
240+
}
241+
}
242+
else {
243+
// mux out poly mode is num chans of selected input
244+
maxInChans = inputs[IN_INPUTS + sel + (INS * w)].getChannels();
237245
}
238246
if (outputs[OUT_OUTPUTS + w].getChannels() != maxInChans) {
239247
outputs[OUT_OUTPUTS + w].setChannels(maxInChans);
@@ -337,6 +345,25 @@ struct RouteMasterWidget : ModuleWidget {
337345
}
338346
};
339347

348+
// poly stereo menu item
349+
struct MuxPolyOutputItem : MenuItem {
350+
int8_t *polyModeSrc = nullptr;
351+
352+
Menu *createChildMenu() override {
353+
Menu *menu = new Menu;
354+
menu->addChild(createCheckMenuItem("Max of active inputs", "",
355+
[=]() {return *polyModeSrc == 0;},
356+
[=]() {*polyModeSrc = 0;}
357+
));
358+
menu->addChild(createCheckMenuItem("Selected input", "",
359+
[=]() {return *polyModeSrc == 1;},
360+
[=]() {*polyModeSrc = 1;}
361+
));
362+
return menu;
363+
}
364+
};
365+
366+
340367

341368
void appendContextMenu(Menu *menu) override {
342369
RouteMaster<INS, OUTS, WIDTH> *module = static_cast<RouteMaster<INS, OUTS, WIDTH>*>(this->module);
@@ -376,6 +403,16 @@ struct RouteMasterWidget : ModuleWidget {
376403
labelsValueField->box.size.x = 100;
377404
menu->addChild(labelsValueField);
378405
}
406+
407+
// mux out poly mode
408+
if (OUTS == 1) {
409+
menu->addChild(new MenuSeparator());
410+
menu->addChild(createMenuLabel("Settings:"));
411+
412+
MuxPolyOutputItem *polyOutItem = createMenuItem<MuxPolyOutputItem>("Poly output behavior", RIGHT_ARROW);
413+
polyOutItem->polyModeSrc = &(module->miscSettings.cc4[2]);
414+
menu->addChild(polyOutItem);
415+
}
379416
}
380417

381418

0 commit comments

Comments
 (0)