Search in sources :

Example 1 with View

use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.

the class APCControllerSetup method updateDeviceKnobs.

private void updateDeviceKnobs() {
    final APCControlSurface surface = this.getSurface();
    final View view = surface.getViewManager().getActiveView();
    if (view == null)
        return;
    final ICursorDevice cd = this.model.getCursorDevice();
    for (int i = 0; i < 8; i++) {
        final Integer deviceKnobCommand = Integer.valueOf(Commands.CONT_COMMAND_DEVICE_KNOB1.intValue() + i);
        if (!((DeviceKnobRowCommand) view.getContinuousCommand(deviceKnobCommand)).isKnobMoving())
            surface.setLED(APCControlSurface.APC_KNOB_DEVICE_KNOB_1 + i, cd.getFXParam(i).getValue());
    }
}
Also used : APCControlSurface(de.mossgrabers.apc.controller.APCControlSurface) SessionView(de.mossgrabers.apc.view.SessionView) ShiftView(de.mossgrabers.apc.view.ShiftView) SceneView(de.mossgrabers.framework.view.SceneView) View(de.mossgrabers.framework.view.View) DrumView(de.mossgrabers.apc.view.DrumView) SequencerView(de.mossgrabers.apc.view.SequencerView) PlayView(de.mossgrabers.apc.view.PlayView) RaindropsView(de.mossgrabers.apc.view.RaindropsView) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 2 with View

use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.

the class AbstractControlSurface method checkGridNoteState.

private void checkGridNoteState(final int note) {
    if (this.gridNoteStates[note] != ButtonEvent.DOWN)
        return;
    this.gridNoteStates[note] = ButtonEvent.LONG;
    final View view = this.viewManager.getActiveView();
    if (view != null)
        view.onGridNoteLongPress(note);
}
Also used : View(de.mossgrabers.framework.view.View)

Example 3 with View

use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.

the class AbstractControlSurface method handleGridNote.

/**
 * Handle a midi note which belongs to the grid.
 *
 * @param note The midi note
 * @param velocity The velocity of the note
 */
protected void handleGridNote(final int note, final int velocity) {
    this.gridNoteStates[note] = velocity > 0 ? ButtonEvent.DOWN : ButtonEvent.UP;
    if (velocity > 0)
        this.gridNoteVelocities[note] = velocity;
    if (this.gridNoteStates[note] == ButtonEvent.DOWN)
        this.scheduleTask(() -> this.checkGridNoteState(note), AbstractControlSurface.BUTTON_STATE_INTERVAL);
    // If consumed flag is set ignore the UP event
    if (this.gridNoteStates[note] == ButtonEvent.UP && this.gridNoteConsumed[note]) {
        this.gridNoteConsumed[note] = false;
        return;
    }
    final View view = this.viewManager.getActiveView();
    if (view != null)
        view.onGridNote(note, velocity);
}
Also used : View(de.mossgrabers.framework.view.View)

Example 4 with View

use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.

the class AbstractControlSurface method handleCCEvent.

/**
 * Override in subclass with buttons array usage.
 *
 * @param channel The midi channel
 * @param cc The midi CC
 * @param value The value
 */
protected void handleCCEvent(final int channel, final int cc, final int value) {
    final View view = this.viewManager.getActiveView();
    if (view == null)
        return;
    Integer commandID = this.getTriggerCommand(cc, channel);
    if (commandID != null) {
        final ButtonEvent event = this.isButton(cc) ? this.buttonStates[cc] : null;
        view.executeTriggerCommand(commandID, event);
        return;
    }
    commandID = this.getContinuousCommand(cc, channel);
    if (commandID != null) {
        view.executeContinuousCommand(commandID, value);
        return;
    }
    this.println("Unsupported Midi CC: " + cc);
}
Also used : ButtonEvent(de.mossgrabers.framework.utils.ButtonEvent) View(de.mossgrabers.framework.view.View)

Example 5 with View

use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.

the class MCUControllerSetup method updateButtons.

