Search in sources :

Example 26 with PushConfiguration

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

the class SendMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2() {
    this.updateTrackMenu();
    final int sendIndex = this.getCurrentSendIndex();
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
    final PushConfiguration config = this.surface.getConfiguration();
    final PushDisplay display = (PushDisplay) this.surface.getDisplay();
    final DisplayMessage message = display.createMessage();
    final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getTrack(i);
        // The menu item
        String topMenu;
        boolean topMenuSelected;
        if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP)) {
            topMenu = t.doesExist() ? "Stop Clip" : "";
            topMenuSelected = t.isPlaying();
        } else if (config.isMuteLongPressed() || config.isMuteSoloLocked() && config.isMuteState()) {
            topMenu = t.doesExist() ? "Mute" : "";
            topMenuSelected = t.isMute();
        } else if (config.isSoloLongPressed() || config.isMuteSoloLocked() && config.isSoloState()) {
            topMenu = t.doesExist() ? "Solo" : "";
            topMenuSelected = t.isSolo();
        } else {
            topMenu = this.menu[i];
            topMenuSelected = i > 3 && i - 4 + sendOffset == sendIndex || i == 7 && tb instanceof ITrackBank && ((ITrackBank) tb).hasParent();
        }
        final IValueChanger valueChanger = this.model.getValueChanger();
        final String[] sendName = new String[4];
        final String[] valueStr = new String[4];
        final int[] value = new int[4];
        final int[] modulatedValue = new int[4];
        final boolean[] selected = new boolean[4];
        for (int j = 0; j < 4; j++) {
            final int sendPos = sendOffset + j;
            final ISend send = t.getSend(sendPos);
            sendName[j] = fxTrackBank == null ? send.getName() : fxTrackBank.getTrack(sendPos).getName();
            valueStr[j] = send != null && sendIndex == sendPos && this.isKnobTouched[i] ? send.getDisplayedValue(8) : "";
            value[j] = valueChanger.toDisplayValue(send != null ? send.getValue() : -1);
            modulatedValue[j] = valueChanger.toDisplayValue(send != null ? send.getModulatedValue() : -1);
            selected[j] = sendIndex == sendPos;
        }
        message.addSendsElement(topMenu, topMenuSelected, t.doesExist() ? t.getName() : "", t.getType(), t.getColor(), t.isSelected(), sendName, valueStr, value, modulatedValue, selected, false);
    }
    display.send(message);
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.ITrackBank) IValueChanger(de.mossgrabers.framework.controller.IValueChanger) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) PushDisplay(de.mossgrabers.push.controller.PushDisplay) ISend(de.mossgrabers.framework.daw.data.ISend) DisplayMessage(de.mossgrabers.push.controller.DisplayMessage)

Example 27 with PushConfiguration

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

the class TrackMode method onValueKnobTouch.

/**
 * {@inheritDoc}
 */
