2323import de .mossgrabers .controller .ni .maschine .mk3 .command .trigger .AddDeviceCommand ;
2424import de .mossgrabers .controller .ni .maschine .mk3 .command .trigger .KeyboardCommand ;
2525import de .mossgrabers .controller .ni .maschine .mk3 .command .trigger .MaschineCursorCommand ;
26+ import de .mossgrabers .controller .ni .maschine .mk3 .command .trigger .MaschineEncoderPressCommand ;
27+ import de .mossgrabers .controller .ni .maschine .mk3 .command .trigger .MaschineMk2PlayViewSwitchCommand ;
2628import de .mossgrabers .controller .ni .maschine .mk3 .command .trigger .MaschineSelectButtonCommand ;
2729import de .mossgrabers .controller .ni .maschine .mk3 .command .trigger .MaschineSendSelectCommand ;
2830import de .mossgrabers .controller .ni .maschine .mk3 .command .trigger .MaschineStopCommand ;
31+ import de .mossgrabers .controller .ni .maschine .mk3 .command .trigger .MaschineTapMetroCommand ;
2932import de .mossgrabers .controller .ni .maschine .mk3 .command .trigger .PadModeCommand ;
3033import de .mossgrabers .controller .ni .maschine .mk3 .command .trigger .PageCommand ;
3134import de .mossgrabers .controller .ni .maschine .mk3 .command .trigger .ProjectButtonCommand ;
8285import de .mossgrabers .framework .command .trigger .transport .ConfiguredRecordCommand ;
8386import de .mossgrabers .framework .command .trigger .transport .MetronomeCommand ;
8487import de .mossgrabers .framework .command .trigger .transport .PlayCommand ;
85- import de .mossgrabers .framework .command .trigger .transport .TapTempoCommand ;
8688import de .mossgrabers .framework .command .trigger .transport .ToggleLoopCommand ;
8789import de .mossgrabers .framework .command .trigger .view .ToggleShiftViewCommand ;
8890import de .mossgrabers .framework .command .trigger .view .ViewMultiSelectCommand ;
@@ -157,7 +159,7 @@ public class MaschineControllerSetup extends AbstractControllerSetup<MaschineCon
157159 * @param factory The factory
158160 * @param globalSettings The global settings
159161 * @param documentSettings The document (project) specific settings
160- * @param maschine The specific maschine model
162+ * @param maschine The specific Maschine model
161163 */
162164 public MaschineControllerSetup (final IHost host , final ISetupFactory factory , final ISettingsUI globalSettings , final ISettingsUI documentSettings , final Maschine maschine )
163165 {
@@ -313,6 +315,7 @@ protected void registerTriggerCommands ()
313315 final ModeManager modeManager = surface .getModeManager ();
314316 final ViewManager viewManager = surface .getViewManager ();
315317 final ITransport t = this .model .getTransport ();
318+ this .mainKnobCommand = new MainKnobRowModeCommand (this .model , surface );
316319
317320 this .addButton (ButtonID .SHIFT , "SHIFT" , new ToggleShiftViewCommand <> (this .model , surface ), this .maschine == Maschine .STUDIO ? MaschineControlSurface .NAVIGATE_BACK : -1 , () -> viewManager .isActive (Views .SHIFT ) || surface .isShiftPressed ());
318321
@@ -324,19 +327,7 @@ protected void registerTriggerCommands ()
324327 this .addButton (ButtonID .STOP , "STOP" , new MaschineStopCommand (this .model , surface ), MaschineControlSurface .STOP , () -> !t .isPlaying ());
325328 this .addButton (ButtonID .LOOP , "LOOP" , new ToggleLoopCommand <> (this .model , surface ), MaschineControlSurface .RESTART , t ::isLoop );
326329 this .addButton (ButtonID .DELETE , "ERASE" , NopCommand .INSTANCE , MaschineControlSurface .ERASE );
327- final MetronomeCommand <MaschineControlSurface , MaschineConfiguration > metroCommand = new MetronomeCommand <> (this .model , surface , false );
328- final TapTempoCommand <MaschineControlSurface , MaschineConfiguration > tapTempoCommand = new TapTempoCommand <> (this .model , surface );
329- this .addButton (ButtonID .TAP_TEMPO , "TAP/METRO" , (event , velocity ) -> {
330- if (event != ButtonEvent .UP )
331- return ;
332- if (surface .isShiftPressed ())
333- {
334- surface .setStopConsumed ();
335- metroCommand .executeNormal (event );
336- }
337- else
338- tapTempoCommand .execute (ButtonEvent .DOWN , velocity );
339- }, MaschineControlSurface .TAP_METRO , t ::isMetronomeOn );
330+ this .addButton (ButtonID .TAP_TEMPO , "TAP/METRO" , new MaschineTapMetroCommand (this .model , surface ), MaschineControlSurface .TAP_METRO , t ::isMetronomeOn );
340331
341332 this .addButton (ButtonID .FLIP , this .maschine == Maschine .STUDIO || this .maschine == Maschine .MK2 ? "GRID" : "FOLLOW" , (event , velocity ) -> {
342333 if (event != ButtonEvent .UP )
@@ -373,24 +364,7 @@ protected void shiftedFunction ()
373364 this .addButton (ButtonID .F2 , "MOD" , new RibbonCommand (this .model , surface , RIBBON_MODES_CC ), MaschineControlSurface .MOD , () -> this .isRibbonMode (new HashSet <> (RIBBON_MODES_CC )));
374365 this .addButton (ButtonID .F3 , "PERFORM" , new RibbonCommand (this .model , surface , RIBBON_MODES_MASTER_VOLUME ), MaschineControlSurface .PERFORM , () -> this .isRibbonMode (new HashSet <> (RIBBON_MODES_MASTER_VOLUME )));
375366 this .addButton (ButtonID .F4 , "NOTES" , new RibbonCommand (this .model , surface , RIBBON_MODES_NOTE_REPEAT ), MaschineControlSurface .NOTES , () -> this .isRibbonMode (new HashSet <> (RIBBON_MODES_NOTE_REPEAT )));
376-
377- this .addButton (ButtonID .FADER_TOUCH_1 , "ENCODER PRESS" , (event , velocity ) -> {
378-
379- if (event != ButtonEvent .DOWN )
380- return ;
381-
382- if (modeManager .getActiveID () == Modes .BROWSER )
383- {
384- this .model .getBrowser ().stopBrowsing (true );
385- modeManager .restore ();
386- }
387- else
388- {
389- this .mainKnobCommand .toggleControlLastParamActive ();
390- surface .getDisplay ().notify ("Last Param: " + (this .mainKnobCommand .isControlLastParamActive () ? " ON" : "OFF" ));
391- }
392-
393- }, MaschineControlSurface .ENCODER_PUSH );
367+ this .addButton (ButtonID .FADER_TOUCH_1 , "ENCODER PRESS" , new MaschineEncoderPressCommand (this .model , surface , this .mainKnobCommand ), MaschineControlSurface .ENCODER_PUSH );
394368
395369 // Encoder Modes
396370 this .addButton (ButtonID .VOLUME , "VOLUME" , new VolumePanSendCommand (this .model , surface ), MaschineControlSurface .VOLUME , () -> Modes .isTrackMode (modeManager .getActiveID ()));
@@ -444,7 +418,7 @@ protected boolean getCommit ()
444418 this .addButton (ButtonID .ACCENT , "ACCENT" , new ToggleFixedVelCommand (this .model , surface ), MaschineControlSurface .FIXED_VEL , this .configuration ::isAccentActive );
445419
446420 this .addButton (ButtonID .SCENE1 , "SCENE" , new ViewMultiSelectCommand <> (this .model , surface , Views .SCENE_PLAY ), MaschineControlSurface .SCENE , () -> viewManager .isActive (Views .SCENE_PLAY ));
447- this .addButton (ButtonID .CLIP , "PATTERN" , new ViewMultiSelectCommand <> (this .model , surface , Views .SESSION ), MaschineControlSurface .PATTERN , () -> viewManager .isActive (Views .CLIP_LENGTH ));
421+ this .addButton (ButtonID .CLIP , "PATTERN" , new ViewMultiSelectCommand <> (this .model , surface , Views .SESSION ), MaschineControlSurface .PATTERN , () -> viewManager .isActive (Views .CLIP_LENGTH , Views . SESSION ));
448422 this .addButton (ButtonID .NOTE , "EVENTS" , new ModeSelectCommand <> (this .model , surface , Modes .NOTE , true ), MaschineControlSurface .EVENTS , () -> modeManager .isActive (Modes .NOTE ));
449423 this .addButton (ButtonID .TOGGLE_DEVICE , this .maschine == Maschine .STUDIO || this .maschine == Maschine .MK2 ? "NAVIGATE" : "VARIATION" , new ViewMultiSelectCommand <> (this .model , surface , Views .DEVICE ), MaschineControlSurface .VARIATION , () -> viewManager .isActive (Views .DEVICE ));
450424 this .addButton (ButtonID .DUPLICATE , "DUPLICATE" , NopCommand .INSTANCE , MaschineControlSurface .DUPLICATE );
@@ -476,13 +450,20 @@ protected boolean getCommit ()
476450 this .addButton (ButtonID .MUTE , "MUTE" , new ViewMultiSelectCommand <> (this .model , surface , Views .TRACK_MUTE ), MaschineControlSurface .MUTE , () -> viewManager .isActive (Views .TRACK_MUTE ));
477451 }
478452
479- final KeyboardCommand keyboardCommand = new KeyboardCommand (this .model , surface );
480- this .addButton (ButtonID .ROW1_1 , "PAD MODE" , new PadModeCommand (keyboardCommand , this .model , surface ), MaschineControlSurface .PAD_MODE , () -> viewManager .isActive (Views .DRUM ));
481- this .addButton (ButtonID .ROW1_2 , "KEYBOARD" , keyboardCommand , MaschineControlSurface .KEYBOARD , () -> viewManager .isActive (Views .PLAY ));
482- this .addButton (ButtonID .ROW1_3 , "CHORDS" , (event , velocity ) -> {
483- if (velocity == 0 )
484- ((PlayView ) viewManager .get (Views .PLAY )).toggleChordMode ();
485- }, MaschineControlSurface .CHORDS , ((PlayView ) viewManager .get (Views .PLAY ))::isChordMode );
453+ if (this .maschine == Maschine .MK2 || this .maschine == Maschine .STUDIO )
454+ {
455+ this .addButton (ButtonID .ROW1_1 , "PAD MODE" , new MaschineMk2PlayViewSwitchCommand (this .model , surface ), MaschineControlSurface .PAD_MODE , () -> viewManager .isActive (Views .DRUM , Views .PLAY ));
456+ }
457+ else
458+ {
459+ final KeyboardCommand keyboardCommand = new KeyboardCommand (this .model , surface );
460+ this .addButton (ButtonID .ROW1_1 , "PAD MODE" , new PadModeCommand (keyboardCommand , this .model , surface ), MaschineControlSurface .PAD_MODE , () -> viewManager .isActive (Views .DRUM ));
461+ this .addButton (ButtonID .ROW1_2 , "KEYBOARD" , keyboardCommand , MaschineControlSurface .KEYBOARD , () -> viewManager .isActive (Views .PLAY ));
462+ this .addButton (ButtonID .ROW1_3 , "CHORDS" , (event , velocity ) -> {
463+ if (velocity == 0 )
464+ ((PlayView ) viewManager .get (Views .PLAY )).toggleChordMode ();
465+ }, MaschineControlSurface .CHORDS , ((PlayView ) viewManager .get (Views .PLAY ))::isChordMode );
466+ }
486467
487468 final DrumView drumView = (DrumView ) viewManager .get (Views .DRUM );
488469 this .addButton (ButtonID .ROW1_4 , "STEP" , (event , velocity ) -> {
@@ -683,7 +664,6 @@ protected void registerContinuousCommands ()
683664 final ModeManager modeManager = surface .getModeManager ();
684665 final ViewManager viewManager = surface .getViewManager ();
685666
686- this .mainKnobCommand = new MainKnobRowModeCommand (this .model , surface );
687667 final IHwRelativeKnob knob = this .addRelativeKnob (ContinuousID .MASTER_KNOB , "Encoder" , this .mainKnobCommand , MaschineControlSurface .ENCODER );
688668 knob .bindTouch ( (event , velocity ) -> {
689669 final IMode mode = modeManager .getActive ();
0 commit comments