MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / OnPush2Control

Method OnPush2Control

Source/LooperRecorder.cpp:579–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577}
578
579bool LooperRecorder::OnPush2Control(Push2Control* push2, MidiMessageType type, int controlIndex, float midiValue)
580{
581 if (type == kMidiMessage_Note)
582 {
583 if (controlIndex >= 36 && controlIndex <= 99 && midiValue > 0)
584 {
585 int gridIndex = controlIndex - 36;
586 int x = gridIndex % 8;
587 int y = 7 - gridIndex / 8;
588
589 if (y == 0)
590 {
591 switch (x)
592 {
593 case 0: mCommit8BarsButton->SetValue(1, gTime); break;
594 case 1: mCommit4BarsButton->SetValue(1, gTime); break;
595 case 2: mCommit2BarsButton->SetValue(1, gTime); break;
596 case 3: mCommit1BarButton->SetValue(1, gTime); break;
597 default: break;
598 }
599 }
600 else if (y == 1)
601 {
602 if (x < mLoopers.size())
603 mNextCommitTargetIndex = x;
604 }
605 else if (y - 2 < mLoopers.size())
606 {
607 int looperIndex = y - 2;
608 if (mLoopers[looperIndex] != nullptr)
609 {
610 if (x == 0)
611 push2->SetDisplayModule(mLoopers[looperIndex]);
612 if (x == 1)
613 mLoopers[looperIndex]->SetMute(gTime, !mLoopers[looperIndex]->GetMute());
614 }
615 }
616
617 return true;
618 }
619 }
620
621 return false;
622}
623
624void LooperRecorder::UpdatePush2Leds(Push2Control* push2)
625{

Callers

nothing calls this directly

Calls 5

sizeMethod · 0.80
SetDisplayModuleMethod · 0.80
SetMuteMethod · 0.80
GetMuteMethod · 0.80
SetValueMethod · 0.45

Tested by

no test coverage detected