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

Method OnGridButton

Source/GridSliders.cpp:111–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111void GridSliders::OnGridButton(int x, int y, float velocity, IGridController* grid)
112{
113 if (velocity > 0)
114 {
115 int sliderIndex, squareIndex, length;
116 if (mDirection == Direction::kVertical)
117 {
118 sliderIndex = x;
119 squareIndex = grid->NumRows() - y - 1;
120 length = mGridControlTarget->GetGridController()->NumRows();
121 }
122 else
123 {
124 sliderIndex = y;
125 squareIndex = x;
126 length = mGridControlTarget->GetGridController()->NumCols();
127 }
128
129 if (sliderIndex < mControlCables.size() && mControlCables[sliderIndex]->GetTarget())
130 {
131 float value = squareIndex / float(length - 1);
132 for (auto& cable : mControlCables[sliderIndex]->GetPatchCables())
133 dynamic_cast<IUIControl*>(cable->GetTarget())->SetFromMidiCC(value, NextBufferTime(false), false);
134 }
135 }
136}
137
138void GridSliders::DrawModule()
139{

Callers

nothing calls this directly

Calls 7

NextBufferTimeFunction · 0.85
GetGridControllerMethod · 0.80
sizeMethod · 0.80
NumRowsMethod · 0.45
NumColsMethod · 0.45
GetTargetMethod · 0.45
SetFromMidiCCMethod · 0.45

Tested by

no test coverage detected