Search in sources :

Example 16 with IMidiInput

use of de.mossgrabers.framework.daw.midi.IMidiInput in project DrivenByMoss by git-moss.

the class GenericFlexiControllerSetup method createSurface.

/**
 * {@inheritDoc}
 */
@Override
protected void createSurface() {
    final IMidiAccess midiAccess = this.factory.createMidiAccess();
    final IMidiOutput output = midiAccess.createOutput();
    final String inputName;
    if (this.configuration.isMPEEndabled())
        inputName = "Generic Flexi (MPE)";
    else
        inputName = this.configuration.getKeyboardChannel() < 0 ? null : "Generic Flexi";
    final List<String> filters = this.getMidiFilters();
    final IMidiInput input = midiAccess.createInput(inputName, filters.toArray(new String[filters.size()]));
    final GenericFlexiControlSurface surface = new GenericFlexiControlSurface(this.host, this.configuration, this.colorManager, output, input);
    this.surfaces.add(surface);
    this.registerHandlers(surface);
    this.configuration.setCommandObserver(this);
}
Also used : GenericFlexiControlSurface(de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface) IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput)

Example 17 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/Pads", "82????", "92????", "A2????");
    // Sequencer 1 is on channel 1
    final INoteInput seqNoteInput = input.createNoteInput("Hardware Sequencer", "90????", "80????");
    final Integer[] table = new Integer[128];
    for (int i = 0; i < 128; i++) {
        // Block the Shift key
        table[i] = Integer.valueOf(i == 7 ? -1 : i);
    }
    seqNoteInput.setKeyTranslationTable(table);
    this.surfaces.add(new BeatstepControlSurface(this.host, this.colorManager, this.configuration, output, input));
}
Also used : IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) BeatstepControlSurface(de.mossgrabers.controller.arturia.beatstep.controller.BeatstepControlSurface) INoteInput(de.mossgrabers.framework.daw.midi.INoteInput)

Example 18 with IMidiInput

use of de.mossgrabers.framework.daw.midi.IMidiInput 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);
}
Also used : IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) IHost(de.mossgrabers.framework.daw.IHost) SLControlSurface(de.mossgrabers.controller.novation.sl.controller.SLControlSurface)

Example 19 with IMidiInput

use of de.mossgrabers.framework.daw.midi.IMidiInput in project DrivenByMoss by git-moss.

the class MaschineControllerSetup method createSurface.

/**
 * {@inheritDoc}
 */
@Override
protected void createSurface() {
    final IMidiAccess midiAccess = this.factory.createMidiAccess();
    final IMidiOutput output = midiAccess.createOutput();
    final IMidiInput input = midiAccess.createInput(this.maschine.getName(), "80????", "90????", "A0????", "D0????");
    final MaschineControlSurface surface = new MaschineControlSurface(this.host, this.colorManager, this.maschine, this.configuration, output, input);
    this.surfaces.add(surface);
    if (this.maschine.hasMCUDisplay()) {
        final MCUDisplay display = new MCUDisplay(this.host, output, true, false, false);
        display.setCenterNotification(false);
        surface.addTextDisplay(display);
    }
}
Also used : IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) MCUDisplay(de.mossgrabers.controller.mackie.mcu.controller.MCUDisplay) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) MaschineControlSurface(de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface)

Example 20 with IMidiInput

use of de.mossgrabers.framework.daw.midi.IMidiInput in project DrivenByMoss by git-moss.

the class LaunchkeyMk3ControllerSetup method registerTriggerCommands.

/**
 * {@inheritDoc}
 */
