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

Method UpdatePush2Leds

Source/NoteTable.cpp:591–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

589}
590
591void NoteTable::UpdatePush2Leds(Push2Control* push2)
592{
593 int sequenceRows, pitchCols, pitchRows;
594 GetPush2Layout(sequenceRows, pitchCols, pitchRows);
595
596 for (int x = 0; x < 8; ++x)
597 {
598 for (int y = 0; y < 8; ++y)
599 {
600 int pushColor = 0;
601
602 if (mPush2GridDisplayMode == Push2GridDisplayMode::PerStep)
603 {
604 if (y < sequenceRows)
605 {
606 int index = x + y * 8;
607 if (index >= mLength)
608 pushColor = 0;
609 else if (index == mPush2HeldStep)
610 pushColor = 125;
611 else if (mLastColumnPlayTime[index] != -1)
612 pushColor = 101;
613 else
614 pushColor = 93;
615 }
616 else if (y < sequenceRows + pitchRows)
617 {
618 int index = x + (pitchRows - 1 - (y - sequenceRows)) * pitchCols;
619 int pitch = RowToPitch(index);
620 if (x >= pitchCols || index >= mNoteRange)
621 pushColor = 0;
622 else if (mPush2HeldStep != -1 && mGrid->GetVal(mPush2HeldStep, index) > 0)
623 pushColor = 127;
624 else if (mPush2HeldStep == -1 && mNoteOutput.GetNotes()[pitch])
625 pushColor = gTime - mPitchPlayTimes[pitch] < 100 ? 127 : 2;
626 else if (mQueuedPitches[pitch])
627 pushColor = 126;
628 else if (TheScale->IsRoot(pitch))
629 pushColor = 69;
630 else if (TheScale->IsInPentatonic(pitch))
631 pushColor = 77;
632 else
633 pushColor = 78;
634 }
635 }
636 else if (mPush2GridDisplayMode == Push2GridDisplayMode::GridView)
637 {
638 int column = x + mGridControlOffsetX;
639 int row = (7 - y) + mGridControlOffsetY;
640
641 if (column >= 0 && column < mLength && row >= 0 && row < mNoteRange)
642 {
643 bool isHighlightCol = mLastColumnPlayTime[column] != -1;
644 int pitch = RowToPitch(row);
645 if (isHighlightCol && mPush2HeldStep == -1 && mNoteOutput.GetNotes()[pitch])
646 pushColor = gTime - mPitchPlayTimes[pitch] < 100 ? 127 : 2;
647 else if (mGrid->GetVal(column, row) > 0)
648 pushColor = 125;

Callers

nothing calls this directly

Calls 6

GetValMethod · 0.80
GetNotesMethod · 0.80
IsRootMethod · 0.80
IsInPentatonicMethod · 0.80
SetLedMethod · 0.80

Tested by

no test coverage detected