| 600 | void triggerClearFlash() { clearFlashTime = 0.12f; } |
| 601 | |
| 602 | void processButtons() { |
| 603 | auto shiftEvent = shiftButtonTrigger.processEvent(params[SHIFT_PARAM].getValue()); |
| 604 | if (shiftEvent == dsp::BooleanTrigger::Event::TRIGGERED) { |
| 605 | patch->buttonChanged(SHIFT_BUTTON, Patch::ON, 0); |
| 606 | } else if (shiftEvent == dsp::BooleanTrigger::Event::UNTRIGGERED) { |
| 607 | patch->buttonChanged(SHIFT_BUTTON, Patch::OFF, 0); |
| 608 | } |
| 609 | |
| 610 | auto randomButtonEvent = randomButtonTrigger.processEvent(params[RANDOM_PARAM].getValue()); |
| 611 | if (randomButtonEvent == dsp::BooleanTrigger::Event::TRIGGERED) { |
| 612 | patch->buttonChanged(RANDOM_BUTTON, Patch::ON, 0); |
| 613 | pendingRandomizeAction.store(true); |
| 614 | } else if (randomButtonEvent == dsp::BooleanTrigger::Event::UNTRIGGERED) { |
| 615 | patch->buttonChanged(RANDOM_BUTTON, Patch::OFF, 0); |
| 616 | } |
| 617 | |
| 618 | auto mapButtonEvent = mapButtonTrigger.processEvent(params[MAP_PARAM].getValue()); |
| 619 | if (mapButtonEvent == dsp::BooleanTrigger::Event::TRIGGERED) { |
| 620 | patch->buttonChanged(MAP_BUTTON, Patch::ON, 0); |
| 621 | } else if (mapButtonEvent == dsp::BooleanTrigger::Event::UNTRIGGERED) { |
| 622 | patch->buttonChanged(MAP_BUTTON, Patch::OFF, 0); |
| 623 | } |
| 624 | |
| 625 | auto clearButtonEvent = clearButtonTrigger.processEvent(params[CLEAR_PARAM].getValue()); |
| 626 | if (clearButtonEvent == dsp::BooleanTrigger::Event::TRIGGERED && params[SHIFT_PARAM].getValue() > 0.5f) { |
| 627 | clearMappingsForCurrentMode(); |
| 628 | triggerClearFlash(); |
| 629 | } |
| 630 | |
| 631 | auto randomInputEvent = randomInputTrigger.processEvent(inputs[RANDOM_INPUT].getVoltage()); |
| 632 | if (randomInputEvent == dsp::SchmittTrigger::Event::TRIGGERED) { |
| 633 | patch->buttonChanged(RANDOM_IN, Patch::ON, 0); |
| 634 | pendingRandomizeAction.store(true); |
| 635 | } else if (randomInputEvent == dsp::SchmittTrigger::Event::UNTRIGGERED) { |
| 636 | patch->buttonChanged(RANDOM_IN, Patch::OFF, 0); |
| 637 | } |
| 638 | |
| 639 | auto syncInputEvent = syncInputTrigger.processEvent(inputs[SYNC_INPUT].getVoltage()); |
| 640 | if (syncInputEvent == dsp::SchmittTrigger::Event::TRIGGERED) { |
| 641 | patch->buttonChanged(SYNC_IN, Patch::ON, 0); |
| 642 | } else if (syncInputEvent == dsp::SchmittTrigger::Event::UNTRIGGERED) { |
| 643 | patch->buttonChanged(SYNC_IN, Patch::OFF, 0); |
| 644 | } |
| 645 | } |
| 646 | |
| 647 | void updateLights(const ProcessArgs &args, const PatchCtrls *patchCtrls, const Ui *ui) { |
| 648 | lights[SYNC_LIGHT].setBrightnessSmooth(patch->isButtonPressed(SYNC_IN), args.sampleTime * kBlockSize); |