@SuppressWarnings("unchecked")
private void updateButtons() {
    final MCUControlSurface surface = this.getSurface();
    final Integer mode = surface.getModeManager().getActiveModeId();
    if (mode == null)
        return;
    this.updateVUandFaders();
    this.updateSegmentDisplay();
    // Set button states
    final ITransport t = this.model.getTransport();
    final boolean isShift = surface.isShiftPressed();
    final boolean isFlipRecord = this.configuration.isFlipRecord();
    final boolean isRecordShifted = isShift && !isFlipRecord || !isShift && isFlipRecord;
    final boolean isTrackOn = Modes.MODE_TRACK.equals(mode) || Modes.MODE_VOLUME.equals(mode);
    final boolean isPanOn = Modes.MODE_PAN.equals(mode);
    final boolean isSendOn = mode.intValue() >= Modes.MODE_SEND1.intValue() && mode.intValue() <= Modes.MODE_SEND8.intValue();
    final boolean isDeviceOn = Modes.MODE_DEVICE_PARAMS.equals(mode);
    final boolean isLEDOn = surface.isPressed(MCUControlSurface.MCU_OPTION) ? this.model.isCursorTrackPinned() : isTrackOn;
    surface.updateButton(MCUControlSurface.MCU_MODE_IO, isLEDOn ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_MODE_PAN, isPanOn ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_MODE_SENDS, isSendOn ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final boolean isOn = surface.isPressed(MCUControlSurface.MCU_OPTION) ? cursorDevice.isPinned() : isDeviceOn;
    surface.updateButton(MCUControlSurface.MCU_MODE_PLUGIN, isOn ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_USER, Modes.MODE_BROWSER.equals(mode) ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    final ITransport transport = this.model.getTransport();
    final String automationWriteMode = transport.getAutomationWriteMode();
    final boolean writingArrangerAutomation = transport.isWritingArrangerAutomation();
    surface.updateButton(MCUControlSurface.MCU_F6, transport.isPunchInEnabled() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_F7, transport.isPunchOutEnabled() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_READ, !writingArrangerAutomation ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    final int writeState = writingArrangerAutomation && ITransport.AUTOMATION_MODES_VALUES[2].equals(automationWriteMode) ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF;
    surface.updateButton(MCUControlSurface.MCU_WRITE, writeState);
    surface.updateButton(MCUControlSurface.MCU_GROUP, writeState);
    surface.updateButton(MCUControlSurface.MCU_TRIM, transport.isWritingClipLauncherAutomation() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_TOUCH, writingArrangerAutomation && ITransport.AUTOMATION_MODES_VALUES[1].equals(automationWriteMode) ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_LATCH, writingArrangerAutomation && ITransport.AUTOMATION_MODES_VALUES[0].equals(automationWriteMode) ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    final View view = surface.getViewManager().getView(Views.VIEW_CONTROL);
    surface.updateButton(MCUControlSurface.MCU_REWIND, ((WindCommand<MCUControlSurface, MCUConfiguration>) view.getTriggerCommand(Commands.COMMAND_REWIND)).isRewinding() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_FORWARD, ((WindCommand<MCUControlSurface, MCUConfiguration>) view.getTriggerCommand(Commands.COMMAND_FORWARD)).isForwarding() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_REPEAT, t.isLoop() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_STOP, !t.isPlaying() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_PLAY, t.isPlaying() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_RECORD, isRecordShifted ? t.isLauncherOverdub() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF : t.isRecording() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_NAME_VALUE, surface.getConfiguration().isDisplayTrackNames() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_ZOOM, surface.getConfiguration().isZoomState() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_SCRUB, surface.getModeManager().isActiveMode(Modes.MODE_DEVICE_PARAMS) ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_MIDI_TRACKS, MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_INPUTS, MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_AUDIO_TRACKS, surface.isShiftPressed() && cursorDevice.isWindowOpen() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_AUDIO_INSTR, MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_CLICK, (isShift ? t.isMetronomeTicksOn() : t.isMetronomeOn()) ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_SOLO, this.model.getGroove().getParameters()[0].getValue() > 0 ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_REPLACE, (isShift ? t.isLauncherOverdub() : t.isArrangerOverdub()) ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_FLIP, this.model.isEffectTrackBankActive() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    final boolean displayTicks = this.configuration.isDisplayTicks();
    surface.updateButton(MCUControlSurface.MCU_SMPTE_BEATS, displayTicks ? MCU_BUTTON_STATE_OFF : MCU_BUTTON_STATE_ON);
    surface.updateButton(MCUControlSurface.MCU_SMPTE_LED, displayTicks ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
    surface.updateButton(MCUControlSurface.MCU_BEATS_LED, displayTicks ? MCU_BUTTON_STATE_OFF : MCU_BUTTON_STATE_ON);
    surface.updateButton(MCUControlSurface.MCU_MARKER, this.model.getArranger().areCueMarkersVisible() ? MCU_BUTTON_STATE_ON : MCU_BUTTON_STATE_OFF);
}
Also used : WindCommand(de.mossgrabers.framework.command.trigger.transport.WindCommand) ITransport(de.mossgrabers.framework.daw.ITransport) MCUControlSurface(de.mossgrabers.mcu.controller.MCUControlSurface) View(de.mossgrabers.framework.view.View) ControlView(de.mossgrabers.mcu.view.ControlView) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Aggregations

View (de.mossgrabers.framework.view.View)24 ViewManager (de.mossgrabers.framework.view.ViewManager)9 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)8 SceneView (de.mossgrabers.framework.view.SceneView)8 ITrack (de.mossgrabers.framework.daw.data.ITrack)6 ModeManager (de.mossgrabers.framework.mode.ModeManager)6 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)5 AbstractSequencerView (de.mossgrabers.framework.view.AbstractSequencerView)5 ITransport (de.mossgrabers.framework.daw.ITransport)4 DrumView (de.mossgrabers.launchpad.view.DrumView)4 PlayView (de.mossgrabers.launchpad.view.PlayView)4 RaindropsView (de.mossgrabers.launchpad.view.RaindropsView)4 SequencerView (de.mossgrabers.launchpad.view.SequencerView)4 PushControlSurface (de.mossgrabers.push.controller.PushControlSurface)3 ClipView (de.mossgrabers.push.view.ClipView)3 ColorView (de.mossgrabers.push.view.ColorView)3 DrumView (de.mossgrabers.push.view.DrumView)3 PianoView (de.mossgrabers.push.view.PianoView)3 APCControlSurface (de.mossgrabers.apc.controller.APCControlSurface)2 DrumView (de.mossgrabers.apc.view.DrumView)2