Search in sources :

Example 1 with IHwLight

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);
}
Also used : IHwTextDisplay(de.mossgrabers.framework.controller.hardware.IHwTextDisplay) IHwButton(de.mossgrabers.framework.controller.hardware.IHwButton) HostImpl(de.mossgrabers.bitwig.framework.daw.HostImpl) Color(com.bitwig.extension.api.Color) IntConsumer(java.util.function.IntConsumer) IHwSurfaceFactory(de.mossgrabers.framework.controller.hardware.IHwSurfaceFactory) HardwareLightVisualState(com.bitwig.extension.controller.api.HardwareLightVisualState) OutputID(de.mossgrabers.framework.controller.OutputID) Supplier(java.util.function.Supplier) IHwPianoKeyboard(de.mossgrabers.framework.controller.hardware.IHwPianoKeyboard) RelativeEncoding(de.mossgrabers.framework.controller.valuechanger.RelativeEncoding) ButtonID(de.mossgrabers.framework.controller.ButtonID) ColorEx(de.mossgrabers.framework.controller.color.ColorEx) IntSupplier(java.util.function.IntSupplier) IntFunction(java.util.function.IntFunction) BitmapImpl(de.mossgrabers.bitwig.framework.graphics.BitmapImpl) IHwLight(de.mossgrabers.framework.controller.hardware.IHwLight) OperatingSystem(de.mossgrabers.framework.utils.OperatingSystem) MultiStateHardwareLight(com.bitwig.extension.controller.api.MultiStateHardwareLight) HardwareButton(com.bitwig.extension.controller.api.HardwareButton) ContinuousID(de.mossgrabers.framework.controller.ContinuousID) IHwFader(de.mossgrabers.framework.controller.hardware.IHwFader) Consumer(java.util.function.Consumer) IBitmap(de.mossgrabers.framework.graphics.IBitmap) IHwAbsoluteKnob(de.mossgrabers.framework.controller.hardware.IHwAbsoluteKnob) IHwGraphicsDisplay(de.mossgrabers.framework.controller.hardware.IHwGraphicsDisplay) IHwRelativeKnob(de.mossgrabers.framework.controller.hardware.IHwRelativeKnob) HardwareSurface(com.bitwig.extension.controller.api.HardwareSurface) InternalHardwareLightState(com.bitwig.extension.controller.api.InternalHardwareLightState) MultiStateHardwareLight(com.bitwig.extension.controller.api.MultiStateHardwareLight) InternalHardwareLightState(com.bitwig.extension.controller.api.InternalHardwareLightState) Color(com.bitwig.extension.api.Color) ColorEx(de.mossgrabers.framework.controller.color.ColorEx) HardwareLightVisualState(com.bitwig.extension.controller.api.HardwareLightVisualState)

Example 2 with IHwLight

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);
}
Also used : LaunchkeyMk3ControlSurface(de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3ControlSurface) IHwLight(de.mossgrabers.framework.controller.hardware.IHwLight) ModeSelectCommand(de.mossgrabers.framework.command.trigger.mode.ModeSelectCommand)

Example 3 with IHwLight

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);
}
Also used : LaunchkeyMk3ControlSurface(de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3ControlSurface) IHwLight(de.mossgrabers.framework.controller.hardware.IHwLight) ModeSelectCommand(de.mossgrabers.framework.command.trigger.mode.ModeSelectCommand)

Example 4 with IHwLight

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);
}
Also used : LaunchkeyMiniMk3ControlSurface(de.mossgrabers.controller.novation.launchkey.mini.controller.LaunchkeyMiniMk3ControlSurface) IHwLight(de.mossgrabers.framework.controller.hardware.IHwLight) ModeSelectCommand(de.mossgrabers.framework.command.trigger.mode.ModeSelectCommand)

Example 5 with IHwLight

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);
}
Also used : ViewMultiSelectCommand(de.mossgrabers.framework.command.trigger.view.ViewMultiSelectCommand) LaunchkeyMiniMk3ControlSurface(de.mossgrabers.controller.novation.launchkey.mini.controller.LaunchkeyMiniMk3ControlSurface) IHwLight(de.mossgrabers.framework.controller.hardware.IHwLight)

Aggregations

IHwLight (de.mossgrabers.framework.controller.hardware.IHwLight)7 LaunchkeyMk3ControlSurface (de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3ControlSurface)3 ModeSelectCommand (de.mossgrabers.framework.command.trigger.mode.ModeSelectCommand)3 Color (com.bitwig.extension.api.Color)2 HardwareButton (com.bitwig.extension.controller.api.HardwareButton)2 HardwareLightVisualState (com.bitwig.extension.controller.api.HardwareLightVisualState)2 HardwareSurface (com.bitwig.extension.controller.api.HardwareSurface)2 InternalHardwareLightState (com.bitwig.extension.controller.api.InternalHardwareLightState)2 MultiStateHardwareLight (com.bitwig.extension.controller.api.MultiStateHardwareLight)2 HostImpl (de.mossgrabers.bitwig.framework.daw.HostImpl)2 BitmapImpl (de.mossgrabers.bitwig.framework.graphics.BitmapImpl)2 LaunchkeyMiniMk3ControlSurface (de.mossgrabers.controller.novation.launchkey.mini.controller.LaunchkeyMiniMk3ControlSurface)2 ViewMultiSelectCommand (de.mossgrabers.framework.command.trigger.view.ViewMultiSelectCommand)2 ButtonID (de.mossgrabers.framework.controller.ButtonID)2 ContinuousID (de.mossgrabers.framework.controller.ContinuousID)2 OutputID (de.mossgrabers.framework.controller.OutputID)2 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)2 IHwAbsoluteKnob (de.mossgrabers.framework.controller.hardware.IHwAbsoluteKnob)2 IHwButton (de.mossgrabers.framework.controller.hardware.IHwButton)2 IHwFader (de.mossgrabers.framework.controller.hardware.IHwFader)2