@@ -14,34 +14,49 @@ bool SequencerControlBar::KeyEvent(Point xy, KeyInfo *keyInfo)
1414{
1515 bool stepSelected = !sequencer->stepSelected .empty ();
1616 bool patternSelected = !sequencer->patternSelected .empty ();
17+ bool sequencerShift = sequencer->currentView == Sequencer::ViewMode::Sequencer && (sequencer->ShiftActive () && ((MatrixOS::SYS::Millis () - sequencer->shiftOnTime ) > 150 ));
1718
18-
19- if (stepSelected)
19+ if (sequencerShift)
2020 {
2121 switch (xy.x )
2222 {
2323 case 0 :
24- return HandleStepOctaveOffsetKey ( false , keyInfo);
24+ return HandlePlayKey ( keyInfo);
2525 case 1 :
26- return HandleStepOctaveOffsetKey (true , keyInfo);
2726 case 2 :
28- return HandleQuantizeKey (keyInfo);
2927 case 3 :
28+ case 4 :
29+ return true ;
30+ case 5 :
3031 return HandleTwoPatternToggleKey (keyInfo);
3132 }
3233 }
33- else if (patternSelected )
34+ else if (stepSelected )
3435 {
3536 switch (xy.x )
3637 {
3738 case 0 :
38- return HandleOctaveOffsetKey ( false , keyInfo);
39+ return HandlePlayKey ( keyInfo);
3940 case 1 :
40- return HandleOctaveOffsetKey ( true , keyInfo);
41+ return HandleQuantizeKey ( keyInfo);
4142 case 2 :
42- return HandleNudgeKey (false , keyInfo);
43+ return HandleStepOctaveOffsetKey (false , keyInfo);
4344 case 3 :
45+ return HandleStepOctaveOffsetKey (true , keyInfo);
46+ }
47+ }
48+ else if (patternSelected)
49+ {
50+ switch (xy.x )
51+ {
52+ case 0 :
53+ return HandleNudgeKey (false , keyInfo);
54+ case 1 :
4455 return HandleNudgeKey (true , keyInfo);
56+ case 2 :
57+ return HandleOctaveOffsetKey (false , keyInfo);
58+ case 3 :
59+ return HandleOctaveOffsetKey (true , keyInfo);
4560 }
4661 }
4762
@@ -688,8 +703,7 @@ bool SequencerControlBar::Render(Point origin)
688703
689704 if (stepSelected == false )
690705 {
691- if (sequencer->lastMessage == SequencerMessage::QUANTIZE ||
692- sequencer->lastMessage == SequencerMessage::TWO_PATTERN_VIEW)
706+ if (sequencer->lastMessage == SequencerMessage::QUANTIZE)
693707 {
694708 sequencer->SetMessage (SequencerMessage::NONE);
695709 }
@@ -702,6 +716,10 @@ bool SequencerControlBar::Render(Point origin)
702716 sequencer->SetMessage (SequencerMessage::NONE);
703717 }
704718 }
719+ else if (sequencer->lastMessage == SequencerMessage::PLAY)
720+ {
721+ sequencer->SetMessage (SequencerMessage::NONE);
722+ }
705723
706724 if (stepSelected == false && patternSelected == false )
707725 {
@@ -713,151 +731,180 @@ bool SequencerControlBar::Render(Point origin)
713731 }
714732 }
715733
734+ if (stepSelected || patternSelected)
735+ {
736+ if (sequencer->lastMessage == SequencerMessage::RECORD ||
737+ sequencer->lastMessage == SequencerMessage::MIX ||
738+ sequencer->lastMessage == SequencerMessage::CLIP)
739+ {
740+ sequencer->SetMessage (SequencerMessage::NONE);
741+ }
742+ }
743+
744+ uint8_t barRenderMask = 0b11111111 ;
745+
746+ bool sequencerShift = sequencer->currentView == Sequencer::ViewMode::Sequencer && (sequencer->ShiftActive () && ((MatrixOS::SYS::Millis () - sequencer->shiftOnTime ) > 150 ));
747+
716748 // Left 4 - Floating UI
717- if (stepSelected) // Step Specific
718- {
719- // Octave Up
749+ if (sequencerShift) // Track specific?
750+ {
751+ barRenderMask = 0b10000011 ;
752+
753+ // 2 Pattern View
720754 {
721- Point point = origin + Point (0 , 0 );
722- Color color = MatrixOS::KeyPad::GetKey (point)->Active () ? Color::White : Color (0xFF0040 );
755+ Point point = origin + Point (5 , 0 );
756+ uint8_t track = sequencer->track ;
757+ bool twoPatternMode = sequencer->meta .tracks [track].twoPatternMode ;
758+ Color color = MatrixOS::KeyPad::GetKey (point)->Active () ? Color::White : Color (0xFFFF00 ).DimIfNot (twoPatternMode);
723759 MatrixOS::LED::SetColor (point, color);
724760 }
725- // Octave Down
761+ }
762+ else if (stepSelected) // Step Specific
763+ {
764+ barRenderMask = 0b10001111 ;
765+ // Quantize
726766 {
727767 Point point = origin + Point (1 , 0 );
728- Color color = MatrixOS::KeyPad::GetKey (point)->Active () ? Color::White : Color (0xFF0040 );
768+ Color color = MatrixOS::KeyPad::GetKey (point)->Active () ? Color::White : Color (0xFFFF00 );
729769 MatrixOS::LED::SetColor (point, color);
730770 }
731- // Quantize
771+ // Octave Up
732772 {
733773 Point point = origin + Point (2 , 0 );
734- Color color = MatrixOS::KeyPad::GetKey (point)->Active () ? Color::White : Color (0x00FF40 );
774+ Color color = MatrixOS::KeyPad::GetKey (point)->Active () ? Color::White : Color (0xA000FF );
735775 MatrixOS::LED::SetColor (point, color);
736776 }
737- // 2 Pattern View
777+ // Octave Down
738778 {
739779 Point point = origin + Point (3 , 0 );
740- uint8_t track = sequencer->track ;
741- bool twoPatternMode = sequencer->meta .tracks [track].twoPatternMode ;
742- Color color = MatrixOS::KeyPad::GetKey (point)->Active () ? Color::White : Color (0xFFFF00 ).DimIfNot (twoPatternMode);
780+ Color color = MatrixOS::KeyPad::GetKey (point)->Active () ? Color::White : Color (0xA000FF );
743781 MatrixOS::LED::SetColor (point, color);
744782 }
745783 }
746784 else if (patternSelected) // Pattern Specific
747785 {
748- // Octave Up
786+ barRenderMask = 0b00001111 ;
787+ // Nudge Left
749788 {
750789 Point point = origin + Point (0 , 0 );
751- Color color = MatrixOS::KeyPad::GetKey (point)->Active () ? Color::White : Color (0xFF0040 );
790+ Color color = Color (0xFF0040 );
791+ if (sequencer->sequence .Playing (sequencer->track )) {color = Color (0xFF0040 ).Dim ();}
792+ else if (MatrixOS::KeyPad::GetKey (point)->Active ()) {color = Color::White;}
752793 MatrixOS::LED::SetColor (point, color);
753794 }
754- // Octave Down
795+ // Nudge Right
755796 {
756797 Point point = origin + Point (1 , 0 );
757- Color color = MatrixOS::KeyPad::GetKey (point)->Active () ? Color::White : Color (0xFF0040 );
798+ Color color = Color (0xFF0040 );
799+ if (sequencer->sequence .Playing (sequencer->track )) {color = Color (0xFF0040 ).Dim ();}
800+ else if (MatrixOS::KeyPad::GetKey (point)->Active ()) {color = Color::White;}
758801 MatrixOS::LED::SetColor (point, color);
759802 }
760- // Nudge Left
803+ // Octave Up
761804 {
762805 Point point = origin + Point (2 , 0 );
763- Color color = Color (0xA000FF );
764- if (sequencer->sequence .Playing (sequencer->track )) {color = Color (0xA000FF ).Dim ();}
765- else if (MatrixOS::KeyPad::GetKey (point)->Active ()) {color = Color::White;}
806+ Color color = MatrixOS::KeyPad::GetKey (point)->Active () ? Color::White : Color (0xA000FF );
766807 MatrixOS::LED::SetColor (point, color);
767808 }
768- // Nudge Right
809+ // Octave Down
769810 {
770811 Point point = origin + Point (3 , 0 );
771- Color color = Color (0xA000FF );
772- if (sequencer->sequence .Playing (sequencer->track )) {color = Color (0xA000FF ).Dim ();}
773- else if (MatrixOS::KeyPad::GetKey (point)->Active ()) {color = Color::White;}
812+ Color color = MatrixOS::KeyPad::GetKey (point)->Active () ? Color::White : Color (0xA000FF );
774813 MatrixOS::LED::SetColor (point, color);
775814 }
776815 }
777- else // General
816+
817+ // Left 4 General Bar
818+ // Play
819+ if (barRenderMask & 0b10000000 )
778820 {
779- // Play
821+ Point point = origin + Point (0 , 0 );
822+ if (sequencer->sequence .Playing () == false && sequencer->stepSelected .size () > 1 )
780823 {
781- Point point = origin + Point (0 , 0 );
782- if (MatrixOS::KeyPad::GetKey (point)->Active ())
783- {
784- MatrixOS::LED::SetColor (point, Color::White);
785- }
786- else if (sequencer->sequence .Playing ())
787- {
788- uint8_t scale = breathingScale / 4 * 3 ;
789- MatrixOS::LED::SetColor (point, Color::Crossfade (Color::Green, Color::White, Fract16 (scale, 8 )));
790- }
791- else
792- {
793- MatrixOS::LED::SetColor (point, Color::Green);
794- }
824+ MatrixOS::LED::SetColor (point, Color::Green.Dim ());
825+ }
826+ else if (MatrixOS::KeyPad::GetKey (point)->Active ())
827+ {
828+ MatrixOS::LED::SetColor (point, Color::White);
795829 }
830+ else if (sequencer->sequence .Playing ())
831+ {
832+ uint8_t scale = breathingScale / 4 * 3 ;
833+ MatrixOS::LED::SetColor (point, Color::Crossfade (Color::Green, Color::White, Fract16 (scale, 8 )));
834+ }
835+ else
836+ {
837+ MatrixOS::LED::SetColor (point, Color::Green);
838+ }
839+ }
796840
797- // Record
841+ // Record
842+ if (barRenderMask & 0b01000000 )
843+ {
844+ Point point = origin + Point (1 , 0 );
845+ if (MatrixOS::KeyPad::GetKey (point)->Active ())
798846 {
799- Point point = origin + Point (1 , 0 );
800- if (MatrixOS::KeyPad::GetKey (point)->Active ())
801- {
802- MatrixOS::LED::SetColor (point, Color::White);
803- }
804- else if (sequencer->ClearActive ())
805- {
806- // Undo record
807- MatrixOS::LED::SetColor (point, Color (0xFF0020 ).DimIfNot (sequencer->sequence .CanUndoLastRecord () && !sequencer->sequence .Playing ()));
808- }
809- else if (sequencer->sequence .RecordEnabled ())
810- {
811- uint8_t scale = breathingScale / 4 * 3 + 64 ;
812- MatrixOS::LED::SetColor (point, Color::Red.Scale (scale));
813- }
814- else
815- {
816- MatrixOS::LED::SetColor (point, Color::Red);
817- }
847+ MatrixOS::LED::SetColor (point, Color::White);
818848 }
849+ else if (sequencer->ClearActive ())
850+ {
851+ // Undo record
852+ MatrixOS::LED::SetColor (point, Color (0xFF0020 ).DimIfNot (sequencer->sequence .CanUndoLastRecord () && !sequencer->sequence .Playing ()));
853+ }
854+ else if (sequencer->sequence .RecordEnabled ())
855+ {
856+ uint8_t scale = breathingScale / 4 * 3 + 64 ;
857+ MatrixOS::LED::SetColor (point, Color::Red.Scale (scale));
858+ }
859+ else
860+ {
861+ MatrixOS::LED::SetColor (point, Color::Red);
862+ }
863+ }
819864
820- // Session View
865+ // Session View
866+ if (barRenderMask & 0b00100000 )
867+ {
868+ Point point = origin + Point (2 , 0 );
869+ Color color;
870+ if (MatrixOS::KeyPad::GetKey (point)->Active ())
821871 {
822- Point point = origin + Point (2 , 0 );
823- Color color;
824- if (MatrixOS::KeyPad::GetKey (point)->Active ())
825- {
826- color = Color::White;
827- }
828- else if (sequencer->currentView == Sequencer::ViewMode::Session)
829- {
830- color = Color (0xFFFFB3 );
831- }
832- else
833- {
834- color = Color (0xFFFF00 );
835- }
836- MatrixOS::LED::SetColor (point, color);
872+ color = Color::White;
873+ }
874+ else if (sequencer->currentView == Sequencer::ViewMode::Session)
875+ {
876+ color = Color (0xFFFFB3 );
877+ }
878+ else
879+ {
880+ color = Color (0xFFFF00 );
837881 }
882+ MatrixOS::LED::SetColor (point, color);
883+ }
838884
839- // Mixer View
885+ // Mixer View
886+ if (barRenderMask & 0b00010000 )
887+ {
888+ Point point = origin + Point (3 , 0 );
889+ Color color;
890+ if (MatrixOS::KeyPad::GetKey (point)->Active ())
840891 {
841- Point point = origin + Point (3 , 0 );
842- Color color;
843- if (MatrixOS::KeyPad::GetKey (point)->Active ())
844- {
845- color = Color::White;
846- }
847- else if (sequencer->currentView == Sequencer::ViewMode::Mixer)
848- {
849- color = Color (0xC6FFB3 );
850- }
851- else
852- {
853- color = Color (0x40FF00 );
854- }
855- MatrixOS::LED::SetColor (point, color);
892+ color = Color::White;
893+ }
894+ else if (sequencer->currentView == Sequencer::ViewMode::Mixer)
895+ {
896+ color = Color (0xC6FFB3 );
856897 }
898+ else
899+ {
900+ color = Color (0x40FF00 );
901+ }
902+ MatrixOS::LED::SetColor (point, color);
857903 }
858904
859905 // Right 4 - Constent UI
860906 // Clear
907+ if (barRenderMask & 0b00001000 )
861908 {
862909 Point point = origin + Point (4 , 0 );
863910 Color color;
@@ -873,6 +920,7 @@ bool SequencerControlBar::Render(Point origin)
873920 }
874921
875922 // Copy
923+ if (barRenderMask & 0b00000100 )
876924 {
877925 Point point = origin + Point (5 , 0 );
878926 Color color;
0 commit comments