use of de.mossgrabers.framework.daw.midi.IMidiInput in project DrivenByMoss by git-moss.
the class LaunchkeyMk3ControllerSetup method createSurface.
/**
* {@inheritDoc}
*/
@Override
protected void createSurface() {
final IMidiAccess midiAccess = this.factory.createMidiAccess();
final IMidiOutput output = midiAccess.createOutput();
// A bit tricky to exclude only channel 16...
final List<String> filters = new ArrayList<>();
for (int i = 0; i < 15; i++) {
filters.add(StringUtils.toHexStr(0x80 + i) + "????");
filters.add(StringUtils.toHexStr(0x90 + i) + "????");
}
final IMidiInput input = midiAccess.createInput("Pads", filters.toArray(new String[filters.size()]));
final IMidiInput inputKeys = midiAccess.createInput(1, "Keyboard", "8?????", /* Note off */
"9?????", /* Note on */
"A?????", /* Polyphonic After-touch */
"B?01??", /* Modulation */
"C?????", /* Program change */
"B?40??", /* Sustain pedal */
"D?????", /* Channel After-touch */
"E?????");
final LaunchkeyMk3ControlSurface surface = new LaunchkeyMk3ControlSurface(this.host, this.colorManager, this.configuration, output, input);
this.surfaces.add(surface);
surface.addTextDisplay(new LaunchkeyMk3Display(this.host, output));
surface.addPianoKeyboard(25, inputKeys, true);
}
use of de.mossgrabers.framework.daw.midi.IMidiInput in project DrivenByMoss by git-moss.
the class AbstractControllerSetup method addButton.
/**
* Create a hardware button proxy, bind a trigger command to it and bind it to the trigger bind
* type retrieved from {@link #getTriggerBindType(ButtonID)}.
*
* @param surface The control surface
* @param buttonID The ID of the button (for later access)
* @param label The label of the button
* @param supplier Callback for retrieving the state of the light
* @param midiInputChannel The MIDI input channel
* @param midiOutputChannel The MIDI output channel
* @param midiControl The MIDI CC or note
* @param value The specific value of the control to bind to
* @param command The command to bind
* @param hasLight True create and add a light
* @param colorIds The color IDs to map to the states
*/
protected void addButton(final S surface, final ButtonID buttonID, final String label, final TriggerCommand command, final int midiInputChannel, final int midiOutputChannel, final int midiControl, final int value, final boolean hasLight, final IntSupplier supplier, final String... colorIds) {
final IHwButton button = surface.createButton(buttonID, label);
button.bind(command);
if (midiControl < 0)
return;
final IMidiInput midiInput = surface.getMidiInput();
final BindType triggerBindType = this.getTriggerBindType(buttonID);
if (value == -1)
button.bind(midiInput, triggerBindType, midiInputChannel, midiControl);
else
button.bind(midiInput, triggerBindType, midiInputChannel, midiControl, value);
if (hasLight) {
final IntSupplier intSupplier = () -> button.isPressed() ? 1 : 0;
final IntSupplier supp = supplier == null ? intSupplier : supplier;
this.addLight(surface, null, buttonID, button, midiOutputChannel, midiControl, supp, colorIds);
}
}
use of de.mossgrabers.framework.daw.midi.IMidiInput in project DrivenByMoss by git-moss.
the class BeatstepControllerSetup method createSurface.
/**
* {@inheritDoc}
*/
@Override
protected void createSurface() {
final IMidiAccess midiAccess = this.factory.createMidiAccess();
final IMidiOutput output = midiAccess.createOutput();
final IMidiInput input = midiAccess.createInput("Control", "82????", "92????", "A2????", "B2????");
// Sequencer 1 is on channel 1
input.createNoteInput("Seq. 1", "90????", "80????");
// Setup the 2 note sequencers and 1 drum sequencer
if (this.isPro) {
// Sequencer 2 is on channel 2
input.createNoteInput("Seq. 2", "91????", "81????");
// Drum Sequencer is on channel 10
input.createNoteInput("Drums", "99????", "89????");
}
final BeatstepControlSurface surface = new BeatstepControlSurface(this.model.getHost(), this.colorManager, this.configuration, output, input, this.isPro);
this.surfaces.add(surface);
surface.setDisplay(new DummyDisplay(this.host));
}
use of de.mossgrabers.framework.daw.midi.IMidiInput in project DrivenByMoss by git-moss.
the class PushControllerSetup method createSurface.
/**
* {@inheritDoc}
*/
@Override
protected void createSurface() {
final IMidiAccess midiAccess = this.factory.createMidiAccess();
final IMidiOutput output = midiAccess.createOutput();
final IMidiInput input = midiAccess.createInput(this.isPush2 ? "Ableton Push 2" : "Ableton Push 1", "80????", /* Note off */
"90????", /* Note on */
"B040??");
final PushControlSurface surface = new PushControlSurface(this.model.getHost(), this.colorManager, this.configuration, output, input);
this.surfaces.add(surface);
surface.setDisplay(this.createDisplay(output));
surface.getModeManager().setDefaultMode(Modes.MODE_TRACK);
}
use of de.mossgrabers.framework.daw.midi.IMidiInput in project DrivenByMoss by git-moss.
the class LaunchpadControllerSetup method createSurface.
/**
* {@inheritDoc}
*/
@Override
protected void createSurface() {
final IMidiAccess midiAccess = this.factory.createMidiAccess();
final IMidiOutput output = midiAccess.createOutput();
final IMidiInput input = midiAccess.createInput(this.isPro ? "Novation Launchpad Pro" : "Novation Launchpad MkII", "80????", /* Note off */
"90????");
final LaunchpadControlSurface surface = new LaunchpadControlSurface(this.model.getHost(), this.colorManager, this.configuration, output, input, this.isPro);
this.surfaces.add(surface);
surface.setDisplay(new DummyDisplay(this.host));
surface.setLaunchpadToStandalone();
}
Aggregations