Search in sources :

Example 6 with IMidiInput

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

the class SLMkIIIControllerSetup method createSurface.

/**
 * {@inheritDoc}
 */
@Override
protected void createSurface() {
    final IMidiAccess midiAccess = this.factory.createMidiAccess();
    final IMidiOutput output = midiAccess.createOutput();
    final IMidiInput keyboardInput = midiAccess.createInput(1, "Keyboard", "8?????", "9?????", "B?????", "D?????", "E?????");
    final IHost hostProxy = this.model.getHost();
    final IMidiInput input = midiAccess.createInput("Pads", "8?????", "9?????");
    final SLMkIIILightGuide lightGuide = new SLMkIIILightGuide(this.model, this.colorManager, output);
    final SLMkIIIControlSurface surface = new SLMkIIIControlSurface(hostProxy, this.colorManager, this.configuration, output, input, lightGuide);
    this.surfaces.add(surface);
    surface.addPianoKeyboard(61, keyboardInput, true);
    keyboardInput.setMidiCallback((status, data1, data2) -> {
        final int code = status & 0xF0;
        if (code == 0x80 || code == 0x90)
            lightGuide.updateKeyboardNote(data1, data2);
    });
}
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) SLMkIIILightGuide(de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIILightGuide) SLMkIIIControlSurface(de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIControlSurface)

Example 7 with IMidiInput

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

the class OSCControllerSetup method createSurface.

/**
 * {@inheritDoc}
 */
@Override
protected void createSurface() {
    final IMidiAccess midiAccess = this.factory.createMidiAccess();
    final IMidiInput input = midiAccess.createInput("OSC");
    final OSCControlSurface surface = new OSCControlSurface(this.host, this.configuration, this.colorManager, input);
    surface.addTextDisplay(new DummyDisplay(this.host));
    this.surfaces.add(surface);
    this.keyManager = new KeyManager(this.model, this.model.getScales(), surface.getPadGrid());
    // Send OSC messages
    final String sendHost = this.configuration.getSendHost();
    final int sendPort = this.configuration.getSendPort();
    this.host.println(String.format("Connecting to OSC server %s:%d", sendHost, Integer.valueOf(sendPort)));
    final IOpenSoundControlClient oscClient = this.host.connectToOSCServer(sendHost, sendPort);
    this.writer = new OSCWriter(this.host, this.model, oscClient, this.configuration);
    // Receive OSC messages
    final OSCParser parser = new OSCParser(this.host, surface, this.model, this.configuration, this.writer, input, this.keyManager);
    final List<IModule> modules = new ArrayList<>();
    modules.add(new TransportModule(this.host, this.model, surface, this.writer));
    modules.add(new GlobalModule(this.host, this.model, this.writer));
    modules.add(new LayoutModule(this.host, this.model, this.writer));
    modules.add(new MarkerModule(this.host, this.model, this.writer));
    modules.add(new ProjectModule(this.host, this.model, this.writer));
    modules.add(new TrackModule(this.host, this.model, this.writer, this.configuration));
    modules.add(new SceneModule(this.host, this.model, this.writer));
    modules.add(new DeviceModule(this.host, this.model, this.writer, this.configuration));
    modules.add(new BrowserModule(this.host, this.model, this.writer));
    modules.add(new MidiModule(this.host, this.model, surface, this.writer, this.keyManager));
    modules.add(new UserModule(this.host, this.model, this.writer));
    modules.add(new ActionModule(this.host, this.model, this.writer, this.configuration));
    modules.add(new ClipModule(this.host, this.model, this.writer));
    modules.forEach(module -> {
        this.writer.registerModule(module);
        parser.registerModule(module);
    });
    this.oscServer = this.host.createOSCServer(parser);
}
Also used : IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IModule(de.mossgrabers.controller.osc.module.IModule) TransportModule(de.mossgrabers.controller.osc.module.TransportModule) ActionModule(de.mossgrabers.controller.osc.module.ActionModule) ArrayList(java.util.ArrayList) MarkerModule(de.mossgrabers.controller.osc.module.MarkerModule) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) UserModule(de.mossgrabers.controller.osc.module.UserModule) TrackModule(de.mossgrabers.controller.osc.module.TrackModule) KeyManager(de.mossgrabers.framework.utils.KeyManager) GlobalModule(de.mossgrabers.controller.osc.module.GlobalModule) ClipModule(de.mossgrabers.controller.osc.module.ClipModule) LayoutModule(de.mossgrabers.controller.osc.module.LayoutModule) SceneModule(de.mossgrabers.controller.osc.module.SceneModule) OSCParser(de.mossgrabers.controller.osc.protocol.OSCParser) BrowserModule(de.mossgrabers.controller.osc.module.BrowserModule) MidiModule(de.mossgrabers.controller.osc.module.MidiModule) IOpenSoundControlClient(de.mossgrabers.framework.osc.IOpenSoundControlClient) ProjectModule(de.mossgrabers.controller.osc.module.ProjectModule) DeviceModule(de.mossgrabers.controller.osc.module.DeviceModule) DummyDisplay(de.mossgrabers.framework.controller.display.DummyDisplay) OSCWriter(de.mossgrabers.controller.osc.protocol.OSCWriter)

Example 8 with IMidiInput

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

the class PlayView 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)

Example 9 with IMidiInput

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

the class MidiMonitorSetup method createSurface.

/**
 * {@inheritDoc}
 */
@Override
protected void createSurface() {
    final IMidiAccess midiAccess = this.factory.createMidiAccess();
    final IMidiInput input = midiAccess.createInput("Midi Monitor");
    this.surfaces.add(new MidiMonitorControlSurface(this.host, this.configuration, input));
}
Also used : IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) MidiMonitorControlSurface(de.mossgrabers.controller.utilities.midimonitor.controller.MidiMonitorControlSurface)

Example 10 with IMidiInput

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

the class AbstractChordView method onGridNote.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNote(final int key, final int velocity) {
    if (!this.model.canSelectedTrackHoldNotes())
        return;
    super.onGridNote(key, velocity);
    final int index = key - 36;
    final int row = index / this.surface.getPadGrid().getCols();
    final int note = this.keyManager.map(key);
    final int[] chord = this.scales.getChord(note, CHORD_INTERVALS[row]);
    // Send additional chord notes to the DAW
    final IMidiInput input = this.surface.getMidiInput();
    final C config = this.surface.getConfiguration();
    final int channel = config.getMidiEditChannel();
    int vel = 0;
    if (velocity > 0)
        vel = config.isAccentActive() ? config.getFixedAccentValue() : velocity;
    for (final int element : chord) input.sendRawMidiEvent(0x90 + channel, element, vel);
}
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