use of de.mossgrabers.framework.daw.IHost 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.IHost in project DrivenByMoss by git-moss.
the class SLControllerSetup method createSurface.
/**
* {@inheritDoc}
*/
@Override
protected void createSurface() {
final IMidiAccess midiAccess = this.factory.createMidiAccess();
final IMidiOutput output = midiAccess.createOutput();
final IMidiInput input = midiAccess.createInput(this.isMkII ? "Novation SL MkII (Drumpads)" : "Novation SL MkI (Drumpads)", "90????", "80????");
final IMidiInput keyboardInput = midiAccess.createInput(1, this.isMkII ? "Novation SL MkII (Keyboard)" : "Novation SL MkI (Keyboard)", "80????", "90????", "B0????", "D0????", "E0????");
final IHost hostProxy = this.model.getHost();
final SLControlSurface surface = new SLControlSurface(hostProxy, this.colorManager, this.configuration, output, input, this.isMkII);
this.surfaces.add(surface);
surface.addPianoKeyboard(25, keyboardInput, true);
}
Aggregations