computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 0aa6844b1651d4abf566a3f263b33b16e29db17a
parent a2a6fc26e42f53aea79e872b226c558eea43bec5
Author: Adam <1319733+freddyz@users.noreply.github.com>
Date:   Wed, 11 Dec 2019 09:29:54 -0600

Right click item to set channel output mode
Diffstat:
Msrc/ComputerscarePatchSequencer.cpp | 34+++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/src/ComputerscarePatchSequencer.cpp b/src/ComputerscarePatchSequencer.cpp @@ -65,7 +65,8 @@ struct ComputerscarePatchSequencer : Module { int randomizationStepEnum = 0; //0: edit step, 1: active step, 2: all steps int randomizationOutputBoundsEnum = 1; //0: randomize exactly one per output, 1: randomize exactly one per output, 2: randomize 1 or more, 3: randomize 0 or more - int channelCount[numInputs]; + int channelCount[numOutputs]; + int channelCountEnum = -1; ComputerscarePatchSequencer() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); @@ -562,6 +563,37 @@ struct WhichRandomizationOutputBoundsItem : MenuItem { MenuItem::step(); } }; + +struct FatherSonChannelItem : MenuItem { + ComputerscarePatchSequencer *module; + int channels; + void onAction(const event::Action &e) override { + module->channelCountEnum = channels; + } +}; + + +struct FatherSonChannelsItem : MenuItem { + ComputerscarePatchSequencer *module; + Menu *createChildMenu() override { + Menu *menu = new Menu; + for (int channels = -1; channels <= 16; channels++) { + FatherSonChannelItem *item = new FatherSonChannelItem; + if (channels < 0) { + item->text = "Automatic"; + } + else { + item->text = string::f("%d", channels); + item->rightText = CHECKMARK(module->channelCountEnum == channels); + } + item->module = module; + item->channels = channels; + menu->addChild(item); + } + return menu; + } +}; + void ComputerscarePatchSequencerWidget::appendContextMenu(Menu *menu) { ComputerscarePatchSequencer *patchSequencer = dynamic_cast<ComputerscarePatchSequencer *>(this->module);