use of de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface in project DrivenByMoss by git-moss.
the class MaschineControllerSetup method registerContinuousCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerContinuousCommands() {
final MaschineControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
final ViewManager viewManager = surface.getViewManager();
final IHwRelativeKnob knob = this.addRelativeKnob(ContinuousID.MASTER_KNOB, "Encoder", new MainKnobRowModeCommand(this.model, surface), MaschineControlSurface.ENCODER);
knob.bindTouch((event, velocity) -> {
final IMode mode = modeManager.getActive();
if (mode != null && event != ButtonEvent.LONG)
mode.onKnobTouch(8, event == ButtonEvent.DOWN);
}, surface.getMidiInput(), BindType.CC, 0, MaschineControlSurface.ENCODER_TOUCH);
if (this.maschine.hasMCUDisplay()) {
for (int i = 0; i < 8; i++) {
final int index = i;
final IHwRelativeKnob modeKnob = this.addRelativeKnob(ContinuousID.get(ContinuousID.KNOB1, i), "Knob " + (i + 1), new KnobRowModeCommand<>(i, this.model, surface), MaschineControlSurface.MODE_KNOB_1 + i);
modeKnob.bindTouch((event, velocity) -> {
final IMode mode = modeManager.getActive();
if (mode != null && event != ButtonEvent.LONG)
mode.onKnobTouch(index, event == ButtonEvent.DOWN);
}, surface.getMidiInput(), BindType.CC, 0, MaschineControlSurface.MODE_KNOB_TOUCH_1 + i);
modeKnob.setIndexInGroup(i);
}
}
final TouchstripCommand touchstripCommand = new TouchstripCommand(this.model, surface);
this.addFader(ContinuousID.CROSSFADER, "Touchstrip", touchstripCommand, BindType.CC, MaschineControlSurface.TOUCHSTRIP, false);
surface.getContinuous(ContinuousID.CROSSFADER).bindTouch(touchstripCommand, surface.getMidiInput(), BindType.CC, 0, MaschineControlSurface.TOUCHSTRIP_TOUCH);
// Enable aftertouch
final Views[] views = { Views.PLAY, Views.DRUM };
for (final Views viewID : views) {
final IView view = viewManager.get(viewID);
view.registerAftertouchCommand(new AftertouchViewCommand<>(view, this.model, surface));
}
if (this.maschine == Maschine.STUDIO) {
final IHwAbsoluteKnob masterKnob = this.addAbsoluteKnob(ContinuousID.MONITOR_KNOB, "Encoder", null, MaschineControlSurface.MONITOR_ENCODER);
this.encoderManager = new StudioEncoderModeManager(masterKnob, this.model, surface);
masterKnob.bind(this.encoderManager);
final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandMaster = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.MASTER_VOLUME, this.model, surface);
this.addButton(ButtonID.ROW4_1, "MST", encoderCommandMaster, MaschineControlSurface.MONITOR_MST, encoderCommandMaster::isLit);
final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandSelectedTrack = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.SELECTED_TRACK_VOLUME, this.model, surface);
this.addButton(ButtonID.ROW4_2, "GRP", encoderCommandSelectedTrack, MaschineControlSurface.MONITOR_GRP, encoderCommandSelectedTrack::isLit);
final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandMetronome = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.METRONOME_VOLUME, this.model, surface);
this.addButton(ButtonID.ROW4_3, "SND", encoderCommandMetronome, MaschineControlSurface.MONITOR_SND, encoderCommandMetronome::isLit);
final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandCue = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.CUE_VOLUME, this.model, surface);
this.addButton(ButtonID.ROW4_4, "CUE", encoderCommandCue, MaschineControlSurface.MONITOR_CUE, encoderCommandCue::isLit);
final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandMasterPan = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.MASTER_PANORAMA, this.model, surface);
this.addButton(ButtonID.ROW4_5, "IN1", encoderCommandMasterPan, MaschineControlSurface.MONITOR_IN1, encoderCommandMasterPan::isLit);
final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandSelectedTrackPan = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.SELECTED_TRACK_PANORAMA, this.model, surface);
this.addButton(ButtonID.ROW4_6, "IN2", encoderCommandSelectedTrackPan, MaschineControlSurface.MONITOR_IN2, encoderCommandSelectedTrackPan::isLit);
final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandCueMix = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.CUE_MIX, this.model, surface);
this.addButton(ButtonID.ROW4_8, "IN4", encoderCommandCueMix, MaschineControlSurface.MONITOR_IN4, encoderCommandCueMix::isLit);
this.addButton(ButtonID.TOGGLE_VU, "IN3", (event, value) -> {
if (event == ButtonEvent.UP)
this.encoderManager.toggleMode();
}, MaschineControlSurface.MONITOR_IN3, this.encoderManager::isParameterMode);
// Activate the default mode
this.encoderManager.setActiveEncoderMode(EncoderMode.MASTER_VOLUME);
}
}
use of de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface in project DrivenByMoss by git-moss.
the class MaschineControllerSetup method layoutMk3.
private void layoutMk3() {
final MaschineControlSurface surface = this.getSurface();
surface.getButton(ButtonID.PAD1).setBounds(425.5, 652.25, 76.25, 79.0);
surface.getButton(ButtonID.PAD2).setBounds(516.25, 653.0, 76.25, 79.0);
surface.getButton(ButtonID.PAD3).setBounds(606.75, 653.0, 76.25, 79.0);
surface.getButton(ButtonID.PAD4).setBounds(694.75, 653.0, 76.25, 79.0);
surface.getButton(ButtonID.PAD5).setBounds(425.5, 562.75, 76.25, 79.0);
surface.getButton(ButtonID.PAD6).setBounds(516.25, 563.25, 76.25, 79.0);
surface.getButton(ButtonID.PAD7).setBounds(606.75, 563.5, 76.25, 79.0);
surface.getButton(ButtonID.PAD8).setBounds(694.75, 563.25, 76.25, 79.0);
surface.getButton(ButtonID.PAD9).setBounds(425.5, 473.0, 76.25, 79.0);
surface.getButton(ButtonID.PAD10).setBounds(516.25, 473.75, 76.25, 79.0);
surface.getButton(ButtonID.PAD11).setBounds(606.75, 474.0, 76.25, 79.0);
surface.getButton(ButtonID.PAD12).setBounds(694.75, 473.25, 76.25, 79.0);
surface.getButton(ButtonID.PAD13).setBounds(425.5, 383.5, 76.25, 79.0);
surface.getButton(ButtonID.PAD14).setBounds(516.25, 384.0, 76.25, 79.0);
surface.getButton(ButtonID.PAD15).setBounds(606.75, 384.5, 76.25, 79.0);
surface.getButton(ButtonID.PAD16).setBounds(694.75, 383.5, 76.25, 79.0);
surface.getButton(ButtonID.PLAY).setBounds(24.75, 697.75, 55.75, 32.0);
surface.getButton(ButtonID.RECORD).setBounds(96.75, 697.75, 55.75, 32.0);
surface.getButton(ButtonID.STOP).setBounds(166.25, 697.75, 55.75, 32.0);
surface.getButton(ButtonID.SHIFT).setBounds(236.5, 697.75, 56.0, 32.0);
surface.getButton(ButtonID.LOOP).setBounds(24.75, 666.75, 56.0, 18.0);
surface.getButton(ButtonID.DELETE).setBounds(96.75, 666.75, 56.0, 18.0);
surface.getButton(ButtonID.TAP_TEMPO).setBounds(166.25, 666.75, 56.0, 18.0);
surface.getButton(ButtonID.FLIP).setBounds(236.5, 666.75, 56.0, 18.0);
surface.getButton(ButtonID.NEW).setBounds(95.75, 237.25, 55.75, 32.0);
surface.getButton(ButtonID.AUTOMATION).setBounds(28.75, 237.25, 55.75, 32.0);
surface.getButton(ButtonID.OVERDUB).setBounds(233.75, 402.0, 58.0, 19.0);
surface.getButton(ButtonID.REPEAT).setBounds(233.75, 343.75, 58.0, 46.25);
surface.getButton(ButtonID.F1).setBounds(24.0, 464.75, 58.0, 19.0);
surface.getButton(ButtonID.F2).setBounds(96.0, 465.5, 57.25, 18.25);
surface.getButton(ButtonID.F3).setBounds(165.5, 465.5, 57.25, 18.25);
surface.getButton(ButtonID.F4).setBounds(233.75, 465.5, 57.25, 18.25);
surface.getButton(ButtonID.FADER_TOUCH_1).setBounds(51.25, 315.0, 69.5, 22.75);
surface.getButton(ButtonID.VOLUME).setBounds(164.5, 343.75, 58.0, 18.0);
surface.getButton(ButtonID.SWING).setBounds(164.5, 373.25, 58.0, 18.0);
surface.getButton(ButtonID.TEMPO_TOUCH).setBounds(164.5, 402.75, 58.0, 18.0);
surface.getButton(ButtonID.DEVICE).setBounds(95.75, 21.25, 55.75, 23.0);
surface.getButton(ButtonID.DEVICE_ON_OFF).setBounds(95.75, 107.25, 55.75, 38.5);
surface.getButton(ButtonID.ADD_TRACK).setBounds(28.75, 193.0, 55.75, 32.0);
surface.getButton(ButtonID.ADD_EFFECT).setBounds(95.75, 193.0, 55.75, 32.0);
surface.getButton(ButtonID.BROWSE).setBounds(28.75, 107.25, 55.75, 38.5);
surface.getButton(ButtonID.ACCENT).setBounds(344.75, 343.75, 58.0, 20.75);
surface.getButton(ButtonID.SCENE1).setBounds(346.5, 383.25, 58.0, 34.0);
surface.getButton(ButtonID.CLIP).setBounds(346.5, 427.0, 58.0, 34.0);
surface.getButton(ButtonID.NOTE).setBounds(346.5, 470.75, 58.0, 34.0);
surface.getButton(ButtonID.TOGGLE_DEVICE).setBounds(346.5, 514.5, 58.0, 41.25);
surface.getButton(ButtonID.DUPLICATE).setBounds(347.25, 562.75, 58.0, 34.0);
surface.getButton(ButtonID.SELECT).setBounds(346.5, 609.25, 58.0, 34.0);
surface.getButton(ButtonID.SOLO).setBounds(346.5, 653.0, 58.0, 34.0);
surface.getButton(ButtonID.MUTE).setBounds(346.5, 696.75, 58.0, 34.0);
surface.getButton(ButtonID.ROW1_1).setBounds(425.5, 343.75, 78.0, 20.75);
surface.getButton(ButtonID.ROW1_2).setBounds(516.25, 343.75, 78.0, 20.75);
surface.getButton(ButtonID.ROW1_3).setBounds(606.75, 343.75, 78.0, 20.75);
surface.getButton(ButtonID.ROW1_4).setBounds(694.75, 343.75, 78.0, 20.75);
surface.getButton(ButtonID.ARROW_LEFT).setBounds(25.75, 385.0, 22.25, 17.5);
surface.getButton(ButtonID.ARROW_RIGHT).setBounds(120.25, 385.0, 22.25, 17.5);
surface.getButton(ButtonID.ARROW_UP).setBounds(76.0, 342.5, 22.25, 17.5);
surface.getButton(ButtonID.ARROW_DOWN).setBounds(76.0, 431.25, 22.25, 17.5);
surface.getButton(ButtonID.PAGE_LEFT).setBounds(28.75, 157.75, 55.75, 23.0);
surface.getButton(ButtonID.PAGE_RIGHT).setBounds(95.75, 157.75, 55.75, 23.0);
surface.getButton(ButtonID.ROW2_1).setBounds(179.25, 21.25, 66.25, 27.25);
surface.getButton(ButtonID.ROW2_2).setBounds(254.25, 21.25, 66.25, 27.25);
surface.getButton(ButtonID.ROW2_3).setBounds(329.25, 21.25, 66.25, 27.25);
surface.getButton(ButtonID.ROW2_4).setBounds(404.0, 21.25, 66.25, 27.25);
surface.getButton(ButtonID.ROW2_5).setBounds(479.0, 21.25, 66.25, 27.25);
surface.getButton(ButtonID.ROW2_6).setBounds(554.0, 21.25, 66.25, 27.25);
surface.getButton(ButtonID.ROW2_7).setBounds(629.0, 21.25, 66.25, 27.25);
surface.getButton(ButtonID.ROW2_8).setBounds(704.0, 21.25, 66.25, 27.25);
surface.getButton(ButtonID.ROW3_1).setBounds(26.25, 564.75, 53.75, 35.0);
surface.getButton(ButtonID.ROW3_2).setBounds(96.75, 564.75, 53.75, 35.0);
surface.getButton(ButtonID.ROW3_3).setBounds(167.0, 564.75, 53.75, 35.0);
surface.getButton(ButtonID.ROW3_4).setBounds(237.5, 564.75, 53.75, 35.0);
surface.getButton(ButtonID.ROW3_5).setBounds(26.25, 610.75, 53.75, 35.0);
surface.getButton(ButtonID.ROW3_6).setBounds(96.75, 610.75, 53.75, 35.0);
surface.getButton(ButtonID.ROW3_7).setBounds(167.0, 610.75, 53.75, 35.0);
surface.getButton(ButtonID.ROW3_8).setBounds(237.5, 610.75, 53.75, 35.0);
surface.getButton(ButtonID.LAYOUT_ARRANGE).setBounds(28.75, 56.5, 55.75, 38.5);
surface.getButton(ButtonID.MIXER).setBounds(95.75, 56.5, 55.75, 38.5);
surface.getButton(ButtonID.DRUM).setBounds(28.75, 21.25, 55.75, 23.0);
surface.getContinuous(ContinuousID.KNOB1).setBounds(183.5, 226.25, 53.75, 49.25);
surface.getContinuous(ContinuousID.KNOB2).setBounds(259.0, 226.25, 53.75, 49.25);
surface.getContinuous(ContinuousID.KNOB3).setBounds(334.75, 226.25, 53.75, 49.25);
surface.getContinuous(ContinuousID.KNOB4).setBounds(410.25, 226.25, 53.75, 49.25);
surface.getContinuous(ContinuousID.KNOB5).setBounds(486.0, 226.25, 53.75, 49.25);
surface.getContinuous(ContinuousID.KNOB6).setBounds(561.5, 226.25, 53.75, 49.25);
surface.getContinuous(ContinuousID.KNOB7).setBounds(637.0, 226.25, 53.75, 49.25);
surface.getContinuous(ContinuousID.KNOB8).setBounds(712.75, 226.25, 53.75, 49.25);
surface.getContinuous(ContinuousID.MASTER_KNOB).setBounds(53.0, 362.25, 64.0, 63.0);
surface.getContinuous(ContinuousID.CROSSFADER).setBounds(24.0, 498.75, 268.0, 50.0);
surface.getTextDisplay().getHardwareDisplay().setBounds(182.75, 111.75, 591.75, 64.5);
}
use of de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface in project DrivenByMoss by git-moss.
the class MaschineControllerSetup method getEncoderColor.
private int getEncoderColor(final ButtonID arrowButton) {
final MaschineControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
final Modes modeID = modeManager.getActiveID();
if (modeID == null)
return MaschineColorManager.COLOR_BLACK;
final IMode mode = modeManager.getActive();
boolean isOn;
switch(arrowButton) {
case ARROW_LEFT:
isOn = mode.hasPreviousItem();
break;
case ARROW_RIGHT:
isOn = mode.hasNextItem();
break;
case ARROW_UP:
isOn = mode.hasNextItemPage();
break;
case ARROW_DOWN:
isOn = mode.hasPreviousItemPage();
break;
// Never reached
default:
return MaschineColorManager.COLOR_BLACK;
}
if (!isOn)
return MaschineColorManager.COLOR_BLACK;
switch(modeID) {
case VOLUME:
return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_BLUE : MaschineColorManager.COLOR_BLUE_LO;
case PAN:
return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO;
case SEND1:
case SEND2:
case SEND3:
case SEND4:
case SEND5:
case SEND6:
case SEND7:
case SEND8:
return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_WHITE : MaschineColorManager.COLOR_YELLOW;
case DEVICE_PARAMS:
case USER:
return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO;
case BROWSER:
return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_AMBER : MaschineColorManager.COLOR_AMBER_LO;
case NOTE:
return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_GREEN : MaschineColorManager.COLOR_GREEN_LO;
default:
return MaschineColorManager.COLOR_BLACK;
}
}
use of de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface in project DrivenByMoss by git-moss.
the class MaschineControllerSetup method createObservers.
/**
* {@inheritDoc}
*/
@Override
protected void createObservers() {
super.createObservers();
final MaschineControlSurface surface = this.getSurface();
this.configuration.registerDeactivatedItemsHandler(this.model);
this.createScaleObservers(this.configuration);
this.createNoteRepeatObservers(this.configuration, surface);
this.activateBrowserObserver(Modes.BROWSER);
}
use of de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface in project DrivenByMoss by git-moss.
the class MaschineControllerSetup method startup.
/**
* {@inheritDoc}
*/
@Override
public void startup() {
final MaschineControlSurface surface = this.getSurface();
surface.getModeManager().setActive(Modes.VOLUME);
surface.getViewManager().setActive(Views.PLAY);
}
Aggregations