@Override
public void onValueKnobTouch(final int index, final boolean isTouched) {
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack selectedTrack = tb.getSelectedTrack();
    if (selectedTrack == null)
        return;
    this.isKnobTouched[index] = isTouched;
    final PushConfiguration config = this.surface.getConfiguration();
    if (this.isPush2) {
        if (isTouched) {
            if (this.surface.isDeletePressed()) {
                this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_DELETE);
                switch(index) {
                    case 0:
                        selectedTrack.resetVolume();
                        break;
                    case 1:
                        selectedTrack.resetPan();
                        break;
                    case 2:
                        selectedTrack.setCrossfadeMode("AB");
                        break;
                    case 3:
                        // Not used
                        break;
                    default:
                        selectedTrack.getSend(index - 4).resetValue();
                        break;
                }
                return;
            }
            final PushDisplay display = (PushDisplay) this.surface.getDisplay();
            switch(index) {
                case 0:
                    display.notify("Volume: " + selectedTrack.getVolumeStr(8));
                    break;
                case 1:
                    display.notify("Pan: " + selectedTrack.getPanStr(8));
                    break;
                case 2:
                    display.notify("Crossfader: " + selectedTrack.getCrossfadeMode());
                    break;
                case 3:
                    // Not used
                    break;
                default:
                    final int sendIndex = index - 4;
                    final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
                    final String name = fxTrackBank == null ? selectedTrack.getSend(sendIndex).getName() : fxTrackBank.getTrack(sendIndex).getName();
                    if (name.length() > 0)
                        display.notify("Send " + name + ": " + selectedTrack.getSend(sendIndex).getDisplayedValue(8));
                    break;
            }
        }
        switch(index) {
            case 0:
                selectedTrack.touchVolume(isTouched);
                break;
            case 1:
                selectedTrack.touchPan(isTouched);
                break;
            case 2:
            case 3:
                // Not used
                break;
            default:
                final int sendIndex = index - 4;
                selectedTrack.getSend(sendIndex).touchValue(isTouched);
                break;
        }
        this.checkStopAutomationOnKnobRelease(isTouched);
        return;
    }
    if (isTouched) {
        if (this.surface.isDeletePressed()) {
            this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_DELETE);
            switch(index) {
                case 0:
                    selectedTrack.resetVolume();
                    break;
                case 1:
                    selectedTrack.resetPan();
                    break;
                case 2:
                    if (config.isDisplayCrossfader())
                        selectedTrack.setCrossfadeMode("AB");
                    else
                        selectedTrack.getSend(0).resetValue();
                    break;
                default:
                    selectedTrack.getSend(index - (config.isDisplayCrossfader() ? 3 : 2)).resetValue();
                    break;
            }
            return;
        }
        final PushDisplay display = (PushDisplay) this.surface.getDisplay();
        switch(index) {
            case 0:
                display.notify("Volume: " + selectedTrack.getVolumeStr(8));
                break;
            case 1:
                display.notify("Pan: " + selectedTrack.getPanStr(8));
                break;
            case 2:
                if (config.isDisplayCrossfader())
                    display.notify("Crossfader: " + selectedTrack.getCrossfadeMode());
                else {
                    final int sendIndex = 0;
                    final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
                    final String name = fxTrackBank == null ? selectedTrack.getSend(sendIndex).getName() : fxTrackBank.getTrack(sendIndex).getName();
                    if (name.length() > 0)
                        display.notify("Send " + name + ": " + selectedTrack.getSend(sendIndex).getDisplayedValue(8));
                }
                break;
            default:
                final int sendIndex = index - (config.isDisplayCrossfader() ? 3 : 2);
                final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
                final String name = fxTrackBank == null ? selectedTrack.getSend(sendIndex).getName() : fxTrackBank.getTrack(sendIndex).getName();
                if (name.length() > 0)
                    display.notify("Send " + name + ": " + selectedTrack.getSend(sendIndex).getDisplayedValue(8));
                break;
        }
    }
    switch(index) {
        case 0:
            selectedTrack.touchVolume(isTouched);
            break;
        case 1:
            selectedTrack.touchPan(isTouched);
            break;
        case 2:
            if (!config.isDisplayCrossfader())
                selectedTrack.getSend(0).touchValue(isTouched);
            break;
        default:
            final int sendIndex = index - (config.isDisplayCrossfader() ? 3 : 2);
            selectedTrack.getSend(sendIndex).touchValue(isTouched);
            break;
    }
    this.checkStopAutomationOnKnobRelease(isTouched);
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) PushDisplay(de.mossgrabers.push.controller.PushDisplay)

Example 28 with PushConfiguration

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

