Search in sources :

Example 6 with ITrackBank

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

the class MCUControllerSetup method updateIndication.

private void updateIndication(final Integer mode) {
    final ITrackBank tb = this.model.getTrackBank();
    final IChannelBank tbe = this.model.getEffectTrackBank();
    final boolean isEffect = this.model.isEffectTrackBankActive();
    final boolean isPan = Modes.MODE_PAN.equals(mode);
    final boolean isTrack = Modes.MODE_TRACK.equals(mode);
    final boolean isDevice = Modes.MODE_DEVICE_PARAMS.equals(mode);
    tb.setIndication(!isEffect);
    tbe.setIndication(isEffect);
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final ITrack selectedTrack = tb.getSelectedTrack();
    for (int i = 0; i < tb.getNumTracks(); i++) {
        final boolean hasTrackSel = selectedTrack != null && selectedTrack.getIndex() == i && isTrack;
        final ITrack track = tb.getTrack(i);
        track.setVolumeIndication(!isEffect && (isTrack || hasTrackSel));
        track.setPanIndication(!isEffect && (isPan || hasTrackSel));
        for (int j = 0; j < tb.getNumSends(); j++) track.getSend(j).setIndication(!isEffect && (mode.intValue() - Modes.MODE_SEND1.intValue() == j || hasTrackSel));
        final ITrack fxTrack = tbe.getTrack(i);
        fxTrack.setVolumeIndication(isEffect);
        fxTrack.setPanIndication(isEffect && isPan);
    }
    for (int i = 0; i < cursorDevice.getNumParameters(); i++) cursorDevice.indicateParameter(i, isDevice);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.ITrackBank) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 7 with ITrackBank

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

the class AbstractTrackMode method onFirstRow.

/**
 * {@inheritDoc}
 */
@Override
public void onFirstRow(final int index, final ButtonEvent event) {
    if (event == ButtonEvent.DOWN)
        return;
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack track = tb.getTrack(index);
    if (event == ButtonEvent.UP) {
        if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_DUPLICATE)) {
            this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_DUPLICATE);
            track.duplicate();
            return;
        }
        if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP)) {
            this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_CLIP_STOP);
            track.stop();
            return;
        }
        if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_RECORD)) {
            this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_RECORD);
            track.toggleRecArm();
            return;
        }
        final ITrack selTrack = tb.getSelectedTrack();
        if (selTrack != null && selTrack.getIndex() == index) {
            // mode
            if (selTrack.isGroup() && tb instanceof ITrackBank)
                ((ITrackBank) tb).selectChildren();
            else
                this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_DEVICE, ButtonEvent.DOWN);
        } else
            track.selectAndMakeVisible();
        return;
    }
    // LONG press, go out of group
    if (!this.model.isEffectTrackBankActive()) {
        this.model.getTrackBank().selectParent();
        this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_ROW1_1 + index);
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.ITrackBank) IChannelBank(de.mossgrabers.framework.daw.IChannelBank)

Example 8 with ITrackBank

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

the class AbstractTrackMode method updateSecondRow.

/**
 * {@inheritDoc}
 */
