Search in sources :

Example 16 with ColorManager

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

the class AbstractSessionView method getPadColor.

protected LightInfo getPadColor(final ISlot slot, final boolean isArmed) {
    final String colorIndex = DAWColor.getColorIndex(slot.getColor());
    final ColorManager cm = this.model.getColorManager();
    if (slot.isRecordingQueued())
        return this.clipColorIsRecordingQueued;
    if (slot.isRecording())
        return this.insertClipColor(cm, colorIndex, this.clipColorIsRecording);
    if (slot.isPlayingQueued())
        return this.insertClipColor(cm, colorIndex, this.clipColorIsPlayingQueued);
    if (slot.isPlaying())
        return this.insertClipColor(cm, colorIndex, this.clipColorIsPlaying);
    if (slot.hasContent()) {
        final int blinkColor = this.clipColorHasContent.getBlinkColor();
        final int color = this.useClipColor && colorIndex != null ? cm.getColorIndex(colorIndex) : this.clipColorHasContent.getColor();
        return new LightInfo(color, slot.isSelected() ? blinkColor : -1, this.clipColorHasContent.isFast());
    }
    return isArmed && this.surface.getConfiguration().isDrawRecordStripe() ? this.clipColorIsRecArmed : this.clipColorHasNoContent;
}
Also used : ColorManager(de.mossgrabers.framework.controller.color.ColorManager) LightInfo(de.mossgrabers.framework.controller.grid.LightInfo)

Example 17 with ColorManager

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

the class PianoViewHelper method drawGrid.

/**
 * Draw the piano view grid.
 *
 * @param gridPad The grid to draw
 * @param model The model
 * @param keyManager The key manager
 * @param rows The number of rows of the grid
 * @param columns The number of columns of the grid
 */
