Search in sources :

Example 11 with PushConfiguration

use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.

the class VolumeCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (event != ButtonEvent.DOWN)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    final Modes currentMode = modeManager.getActiveID();
    // Layer mode selection for Push 1
    final PushConfiguration config = this.surface.getConfiguration();
    if (!config.isPush2() && this.surface.isSelectPressed() && Modes.isLayerMode(currentMode)) {
        modeManager.setActive(Modes.DEVICE_LAYER_VOLUME);
        return;
    }
    if (Modes.VOLUME.equals(currentMode)) {
        if (this.model.getHost().supports(Capability.HAS_CROSSFADER))
            modeManager.setActive(Modes.CROSSFADER);
    } else
        modeManager.setActive(Modes.VOLUME);
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 12 with PushConfiguration

use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.

the class SelectSessionViewCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (event == ButtonEvent.DOWN) {
        this.isTemporary = false;
        final ViewManager viewManager = this.surface.getViewManager();
        final ModeManager modeManager = this.surface.getModeManager();
        if (Views.isSessionView(viewManager.getActiveID())) {
            if (modeManager.isActive(Modes.SESSION_VIEW_SELECT))
                modeManager.restore();
            else
                modeManager.setTemporary(Modes.SESSION_VIEW_SELECT);
            return;
        }
        // Switch to the preferred session view and display scene/clip mode if enabled
        final PushConfiguration configuration = this.surface.getConfiguration();
        viewManager.setActive(configuration.isScenesClipViewSelected() ? Views.SCENE_PLAY : Views.SESSION);
        if (configuration.shouldDisplayScenesOrClips())
            modeManager.setActive(Modes.SESSION);
        return;
    }
    if (event == ButtonEvent.UP && this.isTemporary)
        this.surface.getViewManager().restore();
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 13 with PushConfiguration

use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.

the class MuteCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    // Update for key combinations
    this.surface.getViewManager().getActive().updateNoteMapping();
    if (this.surface.isSelectPressed()) {
        if (event == ButtonEvent.UP)
            this.model.getProject().clearMute();
        return;
    }
    final PushConfiguration config = this.surface.getConfiguration();
    if (!config.isPush2()) {
        config.setTrackState(TrackState.MUTE);
        return;
    }
    // Toggle mute lock mode
    if (this.surface.isShiftPressed()) {
        if (event == ButtonEvent.UP) {
            if (config.isMuteSoloLocked() && config.isMuteState())
                config.setMuteSoloLocked(false);
            else {
                config.setMuteSoloLocked(true);
                config.setTrackState(TrackState.MUTE);
            }
        }
        return;
    }
    // Behaviour like Push 1
    if (config.isMuteSoloLocked()) {
        config.setTrackState(TrackState.MUTE);
        return;
    }
    if (event == ButtonEvent.DOWN) {
        config.setIsMuteLongPressed(false);
        return;
    }
    if (event == ButtonEvent.LONG) {
        config.setIsMuteLongPressed(true);
        config.setTrackState(TrackState.MUTE);
        return;
    }
    if (config.isMuteLongPressed()) {
        config.setIsMuteLongPressed(false);
        return;
    }
    final Modes activeModeId = this.surface.getModeManager().getActiveID();
    if (Modes.isLayerMode(activeModeId)) {
        final ICursorDevice cd = this.model.getCursorDevice();
        final Optional<?> layer = cd.getLayerBank().getSelectedItem();
        if (layer.isPresent())
            ((ILayer) layer.get()).toggleMute();
    } else if (Modes.MASTER.equals(activeModeId))
        this.model.getMasterTrack().toggleMute();
    else
        this.model.getCursorTrack().toggleMute();
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) Modes(de.mossgrabers.framework.mode.Modes) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 14 with PushConfiguration

use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.

