use of de.mossgrabers.apc.controller.APCControlSurface in project DrivenByMoss by git-moss.
the class APCControllerSetup method updateDeviceKnobs.
private void updateDeviceKnobs() {
final APCControlSurface surface = this.getSurface();
final View view = surface.getViewManager().getActiveView();
if (view == null)
return;
final ICursorDevice cd = this.model.getCursorDevice();
for (int i = 0; i < 8; i++) {
final Integer deviceKnobCommand = Integer.valueOf(Commands.CONT_COMMAND_DEVICE_KNOB1.intValue() + i);
if (!((DeviceKnobRowCommand) view.getContinuousCommand(deviceKnobCommand)).isKnobMoving())
surface.setLED(APCControlSurface.APC_KNOB_DEVICE_KNOB_1 + i, cd.getFXParam(i).getValue());
}
}
use of de.mossgrabers.apc.controller.APCControlSurface in project DrivenByMoss by git-moss.
the class APCControllerSetup method updateMode.
private void updateMode(final Integer mode) {
final APCControlSurface surface = this.getSurface();
final Integer m = mode == null ? surface.getModeManager().getActiveModeId() : mode;
this.updateIndication(m);
surface.updateButton(APCControlSurface.APC_BUTTON_PAN, m == Modes.MODE_PAN ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
if (surface.isMkII()) {
surface.updateButton(APCControlSurface.APC_BUTTON_SEND_A, m == Modes.MODE_SEND1 || m == Modes.MODE_SEND3 || m == Modes.MODE_SEND5 || m == Modes.MODE_SEND7 ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_SEND_B, m == Modes.MODE_SEND2 || m == Modes.MODE_SEND4 || m == Modes.MODE_SEND6 || m == Modes.MODE_SEND8 ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
} else {
surface.updateButton(APCControlSurface.APC_BUTTON_SEND_A, m == Modes.MODE_SEND1 || m == Modes.MODE_SEND4 || m == Modes.MODE_SEND7 ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_SEND_B, m == Modes.MODE_SEND2 || m == Modes.MODE_SEND5 || m == Modes.MODE_SEND8 ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_SEND_C, m == Modes.MODE_SEND3 || m == Modes.MODE_SEND6 ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
}
}
use of de.mossgrabers.apc.controller.APCControlSurface in project DrivenByMoss by git-moss.
the class APCControllerSetup method registerContinuousCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerContinuousCommands() {
final APCControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
this.addContinuousCommand(Commands.CONT_COMMAND_MASTER_KNOB, APCControlSurface.APC_KNOB_MASTER_LEVEL, new MasterFaderAbsoluteCommand<>(this.model, surface));
this.addContinuousCommand(Commands.CONT_COMMAND_PLAY_POSITION, APCControlSurface.APC_KNOB_CUE_LEVEL, new PlayPositionCommand<>(this.model, surface));
this.addContinuousCommand(Commands.CONT_COMMAND_CROSSFADER, APCControlSurface.APC_KNOB_CROSSFADER, new CrossfaderCommand<>(this.model, surface));
for (int i = 0; i < 8; i++) {
final Integer faderCommand = Integer.valueOf(Commands.CONT_COMMAND_FADER1.intValue() + i);
viewManager.registerContinuousCommand(faderCommand, new FaderAbsoluteCommand<>(i, this.model, surface));
surface.assignContinuousCommand(APCControlSurface.APC_KNOB_TRACK_LEVEL, i, faderCommand);
final Integer knobCommand = Integer.valueOf(Commands.CONT_COMMAND_KNOB1.intValue() + i);
viewManager.registerContinuousCommand(knobCommand, new KnobRowModeCommand<>(i, this.model, surface));
surface.assignContinuousCommand(APCControlSurface.APC_KNOB_TRACK_KNOB_1 + i, knobCommand);
final Integer deviceKnobCommand = Integer.valueOf(Commands.CONT_COMMAND_DEVICE_KNOB1.intValue() + i);
viewManager.registerContinuousCommand(deviceKnobCommand, new DeviceKnobRowCommand(i, this.model, surface));
surface.assignContinuousCommand(APCControlSurface.APC_KNOB_DEVICE_KNOB_1 + i, deviceKnobCommand);
}
if (this.isMkII)
this.addContinuousCommand(Commands.CONT_COMMAND_TEMPO, APCControlSurface.APC_KNOB_TEMPO, new TempoCommand<>(this.model, surface));
}
use of de.mossgrabers.apc.controller.APCControlSurface in project DrivenByMoss by git-moss.
the class APCControllerSetup method createModes.
/**
* {@inheritDoc}
*/
@Override
protected void createModes() {
final APCControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
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(surface, this.model, i));
modeManager.registerMode(Modes.MODE_BROWSER, new BrowserMode(surface, this.model));
}
use of de.mossgrabers.apc.controller.APCControlSurface in project DrivenByMoss by git-moss.
the class APCControllerSetup method createSurface.
/**
* {@inheritDoc}
*/
@Override
protected void createSurface() {
final IMidiAccess midiAccess = this.factory.createMidiAccess();
final IMidiOutput output = midiAccess.createOutput();
final IMidiInput input = midiAccess.createInput(this.isMkII ? "Akai APC40 mkII" : "Akai APC40", "B040??");
final APCControlSurface surface = new APCControlSurface(this.model.getHost(), this.colorManager, this.configuration, output, input, this.isMkII);
this.surfaces.add(surface);
surface.setDisplay(new DummyDisplay(this.host));
for (int i = 0; i < 8; i++) surface.setLED(APCControlSurface.APC_KNOB_DEVICE_KNOB_LED_1 + i, 1);
}
Aggregations