| 215 | } |
| 216 | |
| 217 | void PlaySequencer::OnTimeEvent(double time) |
| 218 | { |
| 219 | if (!mEnabled) |
| 220 | return; |
| 221 | |
| 222 | int step = GetStep(time); |
| 223 | |
| 224 | mGrid->SetHighlightCol(time, step); |
| 225 | |
| 226 | for (int i = 0; i < (int)mLanes.size(); ++i) |
| 227 | { |
| 228 | float gridVal = mGrid->GetVal(step, i); |
| 229 | int playVelocity = (int)(gridVal * 127); |
| 230 | |
| 231 | if (mLanes[i].mMuteOrErase) |
| 232 | { |
| 233 | playVelocity = 0; |
| 234 | if (mWrite) |
| 235 | mGrid->SetVal(step, i, 0); |
| 236 | } |
| 237 | |
| 238 | if (mLanes[i].mInputVelocity > 0) |
| 239 | { |
| 240 | float velMult; |
| 241 | switch (GetVelocityLevel()) |
| 242 | { |
| 243 | case 1: velMult = mVelocityLight; break; |
| 244 | case 2: velMult = mVelocityMed; break; |
| 245 | default: |
| 246 | case 3: velMult = mVelocityFull; break; |
| 247 | } |
| 248 | playVelocity = mLanes[i].mInputVelocity * velMult; |
| 249 | if (mWrite) |
| 250 | mGrid->SetVal(step, i, playVelocity / 127.0f); |
| 251 | if (!mNoteRepeat) |
| 252 | mLanes[i].mInputVelocity = 0; |
| 253 | } |
| 254 | |
| 255 | if (playVelocity > 0 && mLanes[i].mIsPlaying == false) |
| 256 | { |
| 257 | PlayNoteOutput(time, i, playVelocity); |
| 258 | mLanes[i].mIsPlaying = true; |
| 259 | } |
| 260 | |
| 261 | if (mSustain) |
| 262 | { |
| 263 | if (mLanes[i].mIsPlaying && playVelocity == 0) |
| 264 | { |
| 265 | PlayNoteOutput(time, i, 0); |
| 266 | mLanes[i].mIsPlaying = false; |
| 267 | } |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | UpdateLights(); |
| 272 | } |
| 273 | |
| 274 | void PlaySequencer::NoteOffScheduler::OnTimeEvent(double time) |
nothing calls this directly
no test coverage detected