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

Method IntSliderUpdated

Source/NoteStepSequencer.cpp:1331–1366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1329}
1330
1331void NoteStepSequencer::IntSliderUpdated(IntSlider* slider, int oldVal, double time)
1332{
1333 if (slider == mLoopResetPointSlider || slider == mLengthSlider)
1334 mLoopResetPoint = MIN(mLoopResetPoint, mLength - 1);
1335 if (slider == mLengthSlider)
1336 {
1337 mLength = MIN(mLength, NSS_MAX_STEPS);
1338
1339 if (mLength > oldVal)
1340 {
1341 //slice the loop into the nearest power of 2 and loop new steps from there
1342 int oldLengthPow2 = std::max(1, MathUtils::HighestPow2(oldVal));
1343 for (int i = oldVal; i < mLength; ++i)
1344 {
1345 int loopedFrom = i % oldLengthPow2;
1346 mTones[i] = mTones[loopedFrom];
1347 mVels[i] = mVels[loopedFrom];
1348 mNoteLengths[i] = mNoteLengths[loopedFrom];
1349 }
1350 }
1351
1352 mGrid->SetGrid(mLength, mNoteRange);
1353 mVelocityGrid->SetGrid(mLength, 1);
1354 mLoopResetPointSlider->SetExtents(0, mLength);
1355 SyncGridToSeq();
1356 }
1357 if (slider == mOctaveSlider)
1358 SetUpStepControls();
1359 for (int i = 0; i < NSS_MAX_STEPS; ++i)
1360 {
1361 if (slider == mVelocitySliders[i])
1362 SyncGridToSeq();
1363 }
1364 if (slider == mGridControlOffsetXSlider || slider == mGridControlOffsetYSlider)
1365 UpdateGridControllerLights(false);
1366}
1367
1368void NoteStepSequencer::KeyPressed(int key, bool isRepeat)
1369{

Callers

nothing calls this directly

Calls 3

HighestPow2Function · 0.85
SetGridMethod · 0.45
SetExtentsMethod · 0.45

Tested by

no test coverage detected