Search in sources :

Example 21 with IMidiInput

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

the class Kontrol1ControllerSetup method createSurface.

/**
 * {@inheritDoc}
 */
@Override
protected void createSurface() {
    final Kontrol1UsbDevice usbDevice = new Kontrol1UsbDevice(this.modelIndex, this.host);
    usbDevice.init();
    final IMidiAccess midiAccess = this.factory.createMidiAccess();
    final IMidiInput input = midiAccess.createInput("Komplete Kontrol 1", "80????", /* Note off */
    "90????", /* Note on */
    "B040??", "B001??", /* Sustain pedal + Modulation */
    "D0????", /* Channel After-touch */
    "E0????");
    final Kontrol1ControlSurface surface = new Kontrol1ControlSurface(this.host, this.colorManager, this.configuration, input, usbDevice);
    usbDevice.setCallback(surface);
    this.surfaces.add(surface);
    final Kontrol1Display display = new Kontrol1Display(this.host, this.valueChanger.getUpperBound(), this.configuration, usbDevice);
    surface.addTextDisplay(display);
    surface.getModeManager().setDefaultID(Modes.TRACK);
}
Also used : IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) Kontrol1Display(de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display) Kontrol1ControlSurface(de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1ControlSurface) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) Kontrol1UsbDevice(de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1UsbDevice)

Example 22 with IMidiInput

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

the class Kontrol1ControllerSetup method registerContinuousCommands.

/**
 * {@inheritDoc}
 */
@Override
protected void registerContinuousCommands() {
    final Kontrol1ControlSurface surface = this.getSurface();
    final IMidiInput input = surface.getMidiInput();
    for (int i = 0; i < 8; i++) {
        final IHwRelativeKnob knob = this.addRelativeKnob(ContinuousID.get(ContinuousID.KNOB1, i), "Knob " + (i + 1), new KnobRowModeCommand<>(i, this.model, surface), Kontrol1ControlSurface.ENCODER_1 + i);
        knob.bindTouch(new KnobRowTouchModeCommand<>(i, this.model, surface), input, BindType.CC, 0, Kontrol1ControlSurface.TOUCH_ENCODER_1 + i);
        knob.setIndexInGroup(i);
    }
    this.addRelativeKnob(ContinuousID.MASTER_KNOB, "Master", new MainEncoderCommand(this.model, surface), Kontrol1ControlSurface.MAIN_ENCODER);
    surface.addPianoKeyboard(25, input, true);
}
Also used : IHwRelativeKnob(de.mossgrabers.framework.controller.hardware.IHwRelativeKnob) Kontrol1ControlSurface(de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1ControlSurface) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) MainEncoderCommand(de.mossgrabers.controller.ni.kontrol.mki.command.continuous.MainEncoderCommand)

Example 23 with IMidiInput

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

the class KontrolProtocolControllerSetup method createSurface.

/**
 * {@inheritDoc}
 */
@Override
protected void createSurface() {
    final IMidiAccess midiAccess = this.factory.createMidiAccess();
    final IMidiOutput output = midiAccess.createOutput();
    final IMidiInput pianoInput = midiAccess.createInput(1, "Keyboard", "8?????", /* Note off */
    "9?????", /* Note on */
    "B?????", /* Sustain pedal + Modulation + Strip */
    "D?????", /* Channel After-touch */
    "E?????");
    final KontrolProtocolControlSurface surface = new KontrolProtocolControlSurface(this.host, this.colorManager, this.configuration, output, midiAccess.createInput(null), this.version);
    this.surfaces.add(surface);
    surface.addPianoKeyboard(49, pianoInput, true);
}
Also used : IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) KontrolProtocolControlSurface(de.mossgrabers.controller.ni.kontrol.mkii.controller.KontrolProtocolControlSurface)

Example 24 with IMidiInput

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

the class LaunchkeyMiniMk3ControllerSetup method createSurface.

/**
 * {@inheritDoc}
 */
@Override
protected void createSurface() {
    final IMidiAccess midiAccess = this.factory.createMidiAccess();
    final IMidiOutput output = midiAccess.createOutput();
    final IMidiInput input = midiAccess.createInput("Pads", "80????", "90????", "81????", "91????", "82????", "92????", "83????", "93????", "84????", "94????", "85????", "95????", "86????", "96????", "87????", "97????", "88????", "98????", "89????", "99????", "8A????", "9A????", "8B????", "9B????", "8C????", "9C????", "8D????", "9D????", "8E????", "9E????");
    this.inputKeys = midiAccess.createInput(1, "Keyboard", "8?????", /* Note off */
    "9?????", /* Note on */
    "B?01??", /* Modulation */
    "B?40??", /* Sustainpedal */
    "E?????");
    final LaunchkeyMiniMk3ControlSurface surface = new LaunchkeyMiniMk3ControlSurface(this.host, this.colorManager, this.configuration, output, input, this::processProgramChangeAction);
    this.surfaces.add(surface);
    surface.addPianoKeyboard(25, this.inputKeys, true);
    this.mvHelper = new MVHelper<>(this.model, surface);
}
Also used : IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) LaunchkeyMiniMk3ControlSurface(de.mossgrabers.controller.novation.launchkey.mini.controller.LaunchkeyMiniMk3ControlSurface)

Example 25 with IMidiInput

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

the class ChordsView method onGridNote.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNote(final int key, final int velocity) {
    if (this.playControls) {
        final int pos = key - this.scales.getStartNote();
        if (pos < 8) {
            final boolean isDown = velocity > 0;
            final IMidiInput midiInput = this.surface.getMidiInput();
            switch(pos) {
                // Sustain
                case 0:
                    this.isSustain = isDown;
                    midiInput.sendRawMidiEvent(0xB0, 64, this.isSustain ? 127 : 0);
                    return;
                // Pitch
                case 1:
                    this.isPitchDown = isDown;
                    midiInput.sendRawMidiEvent(0xE0, 0, this.isPitchDown ? Math.abs(velocity / 2 - 63) : 64);
                    return;
                case 2:
                    this.isPitchUp = isDown;
                    midiInput.sendRawMidiEvent(0xE0, 0, this.isPitchUp ? 64 + velocity / 2 : 64);
                    return;
                // Modulation
                default:
                    if (isDown) {
                        this.isModulation = pos - 3;
                        midiInput.sendRawMidiEvent(0xB0, 1, MODULATION_INTENSITIES[this.isModulation]);
                    }
                    return;
            }
        }
    }
    super.onGridNote(key, velocity);
}
Also used : IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput)

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