@Override
public void updateSecondRow() {
    final PushConfiguration config = this.surface.getConfiguration();
    final IChannelBank tb = this.model.getCurrentTrackBank();
    if (this.isPush2) {
        if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP)) {
            for (int i = 0; i < 8; i++) {
                final ITrack track = tb.getTrack(i);
                this.surface.updateButton(102 + i, track.doesExist() && track.isPlaying() ? PushColors.PUSH2_COLOR_RED_HI : PushColors.PUSH2_COLOR_BLACK);
            }
            return;
        }
        if (config.isMuteLongPressed() || config.isSoloLongPressed() || config.isMuteSoloLocked()) {
            final boolean muteState = config.isMuteState();
            for (int i = 0; i < 8; i++) this.surface.updateButton(102 + i, this.getTrackStateColor(muteState, tb.getTrack(i)));
            return;
        }
        final ModeManager modeManager = this.surface.getModeManager();
        this.surface.updateButton(102, modeManager.isActiveMode(Modes.MODE_VOLUME) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
        this.surface.updateButton(103, modeManager.isActiveMode(Modes.MODE_PAN) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
        this.surface.updateButton(104, modeManager.isActiveMode(Modes.MODE_CROSSFADER) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
        this.surface.updateButton(105, PushColors.PUSH2_COLOR_BLACK);
        final boolean sendsAreToggled = config.isSendsAreToggled();
        this.surface.updateButton(106, modeManager.isActiveMode(sendsAreToggled ? Modes.MODE_SEND5 : Modes.MODE_SEND1) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
        this.surface.updateButton(107, modeManager.isActiveMode(sendsAreToggled ? Modes.MODE_SEND6 : Modes.MODE_SEND2) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
        this.surface.updateButton(108, modeManager.isActiveMode(sendsAreToggled ? Modes.MODE_SEND7 : Modes.MODE_SEND3) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
        this.surface.updateButton(109, tb instanceof ITrackBank && ((ITrackBank) tb).hasParent() ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
        return;
    }
    final boolean muteState = config.isMuteState();
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getTrack(i);
        int color = PushColors.PUSH1_COLOR_BLACK;
        if (t.doesExist()) {
            if (muteState) {
                if (!t.isMute())
                    color = PushColors.PUSH1_COLOR2_YELLOW_HI;
            } else
                color = t.isSolo() ? PushColors.PUSH1_COLOR2_BLUE_HI : PushColors.PUSH1_COLOR2_GREY_LO;
        }
        this.surface.updateButton(102 + i, color);
    }
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.ITrackBank) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 9 with ITrackBank

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

the class PushControllerSetup method updateIndication.

private void updateIndication(final Integer mode) {
    final ITrackBank tb = this.model.getTrackBank();
    final IChannelBank tbe = this.model.getEffectTrackBank();
    final PushControlSurface surface = this.getSurface();
    final boolean isSession = surface.getViewManager().isActiveView(Views.VIEW_SESSION);
    final boolean isEffect = this.model.isEffectTrackBankActive();
    final boolean isPan = Modes.MODE_PAN.equals(mode);
    final boolean isVolume = Modes.MODE_VOLUME.equals(mode);
    tb.setIndication(!isEffect && isSession);
    if (tbe != null)
        tbe.setIndication(isEffect && isSession);
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final ITrack selectedTrack = tb.getSelectedTrack();
    for (int i = 0; i < tb.getNumTracks(); i++) {
        final boolean hasTrackSel = selectedTrack != null && selectedTrack.getIndex() == i && Modes.MODE_TRACK.equals(mode);
        final ITrack track = tb.getTrack(i);
        track.setVolumeIndication(!isEffect && (isVolume || hasTrackSel));
        track.setPanIndication(!isEffect && (isPan || hasTrackSel));
        for (int j = 0; j < tb.getNumSends(); j++) track.getSend(j).setIndication(!isEffect && (mode.intValue() - Modes.MODE_SEND1.intValue() == j || hasTrackSel));
        if (tbe != null) {
            final ITrack fxTrack = tbe.getTrack(i);
            fxTrack.setVolumeIndication(isEffect);
            fxTrack.setPanIndication(isEffect && isPan);
        }
        cursorDevice.indicateParameter(i, true);
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.ITrackBank) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) PushControlSurface(de.mossgrabers.push.controller.PushControlSurface) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 10 with ITrackBank

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

the class PushControllerSetup method createModel.

/**
 * {@inheritDoc}
 */
@Override
protected void createModel() {
    this.model = this.factory.createModel(this.colorManager, this.valueChanger, this.scales, 8, 8, this.isPush2 ? 8 : 6, this.isPush2 ? 48 : 16, this.isPush2 ? 48 : 16, false, -1, -1, -1, -1);
    final ITrackBank trackBank = this.model.getTrackBank();
    trackBank.setIndication(true);
    trackBank.addTrackSelectionObserver(this::handleTrackChange);
    final IChannelBank effectTrackBank = this.model.getEffectTrackBank();
    if (effectTrackBank != null)
        effectTrackBank.addTrackSelectionObserver(this::handleTrackChange);
    this.model.getMasterTrack().addTrackSelectionObserver((index, isSelected) -> {
        final PushControlSurface surface = this.getSurface();
        final ModeManager modeManager = surface.getModeManager();
        if (isSelected)
            modeManager.setActiveMode(Modes.MODE_MASTER);
        else if (modeManager.isActiveMode(Modes.MODE_MASTER))
            modeManager.restoreMode();
    });
}
Also used : ITrackBank(de.mossgrabers.framework.daw.ITrackBank) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) PushControlSurface(de.mossgrabers.push.controller.PushControlSurface) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Aggregations

ITrackBank (de.mossgrabers.framework.daw.ITrackBank)25 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)20 ITrack (de.mossgrabers.framework.daw.data.ITrack)18 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)7 PushConfiguration (de.mossgrabers.push.PushConfiguration)5 ModeManager (de.mossgrabers.framework.mode.ModeManager)4 ViewManager (de.mossgrabers.framework.view.ViewManager)4 IValueChanger (de.mossgrabers.framework.controller.IValueChanger)3 DisplayMessage (de.mossgrabers.push.controller.DisplayMessage)3 PushDisplay (de.mossgrabers.push.controller.PushDisplay)3 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)2 ISend (de.mossgrabers.framework.daw.data.ISend)2 PushControlSurface (de.mossgrabers.push.controller.PushControlSurface)2 APCControlSurface (de.mossgrabers.apc.controller.APCControlSurface)1 APCminiControlSurface (de.mossgrabers.apcmini.controller.APCminiControlSurface)1 BeatstepControlSurface (de.mossgrabers.beatstep.controller.BeatstepControlSurface)1 IApplication (de.mossgrabers.framework.daw.IApplication)1 ISlot (de.mossgrabers.framework.daw.data.ISlot)1 SceneView (de.mossgrabers.framework.view.SceneView)1 View (de.mossgrabers.framework.view.View)1