the class TrackMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2() {
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack selectedTrack = tb.getSelectedTrack();
    // Get the index at which to draw the Sends element
    final int selectedIndex = selectedTrack == null ? -1 : selectedTrack.getIndex();
    int sendsIndex = selectedTrack == null || this.model.isEffectTrackBankActive() ? -1 : selectedTrack.getIndex() + 1;
    if (sendsIndex == 8)
        sendsIndex = 6;
    this.updateTrackMenu();
    final PushConfiguration config = this.surface.getConfiguration();
    final PushDisplay display = (PushDisplay) this.surface.getDisplay();
    final DisplayMessage message = display.createMessage();
    final boolean displayCrossfader = config.isDisplayCrossfader();
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getTrack(i);
        // The menu item
        String topMenu;
        boolean topMenuSelected;
        if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP) && this.model.getHost().hasClips()) {
            topMenu = t.doesExist() ? "Stop Clip" : "";
            topMenuSelected = t.isPlaying();
        } else if (config.isMuteLongPressed() || config.isMuteSoloLocked() && config.isMuteState()) {
            topMenu = t.doesExist() ? "Mute" : "";
            topMenuSelected = t.isMute();
        } else if (config.isSoloLongPressed() || config.isMuteSoloLocked() && config.isSoloState()) {
            topMenu = t.doesExist() ? "Solo" : "";
            topMenuSelected = t.isSolo();
        } else {
            topMenu = this.menu[i];
            topMenuSelected = i == 7 && tb instanceof ITrackBank && ((ITrackBank) tb).hasParent();
        }
        // Channel info
        final String bottomMenu = t.doesExist() ? t.getName() : "";
        final double[] bottomMenuColor = t.getColor();
        final boolean isBottomMenuOn = t.isSelected();
        final IValueChanger valueChanger = this.model.getValueChanger();
        if (t.isSelected()) {
            final int crossfadeMode = displayCrossfader ? t.getCrossfadeModeAsNumber() : -1;
            message.addChannelElement(topMenu, topMenuSelected, bottomMenu, t.getType(), bottomMenuColor, isBottomMenuOn, valueChanger.toDisplayValue(t.getVolume()), valueChanger.toDisplayValue(t.getModulatedVolume()), this.isKnobTouched[0] ? t.getVolumeStr(8) : "", valueChanger.toDisplayValue(t.getPan()), valueChanger.toDisplayValue(t.getModulatedPan()), this.isKnobTouched[1] ? t.getPanStr(8) : "", valueChanger.toDisplayValue(config.isEnableVUMeters() ? t.getVu() : 0), t.isMute(), t.isSolo(), t.isRecArm(), crossfadeMode);
        } else if (sendsIndex == i) {
            final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
            final ITrack selTrack = tb.getTrack(selectedIndex);
            final String[] sendName = new String[4];
            final String[] valueStr = new String[4];
            final int[] value = new int[4];
            final int[] modulatedValue = new int[4];
            final boolean[] selected = new boolean[4];
            for (int j = 0; j < 4; j++) {
                final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
                final int sendPos = sendOffset + j;
                selected[j] = true;
                sendName[j] = "";
                valueStr[j] = "";
                value[j] = 0;
                if (selTrack == null)
                    continue;
                final ISend send = selTrack.getSend(sendPos);
                if (send == null)
                    continue;
                sendName[j] = fxTrackBank == null ? send.getName() : fxTrackBank.getTrack(sendPos).getName();
                valueStr[j] = send.doesExist() && this.isKnobTouched[4 + j] ? send.getDisplayedValue(8) : "";
                value[j] = valueChanger.toDisplayValue(send.doesExist() ? send.getValue() : 0);
                modulatedValue[j] = valueChanger.toDisplayValue(send.doesExist() ? send.getModulatedValue() : 0);
            }
            message.addSendsElement(topMenu, topMenuSelected, bottomMenu, t.getType(), bottomMenuColor, isBottomMenuOn, sendName, valueStr, value, modulatedValue, selected, true);
        } else
            message.addChannelSelectorElement(topMenu, topMenuSelected, bottomMenu, t.getType(), bottomMenuColor, isBottomMenuOn);
    }
    display.send(message);
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.ITrackBank) IValueChanger(de.mossgrabers.framework.controller.IValueChanger) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) PushDisplay(de.mossgrabers.push.controller.PushDisplay) ISend(de.mossgrabers.framework.daw.data.ISend) DisplayMessage(de.mossgrabers.push.controller.DisplayMessage)

Example 29 with PushConfiguration

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

