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

Method Poll

Source/GridSliders.cpp:63–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63void GridSliders::Poll()
64{
65 if (mGridControlTarget->GetGridController())
66 {
67 int length;
68 if (mDirection == Direction::kVertical)
69 length = mGridControlTarget->GetGridController()->NumRows();
70 else
71 length = mGridControlTarget->GetGridController()->NumCols();
72
73 for (int i = 0; i < (int)mControlCables.size(); ++i)
74 {
75 GridColor color = GridColor::kGridColorOff;
76
77 float value = 0;
78 if (mControlCables[i]->GetTarget())
79 value = dynamic_cast<IUIControl*>(mControlCables[i]->GetTarget())->GetMidiValue();
80
81 for (int j = 0; j < length; ++j)
82 {
83 float squareValue = j / float(length - 1);
84 if (squareValue <= value + .01f)
85 color = GridColor::kGridColor1Bright;
86 else
87 color = GridColor::kGridColorOff;
88
89 int row, col;
90 if (mDirection == Direction::kVertical)
91 {
92 row = length - j - 1;
93 col = i;
94 }
95 else
96 {
97 row = i;
98 col = j;
99 }
100
101 mGridControlTarget->GetGridController()->SetLight(col, row, color);
102 }
103 }
104 }
105}
106
107void GridSliders::OnControllerPageSelected()
108{

Callers

nothing calls this directly

Calls 7

GetGridControllerMethod · 0.80
sizeMethod · 0.80
NumRowsMethod · 0.45
NumColsMethod · 0.45
GetTargetMethod · 0.45
GetMidiValueMethod · 0.45
SetLightMethod · 0.45

Tested by

no test coverage detected