use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.
the class NoteInputHandler method getCommandValue.
/**
* {@inheritDoc}
*/
@Override
public int getCommandValue(final FlexiCommand command) {
final INoteInput noteInput = this.surface.getMidiInput().getDefaultNoteInput();
if (noteInput == null)
return -1;
final INoteRepeat noteRepeat = noteInput.getNoteRepeat();
final GenericFlexiConfiguration configuration = this.surface.getConfiguration();
switch(command) {
case NOTE_INPUT_REPEAT_ACTIVE:
return noteRepeat.isActive() ? 127 : 0;
case NOTE_INPUT_REPEAT_PERIOD:
return Resolution.getMatch(noteRepeat.getPeriod());
case NOTE_INPUT_REPEAT_LENGTH:
return Resolution.getMatch(noteRepeat.getNoteLength());
case NOTE_INPUT_REPEAT_MODE:
final ArpeggiatorMode am = noteRepeat.getMode();
final int index = configuration.getArpeggiatorModes().indexOf(am);
return Math.max(0, index);
case NOTE_INPUT_REPEAT_OCTAVE:
return noteRepeat.getOctaves();
case NOTE_INPUT_TRANSPOSE_OCTAVE_UP:
case NOTE_INPUT_TRANSPOSE_OCTAVE_DOWN:
return this.model.getScales().getOctave();
default:
return -1;
}
}
use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.
the class NoteRepeatView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
final IHost host = this.model.getHost();
// Note Repeat
final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
if (host.supports(Capability.NOTE_REPEAT_OCTAVES)) {
final int octaves = noteRepeat.getOctaves();
for (int i = 0; i < 8; i++) padGrid.light(36 + i, i == octaves ? MaschineColorManager.COLOR_GREEN : MaschineColorManager.COLOR_GREY);
} else {
for (int i = 36; i < 44; i++) padGrid.light(i, MaschineColorManager.COLOR_BLACK);
}
for (int i = 44; i < 52; i++) padGrid.light(i, MaschineColorManager.COLOR_BLACK);
// Note Repeat period
final int periodIndex = Resolution.getMatch(noteRepeat.getPeriod());
padGrid.light(79, periodIndex == 0 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(71, periodIndex == 2 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(63, periodIndex == 4 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(55, periodIndex == 6 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(80, periodIndex == 1 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
padGrid.light(72, periodIndex == 3 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
padGrid.light(64, periodIndex == 5 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
padGrid.light(56, periodIndex == 7 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
// Note Repeat length
if (host.supports(Capability.NOTE_REPEAT_LENGTH)) {
final int lengthIndex = Resolution.getMatch(noteRepeat.getNoteLength());
padGrid.light(81, lengthIndex == 0 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(73, lengthIndex == 2 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(65, lengthIndex == 4 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(57, lengthIndex == 6 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(82, lengthIndex == 1 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
padGrid.light(74, lengthIndex == 3 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
padGrid.light(66, lengthIndex == 5 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
padGrid.light(58, lengthIndex == 7 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
} else {
padGrid.light(81, MaschineColorManager.COLOR_BLACK);
padGrid.light(73, MaschineColorManager.COLOR_BLACK);
padGrid.light(65, MaschineColorManager.COLOR_BLACK);
padGrid.light(57, MaschineColorManager.COLOR_BLACK);
padGrid.light(82, MaschineColorManager.COLOR_BLACK);
padGrid.light(74, MaschineColorManager.COLOR_BLACK);
padGrid.light(66, MaschineColorManager.COLOR_BLACK);
padGrid.light(58, MaschineColorManager.COLOR_BLACK);
}
for (int i = 52; i < 55; i++) padGrid.light(i, MaschineColorManager.COLOR_BLACK);
for (int i = 59; i < 63; i++) padGrid.light(i, MaschineColorManager.COLOR_BLACK);
for (int i = 67; i < 71; i++) padGrid.light(i, MaschineColorManager.COLOR_BLACK);
padGrid.light(75, MaschineColorManager.COLOR_BLACK);
if (host.supports(Capability.NOTE_REPEAT_MODE)) {
// Note Repeat Octave
padGrid.light(76, MaschineColorManager.COLOR_LIME);
padGrid.light(77, MaschineColorManager.COLOR_LIME);
} else {
padGrid.light(76, MaschineColorManager.COLOR_BLACK);
padGrid.light(77, MaschineColorManager.COLOR_BLACK);
}
for (int i = 78; i < 79; i++) padGrid.light(i, MaschineColorManager.COLOR_BLACK);
for (int i = 83; i < 100; i++) padGrid.light(i, MaschineColorManager.COLOR_BLACK);
}
use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.
the class AbstractControllerSetup method createNoteRepeatObservers.
protected void createNoteRepeatObservers(final C conf, final S surface) {
final INoteInput defaultNoteInput = surface.getMidiInput().getDefaultNoteInput();
if (defaultNoteInput == null)
return;
final INoteRepeat noteRepeat = defaultNoteInput.getNoteRepeat();
conf.addSettingObserver(AbstractConfiguration.NOTEREPEAT_ACTIVE, () -> noteRepeat.setActive(conf.isNoteRepeatActive()));
conf.addSettingObserver(AbstractConfiguration.NOTEREPEAT_PERIOD, () -> noteRepeat.setPeriod(conf.getNoteRepeatPeriod().getValue()));
if (this.host.supports(Capability.NOTE_REPEAT_LENGTH))
conf.addSettingObserver(AbstractConfiguration.NOTEREPEAT_LENGTH, () -> noteRepeat.setNoteLength(conf.getNoteRepeatLength().getValue()));
if (this.host.supports(Capability.NOTE_REPEAT_MODE))
conf.addSettingObserver(AbstractConfiguration.NOTEREPEAT_MODE, () -> noteRepeat.setMode(conf.getNoteRepeatMode()));
if (this.host.supports(Capability.NOTE_REPEAT_OCTAVES))
conf.addSettingObserver(AbstractConfiguration.NOTEREPEAT_OCTAVE, () -> noteRepeat.setOctaves(conf.getNoteRepeatOctave()));
}
use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.
the class ShiftView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
final LaunchpadConfiguration configuration = this.surface.getConfiguration();
final ITransport transport = this.model.getTransport();
// Add tracks
padGrid.light(97, LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN);
padGrid.light(98, LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN_SPRING);
padGrid.light(99, LaunchpadColorManager.LAUNCHPAD_COLOR_TURQUOISE_CYAN);
// Accent on/off
padGrid.light(91, configuration.isAccentActive() ? LaunchpadColorManager.LAUNCHPAD_COLOR_YELLOW_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_YELLOW_LO);
// New clip length
final int clipLengthIndex = this.surface.getConfiguration().getNewClipLength();
for (int i = 0; i < 8; i++) padGrid.light(36 + i, i == clipLengthIndex ? LaunchpadColorManager.LAUNCHPAD_COLOR_WHITE : LaunchpadColorManager.LAUNCHPAD_COLOR_GREY_LO);
// Note Repeat
final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
padGrid.light(87, noteRepeat.isActive() ? LaunchpadColorManager.LAUNCHPAD_COLOR_ORCHID_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_ORCHID_LO);
// Note Repeat period
final int periodIndex = Resolution.getMatch(noteRepeat.getPeriod());
padGrid.light(79, periodIndex == 0 ? LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_LO);
padGrid.light(71, periodIndex == 2 ? LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_LO);
padGrid.light(63, periodIndex == 4 ? LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_LO);
padGrid.light(55, periodIndex == 6 ? LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_LO);
padGrid.light(80, periodIndex == 1 ? LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_LO);
padGrid.light(72, periodIndex == 3 ? LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_LO);
padGrid.light(64, periodIndex == 5 ? LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_LO);
padGrid.light(56, periodIndex == 7 ? LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_LO);
// Note Repeat length
final int lengthIndex = Resolution.getMatch(noteRepeat.getNoteLength());
padGrid.light(81, lengthIndex == 0 ? LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_LO);
padGrid.light(73, lengthIndex == 2 ? LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_LO);
padGrid.light(65, lengthIndex == 4 ? LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_LO);
padGrid.light(57, lengthIndex == 6 ? LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_LO);
padGrid.light(82, lengthIndex == 1 ? LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_LO);
padGrid.light(74, lengthIndex == 3 ? LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_LO);
padGrid.light(66, lengthIndex == 5 ? LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_LO);
padGrid.light(58, lengthIndex == 7 ? LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_LO);
// Stop all
padGrid.light(51, LaunchpadColorManager.LAUNCHPAD_COLOR_RED);
// Note Repeat Octave Range up/down
padGrid.light(88, LaunchpadColorManager.LAUNCHPAD_COLOR_RED);
padGrid.light(89, LaunchpadColorManager.LAUNCHPAD_COLOR_RED);
for (int i = 90; i < 91; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
if (this.surface.isPro()) {
for (int i = 44; i < 51; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
for (int i = 52; i < 55; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
for (int i = 59; i < 63; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
for (int i = 67; i < 71; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
for (int i = 75; i < 79; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
for (int i = 83; i < 87; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
for (int i = 92; i < 97; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
return;
}
// Record
padGrid.light(44, transport.isRecording() ? LaunchpadColorManager.LAUNCHPAD_COLOR_RED_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_RED_LO);
padGrid.light(45, transport.isLauncherOverdub() ? LaunchpadColorManager.LAUNCHPAD_COLOR_ROSE : LaunchpadColorManager.LAUNCHPAD_COLOR_WHITE);
for (int i = 46; i < 51; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
// Play / New
padGrid.light(52, transport.isPlaying() ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN_LO);
padGrid.light(53, LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN_SPRING);
padGrid.light(54, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
padGrid.light(59, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
// Duplicate
if (configuration.isDuplicateModeActive())
padGrid.light(60, LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE, LaunchpadColorManager.LAUNCHPAD_COLOR_OCEAN_BLUE, true);
else
padGrid.light(60, LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE);
// Double
padGrid.light(61, LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE_ORCHID);
padGrid.light(62, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
padGrid.light(67, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
// Quantize
padGrid.light(68, LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN);
// Record Quantization
padGrid.light(69, LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN_SPRING);
padGrid.light(70, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
padGrid.light(75, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
// Delete
if (configuration.isDeleteModeActive())
padGrid.light(76, LaunchpadColorManager.LAUNCHPAD_COLOR_MAGENTA, LaunchpadColorManager.LAUNCHPAD_COLOR_MAGENTA_PINK, true);
else
padGrid.light(76, LaunchpadColorManager.LAUNCHPAD_COLOR_MAGENTA);
padGrid.light(77, transport.isLoop() ? LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE_LO);
padGrid.light(78, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
padGrid.light(83, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
// Undo / Redo
padGrid.light(84, LaunchpadColorManager.LAUNCHPAD_COLOR_AMBER);
padGrid.light(85, LaunchpadColorManager.LAUNCHPAD_COLOR_AMBER_YELLOW);
padGrid.light(86, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
// Metronome
padGrid.light(92, transport.isMetronomeOn() ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN_LO);
// Tap Tempo
padGrid.light(93, LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN_SPRING);
for (int i = 94; i < 97; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
}
Aggregations