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

Method ButtonClicked

Source/LooperRecorder.cpp:665–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

663}
664
665void LooperRecorder::ButtonClicked(ClickButton* button, double time)
666{
667 if (button == mResampleButton)
668 SyncLoopLengths();
669
670 if (button == mResampAndSetButton)
671 {
672 SnapToClosestPitch();
673 TheScale->SetRoot(int(AdjustedRootForSpeed() + .5f));
674 SyncLoopLengths();
675 }
676
677 if (button == mDoubleTempoButton)
678 {
679 for (int i = 0; i < mLoopers.size(); ++i)
680 {
681 if (mLoopers[i])
682 mLoopers[i]->DoubleNumBars();
683 }
684 TheTransport->SetTempo(TheTransport->GetTempo() * 2);
685 mBaseTempo = TheTransport->GetTempo();
686 float pos = TheTransport->GetMeasurePos(time) + (TheTransport->GetMeasure(time) % 8);
687 int count = TheTransport->GetMeasure(time) - int(pos);
688 pos *= 2;
689 count += int(pos);
690 pos -= int(pos);
691 TheTransport->SetMeasureTime(count + pos);
692 for (int i = 0; i < mLoopers.size(); ++i)
693 {
694 if (mLoopers[i])
695 mLoopers[i]->ResampleForSpeed(1);
696 }
697 }
698
699 if (button == mHalfTempoButton)
700 {
701 for (int i = 0; i < mLoopers.size(); ++i)
702 {
703 if (mLoopers[i])
704 mLoopers[i]->HalveNumBars();
705 }
706 TheTransport->SetTempo(TheTransport->GetTempo() / 2);
707 mBaseTempo = TheTransport->GetTempo();
708 float pos = TheTransport->GetMeasurePos(time) + (TheTransport->GetMeasure(time) % 8);
709 int count = TheTransport->GetMeasure(time) - int(pos);
710 pos /= 2;
711 count += int(pos);
712 pos -= int(pos);
713 TheTransport->SetMeasureTime(count + pos);
714 for (int i = 0; i < mLoopers.size(); ++i)
715 {
716 if (mLoopers[i])
717 mLoopers[i]->ResampleForSpeed(1);
718 }
719 }
720
721 if (button == mShiftMeasureButton)
722 {

Callers

nothing calls this directly

Calls 15

FloatWrapFunction · 0.85
SetRootMethod · 0.80
sizeMethod · 0.80
DoubleNumBarsMethod · 0.80
SetTempoMethod · 0.80
GetMeasureMethod · 0.80
SetMeasureTimeMethod · 0.80
ResampleForSpeedMethod · 0.80
HalveNumBarsMethod · 0.80
ShiftMeasureMethod · 0.80
SetMeasureMethod · 0.80
HalfShiftMethod · 0.80

Tested by

no test coverage detected