use of de.mossgrabers.apcmini.controller.APCminiControlSurface in project DrivenByMoss by git-moss.
the class APCminiControllerSetup method createModes.
/**
* {@inheritDoc}
*/
@Override
protected void createModes() {
final APCminiControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
modeManager.registerMode(Modes.MODE_VOLUME, new VolumeMode(surface, this.model));
modeManager.registerMode(Modes.MODE_PAN, new PanMode(surface, this.model));
for (int i = 0; i < 8; i++) modeManager.registerMode(Integer.valueOf(Modes.MODE_SEND1.intValue() + i), new SendMode(i, surface, this.model));
modeManager.registerMode(Modes.MODE_DEVICE, new DeviceMode(surface, this.model));
modeManager.setDefaultMode(Modes.MODE_VOLUME);
}
use of de.mossgrabers.apcmini.controller.APCminiControlSurface in project DrivenByMoss by git-moss.
the class APCminiControllerSetup method createSurface.
/**
* {@inheritDoc}
*/
@Override
protected void createSurface() {
final IMidiAccess midiAccess = this.factory.createMidiAccess();
final IMidiOutput output = midiAccess.createOutput();
final IMidiInput input = midiAccess.createInput("Akai APCmini");
final APCminiControlSurface surface = new APCminiControlSurface(this.model.getHost(), this.colorManager, this.configuration, output, input);
this.surfaces.add(surface);
surface.setDisplay(new DummyDisplay(this.host));
}
use of de.mossgrabers.apcmini.controller.APCminiControlSurface in project DrivenByMoss by git-moss.
the class APCminiControllerSetup method updateIndication.
private void updateIndication(final Integer mode) {
final ITrackBank tb = this.model.getTrackBank();
final IChannelBank tbe = this.model.getEffectTrackBank();
final APCminiControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
final boolean isShiftView = viewManager.isActiveView(Views.VIEW_SHIFT);
final boolean isSession = viewManager.isActiveView(Views.VIEW_SESSION) || isShiftView;
final boolean isEffect = this.model.isEffectTrackBankActive();
final boolean isPan = Modes.MODE_PAN.equals(mode);
final boolean isDevice = Modes.MODE_DEVICE.equals(mode);
tb.setIndication(!isEffect && isSession);
tbe.setIndication(isEffect && isSession);
final ICursorDevice cursorDevice = this.model.getCursorDevice();
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
track.setVolumeIndication(!isEffect);
track.setPanIndication(!isEffect && isPan);
for (int j = 0; j < 8; j++) track.getSend(j).setIndication(!isEffect && (Modes.MODE_SEND1.equals(mode) && j == 0 || Modes.MODE_SEND2.equals(mode) && j == 1 || Modes.MODE_SEND3.equals(mode) && j == 2 || Modes.MODE_SEND4.equals(mode) && j == 3 || Modes.MODE_SEND5.equals(mode) && j == 4 || Modes.MODE_SEND6.equals(mode) && j == 5 || Modes.MODE_SEND7.equals(mode) && j == 6 || Modes.MODE_SEND8.equals(mode) && j == 7));
final ITrack fxTrack = tbe.getTrack(i);
fxTrack.setVolumeIndication(isEffect);
fxTrack.setPanIndication(isEffect && isPan);
cursorDevice.indicateParameter(i, isDevice || isShiftView);
}
}
use of de.mossgrabers.apcmini.controller.APCminiControlSurface in project DrivenByMoss by git-moss.
the class APCminiControllerSetup method createObservers.
/**
* {@inheritDoc}
*/
@Override
protected void createObservers() {
final APCminiControlSurface surface = this.getSurface();
surface.getViewManager().addViewChangeListener((previousViewId, activeViewId) -> this.updateMode(null));
surface.getModeManager().addModeListener((previousModeId, activeModeId) -> this.updateMode(activeModeId));
this.createScaleObservers(this.configuration);
this.configuration.addSettingObserver(APCminiConfiguration.FADER_CTRL, () -> {
final ModeManager modeManager = surface.getModeManager();
switch(this.configuration.getFaderCtrl()) {
case "Volume":
modeManager.setActiveMode(Modes.MODE_VOLUME);
break;
case "Pan":
modeManager.setActiveMode(Modes.MODE_PAN);
break;
case "Send 1":
modeManager.setActiveMode(Modes.MODE_SEND1);
break;
case "Send 2":
modeManager.setActiveMode(Modes.MODE_SEND2);
break;
case "Send 3":
modeManager.setActiveMode(Modes.MODE_SEND3);
break;
case "Send 4":
modeManager.setActiveMode(Modes.MODE_SEND4);
break;
case "Send 5":
modeManager.setActiveMode(Modes.MODE_SEND5);
break;
case "Send 6":
modeManager.setActiveMode(Modes.MODE_SEND6);
break;
case "Send 7":
modeManager.setActiveMode(Modes.MODE_SEND7);
break;
case "Send 8":
modeManager.setActiveMode(Modes.MODE_SEND8);
break;
case "Device":
modeManager.setActiveMode(Modes.MODE_DEVICE);
break;
}
});
this.configuration.addSettingObserver(APCminiConfiguration.SOFT_KEYS, () -> {
for (int i = 0; i < APCminiConfiguration.SOFT_KEYS_OPTIONS.length; i++) {
final String opt = APCminiConfiguration.SOFT_KEYS_OPTIONS[i];
if (opt.equals(this.configuration.getSoftKeys()))
surface.setTrackState(i);
}
});
}
use of de.mossgrabers.apcmini.controller.APCminiControlSurface in project DrivenByMoss by git-moss.
the class APCminiControllerSetup method startup.
/**
* {@inheritDoc}
*/
@Override
public void startup() {
final APCminiControlSurface surface = this.getSurface();
surface.getModeManager().setActiveMode(Modes.MODE_VOLUME);
surface.getViewManager().setActiveView(Views.VIEW_PLAY);
}
Aggregations