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

Method ButtonClicked

Source/StepSequencer.cpp:868–896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

866}
867
868void StepSequencer::ButtonClicked(ClickButton* button, double time)
869{
870 if (button == mShiftLeftButton || button == mShiftRightButton)
871 {
872 int shift = (button == mShiftRightButton) ? 1 : -1;
873
874 for (int row = 0; row < mGrid->GetRows(); ++row)
875 {
876 int start = (shift == 1) ? mGrid->GetCols() - 1 : 0;
877 int end = (shift == 1) ? 0 : mGrid->GetCols() - 1;
878 float startVal = mGrid->GetVal(start, row);
879 for (int col = start; col != end; col -= shift)
880 mGrid->SetVal(col, row, mGrid->GetVal(col - shift, row));
881 mGrid->SetVal(end, row, startVal);
882 }
883 }
884 if (button == mRandomizeButton)
885 {
886 for (int row = 0; row < mGrid->GetRows(); ++row)
887 RandomizeRow(row);
888 }
889 for (int row = 0; row < mRandomizeRowButton.size(); ++row)
890 {
891 if (button == mRandomizeRowButton[row])
892 RandomizeRow(row);
893 }
894 if (button == mClearButton)
895 mGrid->Clear();
896}
897
898void StepSequencer::DropdownUpdated(DropdownList* list, int oldVal, double time)
899{

Callers

nothing calls this directly

Calls 6

GetValMethod · 0.80
SetValMethod · 0.80
sizeMethod · 0.80
GetRowsMethod · 0.45
GetColsMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected