Search in sources :

Example 11 with ColorManager

use of de.mossgrabers.framework.controller.color.ColorManager in project DrivenByMoss by git-moss.

the class OSCExtension method init.

/**
 * {@inheritDoc}
 */
@Override
public void init() {
    this.configuration.init(new SettingsUI(this.getHost().getPreferences()));
    final Scales scales = new Scales(this.valueChanger, 0, 128, 128, 1);
    scales.setChromatic(true);
    final ControllerHost host = this.getHost();
    final OSCModel model = new OSCModel(host, new ColorManager(), this.valueChanger, scales);
    final OscModule oscModule = host.getOscModule();
    // Send OSC messages
    this.writer = new OSCWriter(model, this.configuration, oscModule);
    // Receive OSC messages
    final OscAddressSpace addressSpace = oscModule.createAddressSpace();
    this.configuration.addSettingObserver(OSCConfiguration.DEBUG_COMMANDS, () -> addressSpace.setShouldLogMessages(this.configuration.getDebugCommands()));
    addressSpace.registerDefaultMethod(new OSCParser(host, this.writer, this.configuration, model));
    oscModule.createUdpServer(this.configuration.getReceivePort(), addressSpace);
    // Initial flush of the whole DAW state
    host.scheduleTask(() -> this.writer.flush(true), 1000);
    host.println("Initialized.");
}
Also used : ControllerHost(com.bitwig.extension.controller.api.ControllerHost) SettingsUI(de.mossgrabers.framework.bitwig.configuration.SettingsUI) OscAddressSpace(com.bitwig.extension.api.opensoundcontrol.OscAddressSpace) OscModule(com.bitwig.extension.api.opensoundcontrol.OscModule) Scales(de.mossgrabers.framework.scale.Scales) OSCWriter(de.mossgrabers.osc.protocol.OSCWriter) OSCModel(de.mossgrabers.osc.protocol.OSCModel) ColorManager(de.mossgrabers.framework.controller.color.ColorManager) OSCParser(de.mossgrabers.osc.protocol.OSCParser)

Example 12 with ColorManager

use of de.mossgrabers.framework.controller.color.ColorManager in project DrivenByMoss by git-moss.

the class PanView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final ColorManager cm = this.model.getColorManager();
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final IMidiOutput output = this.surface.getOutput();
    for (int i = 0; i < 8; i++) {
        final ITrack track = tb.getTrack(i);
        final int color = cm.getColor(BitwigColors.getColorIndex(track.getColor()));
        if (this.trackColors[i] != color || !track.doesExist())
            this.setupFader(i);
        this.trackColors[i] = color;
        output.sendCC(LaunchpadControlSurface.LAUNCHPAD_FADER_1 + i, track.getPan());
    }
}
Also used : IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ColorManager(de.mossgrabers.framework.controller.color.ColorManager)

Example 13 with ColorManager

use of de.mossgrabers.framework.controller.color.ColorManager in project DrivenByMoss by git-moss.

the class ScalesMode method updateFirstRow.

/**
 * {@inheritDoc}
 */
@Override
public void updateFirstRow() {
    final int offset = this.scales.getScaleOffset();
    final ColorManager cm = this.model.getColorManager();
    for (int i = 0; i < 8; i++) {
        final boolean isFirstOrLast = i == 0 || i == 7;
        this.surface.updateButton(20 + i, i == 7 ? cm.getColor(AbstractMode.BUTTON_COLOR_OFF) : isFirstOrLast ? this.isPush2 ? PushColors.PUSH2_COLOR_ORANGE_LO : PushColors.PUSH1_COLOR_ORANGE_LO : cm.getColor(offset == i - 1 ? AbstractMode.BUTTON_COLOR_HI : AbstractMode.BUTTON_COLOR_ON));
    }
}
Also used : ColorManager(de.mossgrabers.framework.controller.color.ColorManager)

Example 14 with ColorManager

use of de.mossgrabers.framework.controller.color.ColorManager in project DrivenByMoss by git-moss.

the class ScalesMode method updateSecondRow.

/**
 * {@inheritDoc}
 */
@Override
public void updateSecondRow() {
    final int offset = this.scales.getScaleOffset();
    final ColorManager cm = this.model.getColorManager();
    for (int i = 0; i < 8; i++) {
        final boolean isFirstOrLast = i == 0 || i == 7;
        this.surface.updateButton(102 + i, isFirstOrLast ? this.isPush2 ? PushColors.PUSH2_COLOR2_AMBER : PushColors.PUSH1_COLOR2_AMBER : cm.getColor(offset == i - 1 + 6 ? AbstractMode.BUTTON_COLOR2_HI : AbstractMode.BUTTON_COLOR2_ON));
    }
}
Also used : ColorManager(de.mossgrabers.framework.controller.color.ColorManager)

Example 15 with ColorManager

use of de.mossgrabers.framework.controller.color.ColorManager in project DrivenByMoss by git-moss.

the class AutomationMode method updateFirstRow.

/**
 * {@inheritDoc}
 */
@Override
public void updateFirstRow() {
    final String writeMode = this.model.getTransport().getAutomationWriteMode();
    final ColorManager colorManager = this.model.getColorManager();
    for (int i = 0; i < ITransport.AUTOMATION_MODES_VALUES.length; i++) this.surface.updateButton(20 + i, colorManager.getColor(ITransport.AUTOMATION_MODES_VALUES[i].equals(writeMode) ? AbstractMode.BUTTON_COLOR_HI : AbstractMode.BUTTON_COLOR_ON));
    for (int i = ITransport.AUTOMATION_MODES_VALUES.length; i < 8; i++) this.surface.updateButton(20 + i, colorManager.getColor(AbstractMode.BUTTON_COLOR_OFF));
}
Also used : ColorManager(de.mossgrabers.framework.controller.color.ColorManager)

Aggregations

ColorManager (de.mossgrabers.framework.controller.color.ColorManager)21 ITrack (de.mossgrabers.framework.daw.data.ITrack)5 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)3 IMidiOutput (de.mossgrabers.framework.daw.midi.IMidiOutput)3 ViewManager (de.mossgrabers.framework.view.ViewManager)3 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)2 IScene (de.mossgrabers.framework.daw.data.IScene)2 ISceneBank (de.mossgrabers.framework.daw.data.bank.ISceneBank)2 OscAddressSpace (com.bitwig.extension.api.opensoundcontrol.OscAddressSpace)1 OscModule (com.bitwig.extension.api.opensoundcontrol.OscModule)1 ControllerHost (com.bitwig.extension.controller.api.ControllerHost)1 PushColorManager (de.mossgrabers.controller.ableton.push.controller.PushColorManager)1 LaunchkeyMk3ColorManager (de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3ColorManager)1 LaunchkeyMiniMk3ColorManager (de.mossgrabers.controller.novation.launchkey.mini.controller.LaunchkeyMiniMk3ColorManager)1 SLMkIIIColorManager (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIColorManager)1 SettingsUI (de.mossgrabers.framework.bitwig.configuration.SettingsUI)1 AbstractConfiguration (de.mossgrabers.framework.configuration.AbstractConfiguration)1 Configuration (de.mossgrabers.framework.configuration.Configuration)1 LightInfo (de.mossgrabers.framework.controller.grid.LightInfo)1 PadGrid (de.mossgrabers.framework.controller.grid.PadGrid)1