the class PanSendCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (event != ButtonEvent.DOWN)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    final Modes currentMode = modeManager.getActiveID();
    // Layer mode selection for Push 1
    Modes mode;
    final PushConfiguration config = this.surface.getConfiguration();
    if (!config.isPush2() && this.surface.isSelectPressed() && Modes.isLayerMode(currentMode)) {
        if (this.model.isEffectTrackBankActive()) {
            // No Sends on FX tracks
            mode = Modes.DEVICE_LAYER_PAN;
        } else {
            mode = Modes.get(currentMode, 1);
            // Wrap
            if (mode.ordinal() < Modes.DEVICE_LAYER_PAN.ordinal() || mode.ordinal() > Modes.DEVICE_LAYER_SEND8.ordinal())
                mode = Modes.DEVICE_LAYER_PAN;
            // Check if Send channel exists
            final ITrackBank tb = this.model.getTrackBank();
            if (mode.ordinal() < Modes.DEVICE_LAYER_SEND1.ordinal() || mode.ordinal() > Modes.DEVICE_LAYER_SEND8.ordinal() || tb.canEditSend(mode.ordinal() - Modes.DEVICE_LAYER_SEND1.ordinal()))
                mode = Modes.DEVICE_LAYER_PAN;
        }
        modeManager.setActive(mode);
        return;
    }
    if (this.model.isEffectTrackBankActive()) {
        // No Sends on FX tracks
        mode = Modes.PAN;
    } else {
        if (currentMode.ordinal() < Modes.SEND1.ordinal() || currentMode.ordinal() > Modes.SEND8.ordinal())
            mode = Modes.SEND1;
        else {
            mode = Modes.get(currentMode, 1);
            if (mode.ordinal() > Modes.SEND8.ordinal())
                mode = Modes.PAN;
        }
        // Check if Send channel exists
        final ITrackBank tb = this.model.getTrackBank();
        if (mode.ordinal() < Modes.SEND1.ordinal() || mode.ordinal() > Modes.SEND8.ordinal() || !tb.canEditSend(mode.ordinal() - Modes.SEND1.ordinal()))
            mode = Modes.PAN;
    }
    modeManager.setActive(mode);
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 15 with PushConfiguration

use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.

the class TouchstripCommand method onPitchbend.

/**
 * {@inheritDoc}
 */
@Override
public void onPitchbend(final int data1, final int data2) {
    if (this.surface.getViewManager().isActive(Views.SESSION)) {
        final int value = this.surface.isShiftPressed() ? 63 : data2;
        this.model.getTransport().setCrossfade(this.model.getValueChanger().toDAWValue(value));
        this.surface.setRibbonValue(value);
        return;
    }
    // Don't get in the way of configuration
    if (this.surface.isShiftPressed())
        return;
    final PushConfiguration config = this.surface.getConfiguration();
    final double scaled = data2 / 127.0;
    // Check if Note Repeat is active and its settings should be changed
    final int ribbonNoteRepeat = config.getRibbonNoteRepeat();
    if (config.isNoteRepeatActive() && ribbonNoteRepeat > PushConfiguration.NOTE_REPEAT_OFF) {
        final Resolution[] values = Resolution.values();
        final int index = (int) Math.round(scaled * (values.length - 1));
        final double value = values[values.length - 1 - index].getValue();
        final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
        if (ribbonNoteRepeat == PushConfiguration.NOTE_REPEAT_PERIOD)
            noteRepeat.setPeriod(value);
        else
            noteRepeat.setNoteLength(value);
        return;
    }
    switch(config.getRibbonMode()) {
        case PushConfiguration.RIBBON_MODE_PITCH:
            this.surface.sendMidiEvent(0xE0, data1, data2);
            break;
        case PushConfiguration.RIBBON_MODE_CC:
            this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), data2);
            this.pitchValue = data2;
            break;
        case PushConfiguration.RIBBON_MODE_CC_PB:
            if (data2 > 64)
                this.surface.sendMidiEvent(0xE0, data1, data2);
            else if (data2 < 64)
                this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 127 - data2 * 2);
            else {
                this.surface.sendMidiEvent(0xE0, data1, data2);
                this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 0);
            }
            break;
        case PushConfiguration.RIBBON_MODE_PB_CC:
            if (data2 > 64)
                this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), (data2 - 64) * 2);
            else if (data2 < 64)
                this.surface.sendMidiEvent(0xE0, data1, data2);
            else {
                this.surface.sendMidiEvent(0xE0, data1, data2);
                this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 0);
            }
            break;
        case PushConfiguration.RIBBON_MODE_FADER:
            this.model.getCursorTrack().setVolume(this.model.getValueChanger().toDAWValue(data2));
            return;
        default:
            // Not used
            break;
    }
    this.surface.getMidiOutput().sendPitchbend(data1, data2);
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) INoteRepeat(de.mossgrabers.framework.daw.midi.INoteRepeat) Resolution(de.mossgrabers.framework.daw.constants.Resolution)

Aggregations

PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)31 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)10 ITrack (de.mossgrabers.framework.daw.data.ITrack)8 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)6 Modes (de.mossgrabers.framework.mode.Modes)6 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)5 IDeviceMetadata (de.mossgrabers.framework.daw.data.IDeviceMetadata)4 ISend (de.mossgrabers.framework.daw.data.ISend)4 SendData (de.mossgrabers.framework.graphics.canvas.utils.SendData)3 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)2 Resolution (de.mossgrabers.framework.daw.constants.Resolution)2 IChannel (de.mossgrabers.framework.daw.data.IChannel)2 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)2 ICursorTrack (de.mossgrabers.framework.daw.data.ICursorTrack)2 INoteRepeat (de.mossgrabers.framework.daw.midi.INoteRepeat)2 ArrayList (java.util.ArrayList)2 ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)1 ChannelType (de.mossgrabers.framework.daw.resource.ChannelType)1 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)1