use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.
the class TouchstripCommand method onPitchbend.
/**
* {@inheritDoc}
*/
@Override
public void onPitchbend(final int data1, final int data2) {
if (this.surface.getViewManager().isActive(Views.SESSION)) {
final int value = this.surface.isShiftPressed() ? 63 : data2;
this.model.getTransport().setCrossfade(this.model.getValueChanger().toDAWValue(value));
this.surface.setRibbonValue(value);
return;
}
// Don't get in the way of configuration
if (this.surface.isShiftPressed())
return;
final PushConfiguration config = this.surface.getConfiguration();
final double scaled = data2 / 127.0;
// 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 int index = (int) Math.round(scaled * (values.length - 1));
final double value = values[values.length - 1 - index].getValue();
final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
if (ribbonNoteRepeat == PushConfiguration.NOTE_REPEAT_PERIOD)
noteRepeat.setPeriod(value);
else
noteRepeat.setNoteLength(value);
return;
}
switch(config.getRibbonMode()) {
case PushConfiguration.RIBBON_MODE_PITCH:
this.surface.sendMidiEvent(0xE0, data1, data2);
break;
case PushConfiguration.RIBBON_MODE_CC:
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), data2);
this.pitchValue = data2;
break;
case PushConfiguration.RIBBON_MODE_CC_PB:
if (data2 > 64)
this.surface.sendMidiEvent(0xE0, data1, data2);
else if (data2 < 64)
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 127 - data2 * 2);
else {
this.surface.sendMidiEvent(0xE0, data1, data2);
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 0);
}
break;
case PushConfiguration.RIBBON_MODE_PB_CC:
if (data2 > 64)
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), (data2 - 64) * 2);
else if (data2 < 64)
this.surface.sendMidiEvent(0xE0, data1, data2);
else {
this.surface.sendMidiEvent(0xE0, data1, data2);
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 0);
}
break;
case PushConfiguration.RIBBON_MODE_FADER:
this.model.getCursorTrack().setVolume(this.model.getValueChanger().toDAWValue(data2));
return;
default:
// Not used
break;
}
this.surface.getMidiOutput().sendPitchbend(data1, data2);
}
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 NoteRepeatSceneHelper method handleNoteRepeatSelection.
/**
* Handle the note repeat selection (period and note length).
*
* @param surface The surface
* @param sceneIndex The index of the scene
*/
public static void handleNoteRepeatSelection(final PushControlSurface surface, final int sceneIndex) {
surface.setTriggerConsumed(ButtonID.REPEAT);
final INoteRepeat noteRepeat = surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
if (surface.isShiftPressed())
noteRepeat.setNoteLength(Resolution.getValueAt(sceneIndex));
else
noteRepeat.setPeriod(Resolution.getValueAt(sceneIndex));
}
use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.
the class TouchstripCommand method updateValue.
/**
* Update the LED value of the ribbon strip.
*/
public void updateValue() {
final RibbonMode ribbonMode = this.surface.getConfiguration().getRibbonMode();
switch(ribbonMode) {
case PITCH_DOWN:
case PITCH_UP:
case PITCH_DOWN_UP:
case CC_1:
case CC_11:
this.surface.setRibbonValue(this.ribbonValue);
break;
case MASTER_VOLUME:
final ITrack t = this.model.getMasterTrack();
this.surface.setRibbonValue(t == null ? 0 : this.model.getValueChanger().toMidiValue(t.getVolume()));
break;
case NOTE_REPEAT_PERIOD:
case NOTE_REPEAT_LENGTH:
final Resolution[] values = Resolution.values();
final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
final double value = ribbonMode == RibbonMode.NOTE_REPEAT_PERIOD ? noteRepeat.getPeriod() : noteRepeat.getNoteLength();
final int index = Resolution.getMatch(value);
this.surface.setRibbonValue((int) Math.round(index * 127.0 / (values.length - 1)));
break;
default:
// Not used
break;
}
}
Aggregations