MCPcopy Create free account
hub / github.com/VCVRack/Befaco / processPlayResetLogic

Method processPlayResetLogic

src/Muxlicer.cpp:607–647  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605 }
606
607 void processPlayResetLogic() {
608
609 const bool resetPulseInReceived = resetTrigger.process(rescale(inputs[RESET_INPUT].getVoltage(), 0.1f, 2.f, 0.f, 1.f));
610 if (resetPulseInReceived) {
611
612 switch (playState) {
613 case STATE_STOPPED: resetRequested = RESET_AND_PLAY_ONCE; break;
614 case STATE_PLAY_ONCE: resetRequested = RESET_AND_PLAY_ONCE; break;
615 case STATE_PLAY: resetRequested = RESET_AND_PLAY; break;
616 }
617 }
618
619 // if the play switch has effectively been activated for the first time,
620 // i.e. it's not just still being held
621 const bool switchIsActive = params[PLAY_PARAM].getValue() != STATE_STOPPED;
622 if (playStateTrigger.process(switchIsActive) && switchIsActive) {
623
624 // if we were stopped, check for activation (normal, up or one-shot, down)
625 if (playState == STATE_STOPPED) {
626 if (params[PLAY_PARAM].getValue() == STATE_PLAY) {
627 resetRequested = RESET_AND_PLAY;
628 }
629 else if (params[PLAY_PARAM].getValue() == STATE_PLAY_ONCE) {
630 resetRequested = RESET_AND_PLAY_ONCE;
631 }
632 }
633 // otherwise we are in play mode (and we've not just held onto the play switch),
634 // so check for stop (switch up) or reset (switch down)
635 else {
636
637 // top switch will stop
638 if (params[PLAY_PARAM].getValue() == STATE_PLAY) {
639 playState = STATE_STOPPED;
640 }
641 // bottom will reset
642 else if (params[PLAY_PARAM].getValue() == STATE_PLAY_ONCE) {
643 resetRequested = RESET_AND_PLAY_ONCE;
644 }
645 }
646 }
647 }
648
649
650 // determines how many gates to yield per step

Callers

nothing calls this directly

Calls 2

getValueMethod · 0.80
processMethod · 0.45

Tested by

no test coverage detected