the class TrackMode method updateDisplay1.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay1() {
    final Display d = this.surface.getDisplay().clear();
    final IChannelBank currentTrackBank = this.model.getCurrentTrackBank();
    final ITrack t = currentTrackBank.getSelectedTrack();
    if (t == null)
        d.setRow(1, "                     Please selecta track...                        ").done(0).done(2);
    else {
        final PushConfiguration config = this.surface.getConfiguration();
        d.setCell(0, 0, "Volume").setCell(1, 0, t.getVolumeStr(8)).setCell(2, 0, config.isEnableVUMeters() ? t.getVu() : t.getVolume(), Format.FORMAT_VALUE);
        d.setCell(0, 1, "Pan").setCell(1, 1, t.getPanStr(8)).setCell(2, 1, t.getPan(), Format.FORMAT_PAN);
        int sendStart = 2;
        int sendCount = 6;
        if (config.isDisplayCrossfader()) {
            sendStart = 3;
            sendCount = 5;
            final String crossfadeMode = t.getCrossfadeMode();
            final int upperBound = this.model.getValueChanger().getUpperBound();
            d.setCell(0, 2, "Crossfdr").setCell(1, 2, "A".equals(crossfadeMode) ? "A" : "B".equals(crossfadeMode) ? "       B" : "   <> ");
            d.setCell(2, 2, "A".equals(crossfadeMode) ? 0 : "B".equals(crossfadeMode) ? upperBound : upperBound / 2, Format.FORMAT_PAN);
        }
        final boolean isEffectTrackBankActive = this.model.isEffectTrackBankActive();
        for (int i = 0; i < sendCount; i++) {
            final int pos = sendStart + i;
            if (!isEffectTrackBankActive) {
                final ISend send = t.getSend(i);
                if (send.doesExist())
                    d.setCell(0, pos, send.getName()).setCell(1, pos, send.getDisplayedValue(8)).setCell(2, pos, send.getValue(), Format.FORMAT_VALUE);
            }
        }
        d.done(0).done(1).done(2);
    }
    this.drawRow4();
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ISend(de.mossgrabers.framework.daw.data.ISend) Display(de.mossgrabers.framework.controller.display.Display) PushDisplay(de.mossgrabers.push.controller.PushDisplay)

Example 30 with PushConfiguration

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

the class TrackMode method onValueKnob.

/**
 * {@inheritDoc}
 */
@Override
public void onValueKnob(final int index, final int value) {
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack selectedTrack = tb.getSelectedTrack();
    if (selectedTrack == null)
        return;
    switch(index) {
        case 0:
            selectedTrack.changeVolume(value);
            return;
        case 1:
            selectedTrack.changePan(value);
            return;
    }
    final PushConfiguration config = this.surface.getConfiguration();
    if (this.isPush2) {
        switch(index) {
            case 2:
                this.changeCrossfader(value, selectedTrack);
                break;
            case 3:
                break;
            default:
                final int sendOffset = config.isSendsAreToggled() ? 0 : 4;
                selectedTrack.getSend(index - sendOffset).changeValue(value);
                break;
        }
        return;
    }
    switch(index) {
        case 2:
            if (config.isDisplayCrossfader())
                this.changeCrossfader(value, selectedTrack);
            else
                selectedTrack.getSend(0).changeValue(value);
            break;
        default:
            selectedTrack.getSend(index - (config.isDisplayCrossfader() ? 3 : 2)).changeValue(value);
            break;
    }
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank)

Aggregations

PushConfiguration (de.mossgrabers.push.PushConfiguration)33 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)19 ITrack (de.mossgrabers.framework.daw.data.ITrack)14 PushDisplay (de.mossgrabers.push.controller.PushDisplay)8 IChannel (de.mossgrabers.framework.daw.data.IChannel)7 ModeManager (de.mossgrabers.framework.mode.ModeManager)7 IValueChanger (de.mossgrabers.framework.controller.IValueChanger)6 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)5 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)5 ISend (de.mossgrabers.framework.daw.data.ISend)5 DisplayMessage (de.mossgrabers.push.controller.DisplayMessage)5 Display (de.mossgrabers.framework.controller.display.Display)4 ViewManager (de.mossgrabers.framework.view.ViewManager)1