public static void drawGrid(final IPadGrid gridPad, final IModel model, final KeyManager keyManager, final int rows, final int columns) {
    if (!model.canSelectedTrackHoldNotes()) {
        gridPad.turnOff();
        return;
    }
    final int startKey = 36;
    final ColorManager colorManager = model.getColorManager();
    final boolean isRecording = model.hasRecordingState();
    final ITrack track = model.getCursorTrack();
    final int playKeyColor = colorManager.getColorIndex(isRecording ? AbstractPlayView.COLOR_RECORD : AbstractPlayView.COLOR_PLAY);
    final int whiteKeyColor = colorManager.getColorIndex(Scales.SCALE_COLOR_NOTE);
    final int blackKeyColor = colorManager.getColorIndex(AbstractView.replaceOctaveColorWithTrackColor(track, Scales.SCALE_COLOR_OCTAVE));
    final int offKeyColor = colorManager.getColorIndex(Scales.SCALE_COLOR_OFF);
    for (int row = 0; row < rows; row++) {
        for (int column = 0; column < columns; column++) {
            final int n = startKey + columns * row + column;
            final int color;
            if (row % 2 == 0) {
                // White keys
                color = keyManager.isKeyPressed(n) ? playKeyColor : whiteKeyColor;
            } else {
                // Black keys
                final int octaveColumn = column % 7;
                if (octaveColumn == 0 || octaveColumn == 3 || octaveColumn == 7)
                    color = offKeyColor;
                else
                    color = keyManager.isKeyPressed(n) ? playKeyColor : blackKeyColor;
            }
            gridPad.light(n, color, -1, false);
        }
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ColorManager(de.mossgrabers.framework.controller.color.ColorManager)

Example 18 with ColorManager

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

the class NoteRepeatMode method getButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getButtonColor(final ButtonID buttonID) {
    int index = this.isButtonRow(0, buttonID);
    if (index >= 0) {
        final ColorManager colorManager = this.model.getColorManager();
        final int offColor = colorManager.getColorIndex(AbstractFeatureGroup.BUTTON_COLOR_OFF);
        final int onColor = colorManager.getColorIndex(AbstractFeatureGroup.BUTTON_COLOR_ON);
        final int hiColor = colorManager.getColorIndex(AbstractMode.BUTTON_COLOR_HI);
        switch(index) {
            default:
            case 0:
            case 1:
                return onColor;
            case 2:
                return this.host.supports(Capability.NOTE_REPEAT_LENGTH) ? onColor : offColor;
            case 3:
                return this.host.supports(Capability.NOTE_REPEAT_LENGTH) ? onColor : offColor;
            case 4:
                return offColor;
            case 5:
                if (this.host.supports(Capability.NOTE_REPEAT_USE_PRESSURE_TO_VELOCITY))
                    return this.noteRepeat.usePressure() ? hiColor : onColor;
                return offColor;
            case 6:
                if (this.host.supports(Capability.NOTE_REPEAT_IS_FREE_RUNNING))
                    return !this.noteRepeat.isFreeRunning() ? hiColor : onColor;
                return offColor;
            case 7:
                if (this.host.supports(Capability.NOTE_REPEAT_SWING))
                    return this.noteRepeat.isShuffle() ? hiColor : onColor;
                return offColor;
        }
    }
    index = this.isButtonRow(1, buttonID);
    if (index >= 0) {
        final ColorManager colorManager = this.model.getColorManager();
        if (index < 7)
            return colorManager.getColorIndex(AbstractFeatureGroup.BUTTON_COLOR_OFF);
        return this.model.getGroove().getParameter(GrooveParameterID.ENABLED).getValue() > 0 ? colorManager.getColorIndex(AbstractMode.BUTTON_COLOR_HI) : colorManager.getColorIndex(AbstractFeatureGroup.BUTTON_COLOR_ON);
    }
    return super.getButtonColor(buttonID);
}
Also used : ColorManager(de.mossgrabers.framework.controller.color.ColorManager)

Example 19 with ColorManager

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

the class MasterMode method getButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getButtonColor(final ButtonID buttonID) {
    int index = this.isButtonRow(0, buttonID);
    if (index >= 0) {
        final ColorManager colorManager = this.model.getColorManager();
        final boolean isPush2 = this.surface.getConfiguration().isPush2();
        if (index == 0)
            return this.getTrackButtonColor();
        if (index < 4 || index == 5)
            return colorManager.getColorIndex(AbstractFeatureGroup.BUTTON_COLOR_OFF);
        if (index > 5)
            return colorManager.getColorIndex(AbstractFeatureGroup.BUTTON_COLOR_ON);
        final int red = isPush2 ? PushColorManager.PUSH2_COLOR_RED_HI : PushColorManager.PUSH1_COLOR_RED_HI;
        return this.model.getApplication().isEngineActive() ? colorManager.getColorIndex(AbstractFeatureGroup.BUTTON_COLOR_ON) : red;
    }
    index = this.isButtonRow(1, buttonID);
    if (index >= 0) {
        final int off = this.isPush2 ? PushColorManager.PUSH2_COLOR_BLACK : PushColorManager.PUSH1_COLOR_BLACK;
        if (this.isPush2 || index > 0)
            return off;
        final boolean muteState = this.surface.getConfiguration().isMuteState();
        final IMasterTrack master = this.model.getMasterTrack();
        if (muteState)
            return master.isMute() ? off : PushColorManager.PUSH1_COLOR2_YELLOW_HI;
        return master.isSolo() ? PushColorManager.PUSH1_COLOR2_BLUE_HI : PushColorManager.PUSH1_COLOR2_GREY_LO;
    }
    return super.getButtonColor(buttonID);
}
Also used : PushColorManager(de.mossgrabers.controller.ableton.push.controller.PushColorManager) ColorManager(de.mossgrabers.framework.controller.color.ColorManager) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack)

Example 20 with ColorManager

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

the class SessionView method getButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getButtonColor(final ButtonID buttonID) {
    if (!ButtonID.isSceneButton(buttonID))
        return super.getButtonColor(buttonID);
    final ColorManager colorManager = this.model.getColorManager();
    final IScene s = this.model.getSceneBank().getItem(buttonID.ordinal() - ButtonID.SCENE1.ordinal());
    if (!s.doesExist())
        return colorManager.getColorIndex(AbstractSessionView.COLOR_SCENE_OFF);
    return colorManager.getColorIndex(s.isSelected() ? AbstractSessionView.COLOR_SELECTED_SCENE : AbstractSessionView.COLOR_SCENE);
}
Also used : IScene(de.mossgrabers.framework.daw.data.IScene) ColorManager(de.mossgrabers.framework.controller.color.ColorManager) SLMkIIIColorManager(de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIColorManager)

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