| 1142 | } |
| 1143 | |
| 1144 | void StepSequencerRow::Draw(float x, float y) |
| 1145 | { |
| 1146 | float xCellSize = float(mGrid->GetWidth()) / mGrid->GetCols(); |
| 1147 | float yCellSize = float(mGrid->GetHeight()) / mGrid->GetRows(); |
| 1148 | |
| 1149 | bool showTextEntry = yCellSize > 14; |
| 1150 | mRowPitchEntry->SetShowing(showTextEntry); |
| 1151 | mRowPitchEntry->SetPosition(x - 32, y); |
| 1152 | mRowPitchEntry->Draw(); |
| 1153 | |
| 1154 | if (!showTextEntry) |
| 1155 | DrawTextRightJustify(ofToString(mRowPitch), x - 7, y + 10); |
| 1156 | |
| 1157 | const float kPlayHighlightDurationMs = 250; |
| 1158 | for (size_t i = 0; i < mPlayedSteps.size(); ++i) |
| 1159 | { |
| 1160 | if (mPlayedSteps[i].time != -1) |
| 1161 | { |
| 1162 | if (gTime - mPlayedSteps[i].time < kPlayHighlightDurationMs) |
| 1163 | { |
| 1164 | if (gTime - mPlayedSteps[i].time > 0) |
| 1165 | { |
| 1166 | float fade = (1 - (gTime - mPlayedSteps[i].time) / kPlayHighlightDurationMs); |
| 1167 | ofPushStyle(); |
| 1168 | ofSetLineWidth(3 * fade); |
| 1169 | ofVec2f pos = mGrid->GetCellPosition(mPlayedSteps[i].step, mRow) + mGrid->GetPosition(true); |
| 1170 | ofSetColor(ofColor::white, fade * 255); |
| 1171 | ofRect(pos.x, pos.y, xCellSize, yCellSize); |
| 1172 | ofPopStyle(); |
| 1173 | } |
| 1174 | } |
| 1175 | else |
| 1176 | { |
| 1177 | mPlayedSteps[i].time = -1; |
| 1178 | } |
| 1179 | } |
| 1180 | } |
| 1181 | } |
| 1182 | |
| 1183 | NoteRepeat::NoteRepeat(StepSequencer* seq, int row) |
| 1184 | : mSeq(seq) |
no test coverage detected