| 61 | } |
| 62 | |
| 63 | void 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 | |
| 107 | void GridSliders::OnControllerPageSelected() |
| 108 | { |
nothing calls this directly
no test coverage detected