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;
}
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);
}
}
}
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);
}
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);
}
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);
}
Aggregations