Search in sources :

Example 1 with IHost

use of de.mossgrabers.framework.daw.IHost 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????");
    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);
    surface.setDisplay(new SLDisplay(hostProxy, output));
    this.surfaces.add(surface);
}
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.sl.controller.SLControlSurface) SLDisplay(de.mossgrabers.sl.controller.SLDisplay)

Example 2 with IHost

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

the class ParameterView method executeFunction.

/**
 * {@inheritDoc}
 */
@Override
protected void executeFunction(final int padIndex) {
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final IHost host = this.model.getHost();
    if (!cursorDevice.doesExist()) {
        host.showNotification("No device selected.");
        return;
    }
    switch(padIndex) {
        case 12:
            cursorDevice.selectPrevious();
            break;
        case 13:
            cursorDevice.selectNext();
            break;
        case 14:
            cursorDevice.getParameterBank().scrollBackwards();
            this.mvHelper.notifySelectedParameterPage();
            break;
        case 15:
            cursorDevice.getParameterBank().scrollForwards();
            this.mvHelper.notifySelectedParameterPage();
            break;
        default:
            // Not used
            break;
    }
    if (padIndex >= 8)
        return;
    // Flip row 2 and 1 to look the same as in the Bitwig device display
    final int selectedParameter = padIndex < 4 ? padIndex + 4 : padIndex - 4;
    ((SelectedDeviceMode<?, ?>) this.surface.getModeManager().get(Modes.DEVICE_PARAMS)).selectParameter(selectedParameter);
    this.model.getHost().scheduleTask(() -> {
        final StringBuilder message = new StringBuilder();
        final Optional<String> selectedPage = cursorDevice.getParameterPageBank().getSelectedItem();
        if (selectedPage.isEmpty())
            message.append("No parameters available.");
        else {
            message.append(selectedPage.get()).append(": ");
            final IParameter item = cursorDevice.getParameterBank().getItem(selectedParameter);
            if (item.doesExist())
                message.append(item.getName());
            else
                message.append("None");
        }
        host.showNotification(message.toString());
    }, 200);
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) IHost(de.mossgrabers.framework.daw.IHost) SelectedDeviceMode(de.mossgrabers.framework.mode.device.SelectedDeviceMode) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 3 with IHost

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

the class NoteRepeatView method executeFunction.

/**
 * {@inheritDoc}
 */
@Override
protected void executeFunction(final int padIndex) {
    final IHost host = this.model.getHost();
    final MaschineConfiguration configuration = this.surface.getConfiguration();
    switch(padIndex) {
        case 6:
        case 7:
            if (host.supports(Capability.NOTE_REPEAT_MODE)) {
                final ArpeggiatorMode arpMode = configuration.getNoteRepeatMode();
                final int modeIndex = configuration.lookupArpeggiatorModeIndex(arpMode);
                final boolean increase = padIndex == 7;
                final List<ArpeggiatorMode> modes = configuration.getArpeggiatorModes();
                final int newIndex = Math.max(0, Math.min(modes.size() - 1, modeIndex + (increase ? 1 : -1)));
                configuration.setNoteRepeatMode(modes.get(newIndex));
                this.mvHelper.delayDisplay(() -> "Mode: " + configuration.getNoteRepeatMode().getName());
            }
            break;
        case 8:
        case 9:
            if (host.supports(Capability.NOTE_REPEAT_LENGTH)) {
                final int sel2 = Resolution.change(Resolution.getMatch(configuration.getNoteRepeatLength().getValue()), padIndex == 9);
                configuration.setNoteRepeatLength(Resolution.values()[sel2]);
                this.surface.scheduleTask(() -> this.surface.getDisplay().notify("Note Length: " + Resolution.getNameAt(sel2)), 100);
            }
            break;
        case 12:
        case 13:
            final int sel = Resolution.change(Resolution.getMatch(configuration.getNoteRepeatPeriod().getValue()), padIndex == 13);
            configuration.setNoteRepeatPeriod(Resolution.values()[sel]);
            this.mvHelper.delayDisplay(() -> "Period: " + Resolution.getNameAt(sel));
            break;
        case 14:
        case 15:
            if (host.supports(Capability.NOTE_REPEAT_OCTAVES)) {
                configuration.setNoteRepeatOctave(configuration.getNoteRepeatOctave() + (padIndex == 15 ? 1 : -1));
                this.mvHelper.delayDisplay(() -> "Octaves: " + configuration.getNoteRepeatOctave());
            }
            break;
        default:
            // Not used
            break;
    }
}
Also used : ArpeggiatorMode(de.mossgrabers.framework.daw.midi.ArpeggiatorMode) MaschineConfiguration(de.mossgrabers.controller.ni.maschine.mk3.MaschineConfiguration) IHost(de.mossgrabers.framework.daw.IHost)

