use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.
the class DrumView method getButtonColor.
/**
* {@inheritDoc}
*/
@Override
public int getButtonColor(final ButtonID buttonID) {
final int ordinal = buttonID.ordinal();
if (ordinal < ButtonID.SCENE1.ordinal() || ordinal > ButtonID.SCENE8.ordinal())
return 0;
final int scene = ordinal - ButtonID.SCENE1.ordinal();
if (ButtonID.isSceneButton(buttonID)) {
final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
if (this.noteRepeatPeriodOn) {
final int periodIndex = Resolution.getMatch(noteRepeat.getPeriod());
return buttonID == ButtonID.get(ButtonID.SCENE1, 7 - periodIndex) ? LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_LO;
}
if (this.noteRepeatLengthOn) {
final int lengthIndex = Resolution.getMatch(noteRepeat.getNoteLength());
return buttonID == ButtonID.get(ButtonID.SCENE1, 7 - lengthIndex) ? LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_LO;
}
}
if (!this.isActive())
return LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK;
return scene == 7 - this.selectedResolutionIndex ? LaunchpadColorManager.LAUNCHPAD_COLOR_YELLOW : LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN;
}
use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.
the class DrumView method drawPages.
/**
* {@inheritDoc}
*/
@Override
protected void drawPages(final INoteClip clip, final boolean isActive) {
super.drawPages(clip, isActive);
// Draw the extra buttons
final IPadGrid padGrid = this.surface.getPadGrid();
if (this.extraButtonsOn) {
padGrid.lightEx(4, 6, this.isSelectTrigger() ? LaunchpadColorManager.LAUNCHPAD_COLOR_WHITE : LaunchpadColorManager.LAUNCHPAD_COLOR_GREY_LO);
padGrid.lightEx(5, 6, this.isMuteTrigger() ? LaunchpadColorManager.LAUNCHPAD_COLOR_YELLOW_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_YELLOW_LO);
padGrid.lightEx(6, 6, this.isSoloTrigger() ? LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE_LO);
padGrid.lightEx(7, 6, this.isBrowseTrigger() ? LaunchpadColorManager.LAUNCHPAD_COLOR_CYAN_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_CYAN_LO);
final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
padGrid.lightEx(4, 7, noteRepeat.isActive() ? LaunchpadColorManager.LAUNCHPAD_COLOR_ORCHID_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_ORCHID_LO);
padGrid.lightEx(5, 7, this.noteRepeatPeriodOn ? LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_LO);
padGrid.lightEx(6, 7, this.noteRepeatLengthOn ? LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_LO);
}
padGrid.lightEx(7, 7, this.extraButtonsOn ? LaunchpadColorManager.LAUNCHPAD_COLOR_RED_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_RED_LO);
}
use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.
the class TouchstripCommand method updateValue.
/**
* {@inheritDoc}
*/
@Override
public void updateValue() {
if (this.surface.getViewManager().isActive(Views.SESSION)) {
this.surface.setRibbonValue(this.model.getValueChanger().toMidiValue(this.model.getTransport().getCrossfade()));
return;
}
final PushConfiguration config = this.surface.getConfiguration();
// Check if Note Repeat is active and its settings should be changed
final int ribbonNoteRepeat = config.getRibbonNoteRepeat();
if (config.isNoteRepeatActive() && ribbonNoteRepeat > PushConfiguration.NOTE_REPEAT_OFF) {
final Resolution[] values = Resolution.values();
final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
final double value = ribbonNoteRepeat == PushConfiguration.NOTE_REPEAT_PERIOD ? noteRepeat.getPeriod() : noteRepeat.getNoteLength();
final int index = Resolution.getMatch(value);
this.surface.setRibbonValue(127 - (int) Math.round(index * 127.0 / (values.length - 1)));
return;
}
switch(config.getRibbonMode()) {
case PushConfiguration.RIBBON_MODE_CC:
this.surface.setRibbonValue(this.pitchValue);
break;
case PushConfiguration.RIBBON_MODE_FADER:
final ITrack t = this.model.getCursorTrack();
this.surface.setRibbonValue(this.model.getValueChanger().toMidiValue(t.getVolume()));
break;
default:
this.surface.setRibbonValue(64);
break;
}
}
use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.
the class MidiModule method parseNoteRepeat.
/**
* Parse note repeat parameters.
*
* @param path The rest of the path
* @param value The value
* @throws MissingCommandException Could not find the sub-command
* @throws UnknownCommandException Unknown sub-command
* @throws IllegalParameterException Added an illegal parameter
*/
private void parseNoteRepeat(final LinkedList<String> path, final Object value) throws MissingCommandException, UnknownCommandException, IllegalParameterException {
final INoteInput noteInput = this.surface.getMidiInput().getDefaultNoteInput();
if (noteInput == null)
return;
final INoteRepeat noteRepeat = noteInput.getNoteRepeat();
final String subCommand = getSubCommand(path);
switch(subCommand) {
case "isActive":
noteRepeat.setActive(toInteger(value) > 0);
break;
case "period":
if (value == null)
throw new IllegalParameterException("Value must not be empty.");
final Resolution period = Resolution.getByName(value.toString());
if (period == null)
throw new IllegalParameterException("Value must be one of {1/4, 1/4t, 1/8, 1/8t, 1/16, 1/16t, 1/32, 1/32t}.");
noteRepeat.setPeriod(period.getValue());
break;
case "length":
if (value == null)
throw new IllegalParameterException("Value must not be empty.");
final Resolution length = Resolution.getByName(value.toString());
if (length == null)
throw new IllegalParameterException("Value must be one of {1/4, 1/4t, 1/8, 1/8t, 1/16, 1/16t, 1/32, 1/32t}.");
noteRepeat.setNoteLength(length.getValue());
break;
default:
throw new UnknownCommandException(subCommand);
}
}
use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.
the class NoteRepeatSceneHelper method getButtonColorID.
/**
* Get the color ID for a scene button, which is controlled by the view.
*
* @param surface The surface
* @param buttonID The ID of the button
* @return A color ID
*/
public static String getButtonColorID(final PushControlSurface surface, final ButtonID buttonID) {
final INoteRepeat noteRepeat = surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
final int sceneIndex = 7 - (buttonID.ordinal() - ButtonID.SCENE1.ordinal());
if (surface.isShiftPressed())
return Resolution.getMatch(noteRepeat.getNoteLength()) == sceneIndex ? PushColorManager.NOTE_REPEAT_LENGTH_HI : PushColorManager.NOTE_REPEAT_LENGTH_OFF;
return Resolution.getMatch(noteRepeat.getPeriod()) == sceneIndex ? PushColorManager.NOTE_REPEAT_PERIOD_HI : PushColorManager.NOTE_REPEAT_PERIOD_OFF;
}
Aggregations