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

Method OnTimeEvent

Source/PlaySequencer.cpp:217–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217void 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
274void PlaySequencer::NoteOffScheduler::OnTimeEvent(double time)

Callers

nothing calls this directly

Calls 6

sizeMethod · 0.80
GetValMethod · 0.80
SetValMethod · 0.80
PlayNoteOutputMethod · 0.80
SetHighlightColMethod · 0.45
UpdateLightsMethod · 0.45

Tested by

no test coverage detected