use of de.mossgrabers.framework.controller.hardware.IHwLight in project DrivenByMoss by git-moss.
the class HwSurfaceFactoryImpl method createLight.
/**
* {@inheritDoc}
*/
@Override
public IHwLight createLight(final int surfaceID, final OutputID outputID, final Supplier<ColorEx> supplier, final Consumer<ColorEx> sendValueConsumer) {
this.lightCounter++;
final String id = createID(surfaceID, outputID == null ? "LIGHT" + this.lightCounter : outputID.name());
final MultiStateHardwareLight hardwareLight = this.hardwareSurface.createMultiStateHardwareLight(id);
final Supplier<InternalHardwareLightState> valueSupplier = () -> new RawColorLightState(supplier.get());
final Consumer<InternalHardwareLightState> hardwareUpdater = state -> {
final HardwareLightVisualState visualState = state == null ? null : state.getVisualState();
final Color c = visualState == null ? Color.blackColor() : visualState.getColor();
sendValueConsumer.accept(new ColorEx(c.getRed(), c.getGreen(), c.getBlue()));
};
return new HwLightImpl(this.host, hardwareLight, valueSupplier, hardwareUpdater);
}
use of de.mossgrabers.framework.controller.hardware.IHwLight in project DrivenByMoss by git-moss.
the class LaunchkeyMk3ControllerSetup method createFaderModeButton.
private void createFaderModeButton(final ButtonID buttonID, final OutputID outputID, final String label, final Modes mode, final int modeIndex) {
final LaunchkeyMk3ControlSurface surface = this.getSurface();
final ModeSelectCommand<LaunchkeyMk3ControlSurface, LaunchkeyMk3Configuration> modeSelectCommand = new ModeSelectCommand<>(surface.getFaderModeManager(), this.model, surface, mode);
this.addButton(surface, buttonID, label, (event, velocity) -> modeSelectCommand.executeNormal(event), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_FADER_SELECT, modeIndex, false, null);
final IHwLight light = surface.createLight(outputID, () -> surface.getFaderModeManager().isActive(mode) ? ColorEx.BLUE : ColorEx.DARK_BLUE, color -> {
// Intentionally empty
});
surface.getButton(buttonID).addLight(light);
}
use of de.mossgrabers.framework.controller.hardware.IHwLight in project DrivenByMoss by git-moss.
the class LaunchkeyMk3ControllerSetup method createModeButton.
private void createModeButton(final ButtonID buttonID, final OutputID outputID, final String label, final Modes mode, final int modeIndex) {
final LaunchkeyMk3ControlSurface surface = this.getSurface();
final ModeSelectCommand<LaunchkeyMk3ControlSurface, LaunchkeyMk3Configuration> modeSelectCommand = new ModeSelectCommand<>(this.model, surface, mode);
this.addButton(surface, buttonID, label, (event, velocity) -> modeSelectCommand.executeNormal(event), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_MODE_SELECT, modeIndex, false, null);
final IHwLight light = surface.createLight(outputID, () -> surface.getModeManager().isActive(mode) ? ColorEx.GREEN : ColorEx.DARK_GREEN, color -> {
// Intentionally empty
});
surface.getButton(buttonID).addLight(light);
}
use of de.mossgrabers.framework.controller.hardware.IHwLight in project DrivenByMoss by git-moss.
the class LaunchkeyMiniMk3ControllerSetup method createModeButton.
private void createModeButton(final ButtonID buttonID, final OutputID outputID, final String label, final Modes mode, final int modeIndex) {
final LaunchkeyMiniMk3ControlSurface surface = this.getSurface();
final ModeSelectCommand<LaunchkeyMiniMk3ControlSurface, LaunchkeyMiniMk3Configuration> modeSelectCommand = new ModeSelectCommand<>(this.model, surface, mode);
this.addButton(surface, buttonID, label, (event, velocity) -> modeSelectCommand.executeNormal(event), 15, LaunchkeyMiniMk3ControlSurface.LAUNCHKEY_MODE_SELECT, modeIndex, false, null);
final IHwLight light = surface.createLight(outputID, () -> surface.getModeManager().isActive(mode) ? ColorEx.GREEN : ColorEx.DARK_GREEN, color -> {
// Intentionally empty
});
surface.getButton(buttonID).addLight(light);
}
use of de.mossgrabers.framework.controller.hardware.IHwLight in project DrivenByMoss by git-moss.
the class LaunchkeyMiniMk3ControllerSetup method createViewButton.
private void createViewButton(final ButtonID buttonID, final OutputID outputID, final String label, final Views view, final int viewIndex) {
final LaunchkeyMiniMk3ControlSurface surface = this.getSurface();
final ViewMultiSelectCommand<LaunchkeyMiniMk3ControlSurface, LaunchkeyMiniMk3Configuration> viewSelectCommand = new ViewMultiSelectCommand<>(this.model, surface, true, view);
this.addButton(surface, buttonID, label, (event, velocity) -> {
viewSelectCommand.executeNormal(event);
surface.getPadGrid().setView(view);
}, 15, LaunchkeyMiniMk3ControlSurface.LAUNCHKEY_VIEW_SELECT, viewIndex, false, null);
final IHwLight light = surface.createLight(outputID, () -> surface.getViewManager().isActive(view) ? ColorEx.ORANGE : ColorEx.DARK_ORANGE, color -> {
// Intentionally empty
});
surface.getButton(buttonID).addLight(light);
}
Aggregations