Search in sources :

Example 1 with ButtonEvent

use of de.mossgrabers.framework.utils.ButtonEvent 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 2 with ButtonEvent

use of de.mossgrabers.framework.utils.ButtonEvent in project DrivenByMoss by git-moss.

the class ShiftView method handleControlModes.

private boolean handleControlModes(final int note, final int velocity) {
    final ButtonEvent event = velocity == 0 ? ButtonEvent.UP : ButtonEvent.DOWN;
    final View view = this.surface.getViewManager().getActiveView();
    switch(note) {
        case 36:
            view.getTriggerCommand(Commands.COMMAND_REC_ARM).execute(event);
            break;
        case 37:
            view.getTriggerCommand(Commands.COMMAND_TRACK).execute(event);
            break;
        case 38:
            view.getTriggerCommand(Commands.COMMAND_MUTE).execute(event);
            break;
        case 39:
            view.getTriggerCommand(Commands.COMMAND_SOLO).execute(event);
            break;
        case 40:
            view.getTriggerCommand(Commands.COMMAND_VOLUME).execute(event);
            break;
        case 41:
            view.getTriggerCommand(Commands.COMMAND_PAN_SEND).execute(event);
            break;
        case 42:
            view.getTriggerCommand(Commands.COMMAND_SENDS).execute(event);
            break;
        case 43:
            view.getTriggerCommand(Commands.COMMAND_STOP_CLIP).execute(event);
            break;
        default:
            return false;
    }
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.getPreviousModeId() == modeManager.getActiveModeId())
        modeManager.setActiveMode(null);
    return true;
}
Also used : ButtonEvent(de.mossgrabers.framework.utils.ButtonEvent) SceneView(de.mossgrabers.framework.view.SceneView) View(de.mossgrabers.framework.view.View) AbstractView(de.mossgrabers.framework.view.AbstractView) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Aggregations

ButtonEvent (de.mossgrabers.framework.utils.ButtonEvent)2 View (de.mossgrabers.framework.view.View)2 ModeManager (de.mossgrabers.framework.mode.ModeManager)1 AbstractView (de.mossgrabers.framework.view.AbstractView)1 SceneView (de.mossgrabers.framework.view.SceneView)1