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

Method UpdatePush2Leds

Source/NoteStepSequencer.cpp:709–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

707}
708
709void NoteStepSequencer::UpdatePush2Leds(Push2Control* push2)
710{
711 int sequenceRows, pitchCols, pitchRows;
712 GetPush2Layout(sequenceRows, pitchCols, pitchRows);
713
714 int displayStep = std::clamp(mArpIndex, 0, mLength - 1);
715 if (mPush2HeldStep != -1)
716 displayStep = mPush2HeldStep;
717
718 for (int x = 0; x < 8; ++x)
719 {
720 for (int y = 0; y < 8; ++y)
721 {
722 int pushColor = 0;
723
724 if (mPush2GridDisplayMode == Push2GridDisplayMode::PerStep)
725 {
726 if (y < sequenceRows)
727 {
728 int index = x + y * 8;
729 if (index >= mLength)
730 pushColor = 0;
731 else if (index == mPush2HeldStep)
732 pushColor = 125;
733 else if (index == displayStep)
734 pushColor = 101;
735 else if (mVels[index] > 0)
736 pushColor = mNoteLengths[index] == 1 ? 93 : 95;
737 else
738 pushColor = 92;
739 }
740 else if (y < sequenceRows + pitchRows)
741 {
742 int index = x + (pitchRows - 1 - (y - sequenceRows)) * pitchCols;
743 int pitch = RowToPitch(index);
744 if (x >= pitchCols || index < 0 || index >= mNoteRange)
745 pushColor = mQueuedPush2Tone == -2 ? 126 : 0;
746 else if (index == mQueuedPush2Tone)
747 pushColor = 126;
748 else if (index == mTones[displayStep] && ((mVels[displayStep] > 0 && !mAlreadyDidNoteOff) || mPush2HeldStep != -1))
749 pushColor = gTime - mLastStepPlayTime[displayStep] < 100 ? 127 : 2;
750 else if (TheScale->IsRoot(pitch))
751 pushColor = 69;
752 else if (TheScale->IsInPentatonic(pitch))
753 pushColor = 77;
754 else
755 pushColor = 78;
756 }
757 else if (y == 7)
758 {
759 float displayLength = 0;
760 if (mPush2LengthHeld && mPush2HeldStep == -1)
761 displayLength = mQueuedPush2Length;
762 else if (mVels[displayStep] > 0)
763 displayLength = mNoteLengths[displayStep];
764
765 if (displayLength * 8 - 1 >= x)
766 pushColor = 83;

Callers

nothing calls this directly

Calls 8

NextBufferTimeFunction · 0.85
IsRootMethod · 0.80
IsInPentatonicMethod · 0.80
SetLedMethod · 0.80
GetDeviceMethod · 0.80
GetHighlightColMethod · 0.45
SendSysExMethod · 0.45

Tested by

no test coverage detected