Search in sources :

Example 11 with IMidiInput

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);
}
Also used : IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) LaunchkeyMk3ControlSurface(de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3ControlSurface) LaunchkeyMk3Display(de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3Display) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) ArrayList(java.util.ArrayList)

Example 12 with IMidiInput

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);
    }
}
Also used : IntSupplier(java.util.function.IntSupplier) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) BindType(de.mossgrabers.framework.controller.hardware.BindType) IHwButton(de.mossgrabers.framework.controller.hardware.IHwButton)

Example 13 with IMidiInput

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));
}
Also used : IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) DummyDisplay(de.mossgrabers.framework.controller.display.DummyDisplay) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) BeatstepControlSurface(de.mossgrabers.beatstep.controller.BeatstepControlSurface)

Example 14 with IMidiInput

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);
}
Also used : IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) PushControlSurface(de.mossgrabers.push.controller.PushControlSurface)

Example 15 with IMidiInput

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();
}
Also used : IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) DummyDisplay(de.mossgrabers.framework.controller.display.DummyDisplay) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) LaunchpadControlSurface(de.mossgrabers.launchpad.controller.LaunchpadControlSurface)

Aggregations

IMidiInput (de.mossgrabers.framework.daw.midi.IMidiInput)25 IMidiAccess (de.mossgrabers.framework.daw.midi.IMidiAccess)18 IMidiOutput (de.mossgrabers.framework.daw.midi.IMidiOutput)16 DummyDisplay (de.mossgrabers.framework.controller.display.DummyDisplay)5 IHost (de.mossgrabers.framework.daw.IHost)4 ArrayList (java.util.ArrayList)3 Kontrol1ControlSurface (de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1ControlSurface)2 LaunchkeyMk3ControlSurface (de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3ControlSurface)2 BindType (de.mossgrabers.framework.controller.hardware.BindType)2 IHwButton (de.mossgrabers.framework.controller.hardware.IHwButton)2 APCControlSurface (de.mossgrabers.apc.controller.APCControlSurface)1 APCminiControlSurface (de.mossgrabers.apcmini.controller.APCminiControlSurface)1 BeatstepControlSurface (de.mossgrabers.beatstep.controller.BeatstepControlSurface)1 BeatstepControlSurface (de.mossgrabers.controller.arturia.beatstep.controller.BeatstepControlSurface)1 GenericFlexiControlSurface (de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface)1 MCUDisplay (de.mossgrabers.controller.mackie.mcu.controller.MCUDisplay)1 MainEncoderCommand (de.mossgrabers.controller.ni.kontrol.mki.command.continuous.MainEncoderCommand)1 Kontrol1Display (de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display)1 Kontrol1UsbDevice (de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1UsbDevice)1 KontrolProtocolControlSurface (de.mossgrabers.controller.ni.kontrol.mkii.controller.KontrolProtocolControlSurface)1