@Override
protected void registerTriggerCommands() {
    final LaunchkeyMk3ControlSurface surface = this.getSurface();
    final ITransport t = this.model.getTransport();
    final ViewManager viewManager = surface.getViewManager();
    this.addButton(ButtonID.SHIFT, "Shift", NopCommand.INSTANCE, LaunchkeyMk3ControlSurface.LAUNCHKEY_SHIFT);
    this.addButton(ButtonID.PLAY, "Play", new LaunchkeyMk3PlayCommand(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_PLAY, t::isPlaying);
    this.addButton(ButtonID.STOP, "Stop", new StopCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_STOP, () -> !t.isPlaying());
    final ConfiguredRecordCommand<LaunchkeyMk3ControlSurface, LaunchkeyMk3Configuration> recordCommand = new ConfiguredRecordCommand<>(this.model, surface);
    this.addButton(ButtonID.RECORD, "Record", recordCommand, 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_RECORD, recordCommand::isLit);
    this.addButton(ButtonID.REPEAT, "Repeat", new ToggleLoopCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_LOOP, t::isLoop);
    this.addButton(ButtonID.NEW, "Capture MIDI", new NewCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_CAPTURE_MIDI);
    this.addButton(ButtonID.QUANTIZE, "Quantize", new QuantizeCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_QUANTIZE);
    this.addButton(ButtonID.METRONOME, "Metronome", new MetronomeCommand<>(this.model, surface, true), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_CLICK, t::isMetronomeOn);
    this.addButton(ButtonID.UNDO, "Undo", new UndoCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_UNDO);
    this.addDummyButton(ButtonID.F3, 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_DEVICE_SELECT);
    this.addButton(ButtonID.TOGGLE_DEVICE, "Device Lock", new DeviceLockCommand(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_DEVICE_LOCK, () -> this.model.getCursorDevice().isPinned() ? 127 : 40);
    this.addButton(ButtonID.MOVE_TRACK_LEFT, "Previous", new SelectPrevNextTrackCommand<>(this.model, surface, true), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_TRACK_LEFT);
    this.addButton(ButtonID.MOVE_TRACK_RIGHT, "Next", new SelectPrevNextTrackCommand<>(this.model, surface, false), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_TRACK_RIGHT);
    // Scene buttons
    this.addButton(ButtonID.SCENE1, "Scene 1", new ViewButtonCommand<>(ButtonID.SCENE1, surface), LaunchkeyMk3ControlSurface.LAUNCHKEY_SCENE1, new FeatureGroupButtonColorSupplier(viewManager, ButtonID.SCENE1));
    this.addButton(ButtonID.SCENE2, "Scene 2", new ViewButtonCommand<>(ButtonID.SCENE2, surface), LaunchkeyMk3ControlSurface.LAUNCHKEY_SCENE2, new FeatureGroupButtonColorSupplier(viewManager, ButtonID.SCENE2));
    this.addButton(surface, ButtonID.ARROW_UP, "Up", new ViewButtonCommand<>(ButtonID.ARROW_UP, surface), 15, 0, LaunchkeyMk3ControlSurface.LAUNCHKEY_ARROW_UP, -1, true, new FeatureGroupButtonColorSupplier(viewManager, ButtonID.ARROW_UP));
    this.addButton(surface, ButtonID.ARROW_DOWN, "Down", new ViewButtonCommand<>(ButtonID.ARROW_DOWN, surface), 15, 0, LaunchkeyMk3ControlSurface.LAUNCHKEY_ARROW_DOWN, -1, true, new FeatureGroupButtonColorSupplier(viewManager, ButtonID.ARROW_DOWN));
    // Ignore redundant messages sent by arrow up/down buttons
    this.addDummyButton(ButtonID.F1, 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_SCENE1);
    this.addDummyButton(ButtonID.F2, 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_SCENE2);
    // View selection with Pads in Shift mode
    this.createViewButton(ButtonID.ROW2_1, OutputID.LED_RING1, "Session", Views.SESSION, LaunchkeyMk3ControlSurface.PAD_MODE_SESSION);
    this.createViewButton(ButtonID.ROW2_2, OutputID.LED_RING2, "Drum", Views.DRUM, LaunchkeyMk3ControlSurface.PAD_MODE_DRUM);
    this.createViewButton(ButtonID.ROW2_3, OutputID.LED_RING3, "Scale Chords", Views.DUMMY1, LaunchkeyMk3ControlSurface.PAD_MODE_SCALE_CHORDS);
    this.createViewButton(ButtonID.ROW2_4, OutputID.LED_RING4, "User Chords", Views.DUMMY2, LaunchkeyMk3ControlSurface.PAD_MODE_USER_CHORDS);
    this.createViewButton(ButtonID.ROW2_5, OutputID.LED_RING5, NAME_CUSTOM_1, Views.DUMMY3, LaunchkeyMk3ControlSurface.PAD_MODE_CUSTOM_MODE0);
    this.createViewButton(ButtonID.ROW2_6, OutputID.LED_RING6, NAME_CUSTOM_2, Views.DUMMY4, LaunchkeyMk3ControlSurface.PAD_MODE_CUSTOM_MODE1);
    this.createViewButton(ButtonID.ROW2_7, OutputID.LED_RING7, NAME_CUSTOM_3, Views.DUMMY5, LaunchkeyMk3ControlSurface.PAD_MODE_CUSTOM_MODE2);
    this.createViewButton(ButtonID.ROW2_8, OutputID.LED_RING8, NAME_CUSTOM_4, Views.DUMMY6, LaunchkeyMk3ControlSurface.PAD_MODE_CUSTOM_MODE3);
    this.createViewButton(ButtonID.DEVICE, OutputID.LED_RING9, "Device Select", Views.DEVICE, LaunchkeyMk3ControlSurface.PAD_MODE_DEVICE_SELECT);
    this.createViewButton(ButtonID.BROWSE, OutputID.LED_RING10, "Browser", Views.BROWSER, LaunchkeyMk3ControlSurface.PAD_MODE_NAVIGATION);
    // Knob mode selection with Pads in Shift mode
    this.createModeButton(ButtonID.ROW1_1, OutputID.LED1, "Device", Modes.DEVICE_PARAMS, LaunchkeyMk3ControlSurface.KNOB_MODE_PARAMS);
    this.createModeButton(ButtonID.ROW1_2, OutputID.LED2, "Volume", Modes.VOLUME, LaunchkeyMk3ControlSurface.KNOB_MODE_VOLUME);
    this.createModeButton(ButtonID.ROW1_3, OutputID.LED3, "Pan", Modes.PAN, LaunchkeyMk3ControlSurface.KNOB_MODE_PAN);
    this.createModeButton(ButtonID.ROW1_4, OutputID.LED4, "Send 1", Modes.SEND1, LaunchkeyMk3ControlSurface.KNOB_MODE_SEND1);
    this.createModeButton(ButtonID.ROW1_5, OutputID.LED5, "Send 2", Modes.SEND2, LaunchkeyMk3ControlSurface.KNOB_MODE_SEND2);
    this.createModeButton(ButtonID.ROW1_6, OutputID.LED6, NAME_CUSTOM_1, Modes.DEVICE_LAYER_SEND1, LaunchkeyMk3ControlSurface.KNOB_MODE_CUSTOM1);
    this.createModeButton(ButtonID.ROW1_7, OutputID.LED7, NAME_CUSTOM_2, Modes.DEVICE_LAYER_SEND2, LaunchkeyMk3ControlSurface.KNOB_MODE_CUSTOM2);
    this.createModeButton(ButtonID.ROW1_8, OutputID.LED8, NAME_CUSTOM_3, Modes.DEVICE_LAYER_SEND3, LaunchkeyMk3ControlSurface.KNOB_MODE_CUSTOM3);
    this.createModeButton(ButtonID.USER, OutputID.LED9, NAME_CUSTOM_4, Modes.DEVICE_LAYER_SEND4, LaunchkeyMk3ControlSurface.KNOB_MODE_CUSTOM4);
    // Fader mode selection with fader buttons in Shift mode
    this.createFaderModeButton(ButtonID.ROW3_1, OutputID.LIGHT_GUIDE1, "Device", Modes.DEVICE_PARAMS, LaunchkeyMk3ControlSurface.FADER_MODE_PARAMS);
    this.createFaderModeButton(ButtonID.ROW3_2, OutputID.LIGHT_GUIDE2, "Volume", Modes.VOLUME, LaunchkeyMk3ControlSurface.FADER_MODE_VOLUME);
    this.createFaderModeButton(ButtonID.ROW3_3, OutputID.LIGHT_GUIDE3, "Send 1", Modes.SEND1, LaunchkeyMk3ControlSurface.FADER_MODE_SEND1);
    this.createFaderModeButton(ButtonID.ROW3_4, OutputID.LIGHT_GUIDE4, "Send 2", Modes.SEND2, LaunchkeyMk3ControlSurface.FADER_MODE_SEND2);
    this.createFaderModeButton(ButtonID.ROW3_5, OutputID.LIGHT_GUIDE5, NAME_CUSTOM_1, Modes.DEVICE_LAYER_SEND1, LaunchkeyMk3ControlSurface.FADER_MODE_CUSTOM1);
    this.createFaderModeButton(ButtonID.ROW3_6, OutputID.LIGHT_GUIDE6, NAME_CUSTOM_2, Modes.DEVICE_LAYER_SEND2, LaunchkeyMk3ControlSurface.FADER_MODE_CUSTOM2);
    this.createFaderModeButton(ButtonID.ROW3_7, OutputID.LIGHT_GUIDE7, NAME_CUSTOM_3, Modes.DEVICE_LAYER_SEND3, LaunchkeyMk3ControlSurface.FADER_MODE_CUSTOM3);
    this.createFaderModeButton(ButtonID.ROW3_8, OutputID.LIGHT_GUIDE8, NAME_CUSTOM_4, Modes.DEVICE_LAYER_SEND4, LaunchkeyMk3ControlSurface.FADER_MODE_CUSTOM4);
    // Fader mode buttons
    for (int i = 0; i < 8; i++) {
        final ButtonID row1ButtonID = ButtonID.get(ButtonID.ROW_SELECT_1, i);
        final IHwButton button = surface.createButton(row1ButtonID, "Select " + (i + 1));
        final ButtonAreaCommand command = new ButtonAreaCommand(i, this.model, surface);
        button.bind(command);
        final IMidiInput midiInput = surface.getMidiInput();
        final BindType triggerBindType = this.getTriggerBindType(row1ButtonID);
        final int midiControl = LaunchkeyMk3ControlSurface.LAUNCHKEY_SELECT1 + i;
        button.bind(midiInput, triggerBindType, 15, midiControl);
        final IntSupplier supplier = command::getButtonColor;
        surface.createLight(null, supplier::getAsInt, color -> surface.setTrigger(color >= 0x1000 ? 2 : 0, midiControl, color >= 0x1000 ? color - 0x1000 : color), state -> this.colorManager.getColor(state >= 0x1000 ? state - 0x1000 : state, row1ButtonID), button);
    }
    this.addButton(surface, ButtonID.MASTERTRACK, "Toggle Select/RecArm", (event, velocity) -> {
        if (event == ButtonEvent.DOWN)
            ButtonAreaCommand.toggleSelect();
    }, 15, 0, LaunchkeyMk3ControlSurface.LAUNCHKEY_TOGGLE_SELECT, -1, true, () -> ButtonAreaCommand.isSelect() ? 40 : 127);
    // Online state
    this.addButton(ButtonID.CONTROL, "DAW Online", (event, velocity) -> surface.setDAWConnected(velocity > 0), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_DAW_ONLINE, surface::isDAWConnected);
}
Also used : LaunchkeyMk3ControlSurface(de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3ControlSurface) IntSupplier(java.util.function.IntSupplier) ITransport(de.mossgrabers.framework.daw.ITransport) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) ConfiguredRecordCommand(de.mossgrabers.framework.command.trigger.transport.ConfiguredRecordCommand) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) LaunchkeyMk3PlayCommand(de.mossgrabers.controller.novation.launchkey.maxi.command.trigger.LaunchkeyMk3PlayCommand) ButtonID(de.mossgrabers.framework.controller.ButtonID) BindType(de.mossgrabers.framework.controller.hardware.BindType) IHwButton(de.mossgrabers.framework.controller.hardware.IHwButton) ButtonAreaCommand(de.mossgrabers.controller.novation.launchkey.maxi.command.trigger.ButtonAreaCommand) DeviceLockCommand(de.mossgrabers.controller.novation.launchkey.maxi.command.trigger.DeviceLockCommand) ButtonEvent(de.mossgrabers.framework.utils.ButtonEvent) List(java.util.List) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) ArrayList(java.util.ArrayList) ITransport(de.mossgrabers.framework.daw.ITransport) IHost(de.mossgrabers.framework.daw.IHost) IHwLight(de.mossgrabers.framework.controller.hardware.IHwLight) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) FeatureGroupButtonColorSupplier(de.mossgrabers.framework.command.trigger.view.FeatureGroupButtonColorSupplier)

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