Example 4 with IHost

use of de.mossgrabers.framework.daw.IHost 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 5 with IHost

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

the class NoteRepeatView method onGridNote.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNote(final int note, final int velocity) {
    if (velocity == 0)
        return;
    final IHost host = this.model.getHost();
    final MaschineJamConfiguration configuration = this.surface.getConfiguration();
    switch(note) {
        // Note Repeat Octave
        case 36:
        case 37:
        case 38:
        case 39:
        case 40:
        case 41:
        case 42:
        case 43:
            if (host.supports(Capability.NOTE_REPEAT_OCTAVES)) {
                final int octave = note - 36;
                configuration.setNoteRepeatOctave(octave);
                this.surface.scheduleTask(() -> this.surface.getDisplay().notify("Note Repeat Octave: " + octave), 100);
            }
            return;
        // Arpeggiator type
        case 76:
        case 77:
            if (host.supports(Capability.NOTE_REPEAT_MODE)) {
                configuration.setPrevNextNoteRepeatMode(note == 77);
                this.surface.scheduleTask(() -> this.surface.getDisplay().notify("Note Repeat Mode: " + configuration.getNoteRepeatMode().getName()), 100);
            }
            break;
        // Note Repeat period
        case 79:
            this.setPeriod(0);
            return;
        case 80:
            this.setPeriod(1);
            return;
        case 71:
            this.setPeriod(2);
            return;
        case 72:
            this.setPeriod(3);
            return;
        case 63:
            this.setPeriod(4);
            return;
        case 64:
            this.setPeriod(5);
            return;
        case 55:
            this.setPeriod(6);
            return;
        case 56:
            this.setPeriod(7);
            return;
        // Note Repeat Length
        case 81:
            this.setNoteLength(0);
            return;
        case 82:
            this.setNoteLength(1);
            return;
        case 73:
            this.setNoteLength(2);
            return;
        case 74:
            this.setNoteLength(3);
            return;
        case 65:
            this.setNoteLength(4);
            return;
        case 66:
            this.setNoteLength(5);
            return;
        case 57:
            this.setNoteLength(6);
            return;
        case 58:
            this.setNoteLength(7);
            return;
        default:
            // Fall through to be handled below
            break;
    }
}
Also used : IHost(de.mossgrabers.framework.daw.IHost) MaschineJamConfiguration(de.mossgrabers.controller.ni.maschine.jam.MaschineJamConfiguration)

Aggregations

IHost (de.mossgrabers.framework.daw.IHost)7 IMidiAccess (de.mossgrabers.framework.daw.midi.IMidiAccess)3 IMidiInput (de.mossgrabers.framework.daw.midi.IMidiInput)3 IMidiOutput (de.mossgrabers.framework.daw.midi.IMidiOutput)3 MaschineJamConfiguration (de.mossgrabers.controller.ni.maschine.jam.MaschineJamConfiguration)1 MaschineConfiguration (de.mossgrabers.controller.ni.maschine.mk3.MaschineConfiguration)1 SLControlSurface (de.mossgrabers.controller.novation.sl.controller.SLControlSurface)1 SLMkIIIControlSurface (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIControlSurface)1 SLMkIIILightGuide (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIILightGuide)1 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)1 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)1 IParameter (de.mossgrabers.framework.daw.data.IParameter)1 ArpeggiatorMode (de.mossgrabers.framework.daw.midi.ArpeggiatorMode)1 INoteRepeat (de.mossgrabers.framework.daw.midi.INoteRepeat)1 SelectedDeviceMode (de.mossgrabers.framework.mode.device.SelectedDeviceMode)1 SLControlSurface (de.mossgrabers.sl.controller.SLControlSurface)1 SLDisplay (de.mossgrabers.sl.controller.SLDisplay)1