Search in sources :

Example 6 with ICursorTrack

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

the class AbstractTrackMode method updateChannelDisplay.

// Push 2
// Called from sub-classes
protected void updateChannelDisplay(final IGraphicDisplay display, final int selectedMenu, final boolean isVolume, final boolean isPan) {
    this.updateMenuItems(selectedMenu);
    final IValueChanger valueChanger = this.model.getValueChanger();
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final PushConfiguration config = this.surface.getConfiguration();
    final ICursorTrack cursorTrack = this.model.getCursorTrack();
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getItem(i);
        final Pair<String, Boolean> pair = this.menu.get(i);
        final String topMenu = pair.getKey();
        final boolean isTopMenuOn = pair.getValue().booleanValue();
        final int crossfadeMode = this.getCrossfadeModeAsNumber(t);
        final boolean enableVUMeters = config.isEnableVUMeters();
        final int vuR = valueChanger.toDisplayValue(enableVUMeters ? t.getVuRight() : 0);
        final int vuL = valueChanger.toDisplayValue(enableVUMeters ? t.getVuLeft() : 0);
        display.addChannelElement(selectedMenu, topMenu, isTopMenuOn, t.doesExist() ? t.getName(12) : "", this.updateType(t), t.getColor(), t.isSelected(), valueChanger.toDisplayValue(t.getVolume()), valueChanger.toDisplayValue(t.getModulatedVolume()), isVolume && this.isKnobTouched[i] ? t.getVolumeStr(8) : "", valueChanger.toDisplayValue(t.getPan()), valueChanger.toDisplayValue(t.getModulatedPan()), isPan && this.isKnobTouched[i] ? t.getPanStr(8) : "", vuL, vuR, t.isMute(), t.isSolo(), t.isRecArm(), t.isActivated(), crossfadeMode, t.isSelected() && cursorTrack.isPinned());
    }
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ICursorTrack(de.mossgrabers.framework.daw.data.ICursorTrack)

Example 7 with ICursorTrack

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

the class TrackDetailsMode method getButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getButtonColor(final ButtonID buttonID) {
    int index = this.isButtonRow(0, buttonID);
    if (index >= 0) {
        final ICursorTrack cursorTrack = this.model.getCursorTrack();
        if (!cursorTrack.doesExist())
            return super.getButtonColor(buttonID);
        switch(index) {
            case 0:
                return this.colorManager.getColorIndex(cursorTrack.isActivated() ? PushColorManager.PUSH_YELLOW_MD : PushColorManager.PUSH_YELLOW_LO);
            case 1:
                return this.colorManager.getColorIndex(cursorTrack.isRecArm() ? PushColorManager.PUSH_RED_HI : PushColorManager.PUSH_RED_LO);
            case 2:
                return this.colorManager.getColorIndex(cursorTrack.isMute() ? PushColorManager.PUSH_ORANGE_HI : PushColorManager.PUSH_ORANGE_LO);
            case 3:
                return this.colorManager.getColorIndex(cursorTrack.isSolo() ? PushColorManager.PUSH_ORANGE_HI : PushColorManager.PUSH_ORANGE_LO);
            case 4:
                return this.colorManager.getColorIndex(cursorTrack.isMonitor() ? PushColorManager.PUSH_GREEN_HI : PushColorManager.PUSH_GREEN_LO);
            case 5:
                return this.colorManager.getColorIndex(cursorTrack.isAutoMonitor() ? PushColorManager.PUSH_GREEN_HI : PushColorManager.PUSH_GREEN_LO);
            case 6:
                if (!this.hasPinning)
                    return this.isPush2 ? PushColorManager.PUSH2_COLOR_BLACK : PushColorManager.PUSH1_COLOR_BLACK;
                return this.colorManager.getColorIndex(cursorTrack.isPinned() ? PushColorManager.PUSH_GREEN_HI : PushColorManager.PUSH_GREEN_LO);
            default:
            case 7:
                return this.isPush2 ? PushColorManager.PUSH2_COLOR_GREEN_HI : PushColorManager.PUSH1_COLOR_GREEN_HI;
        }
    }
    index = this.isButtonRow(1, buttonID);
    if (index >= 0)
        return this.colorManager.getColorIndex(index < 6 ? AbstractFeatureGroup.BUTTON_COLOR_OFF : AbstractFeatureGroup.BUTTON_COLOR_ON);
    return this.colorManager.getColorIndex(AbstractFeatureGroup.BUTTON_COLOR_OFF);
}
Also used : ICursorTrack(de.mossgrabers.framework.daw.data.ICursorTrack)

Example 8 with ICursorTrack

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

the class TrackHandler method getCommandValue.

/**
 * {@inheritDoc}
 */
@Override
public int getCommandValue(final FlexiCommand command) {
    final ITrackBank trackBank = this.model.getCurrentTrackBank();
    if (trackBank == null)
        return -1;
    final ICursorTrack cursorTrack = this.model.getCursorTrack();
    switch(command) {
        case TRACK_1_SELECT:
        case TRACK_2_SELECT:
        case TRACK_3_SELECT:
        case TRACK_4_SELECT:
        case TRACK_5_SELECT:
        case TRACK_6_SELECT:
        case TRACK_7_SELECT:
        case TRACK_8_SELECT:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SELECT.ordinal()).isSelected() ? 127 : 0;
        case TRACK_1_TOGGLE_ACTIVE:
        case TRACK_2_TOGGLE_ACTIVE:
        case TRACK_3_TOGGLE_ACTIVE:
        case TRACK_4_TOGGLE_ACTIVE:
        case TRACK_5_TOGGLE_ACTIVE:
        case TRACK_6_TOGGLE_ACTIVE:
        case TRACK_7_TOGGLE_ACTIVE:
        case TRACK_8_TOGGLE_ACTIVE:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_TOGGLE_ACTIVE.ordinal()).isActivated() ? 127 : 0;
        case TRACK_1_SET_ACTIVE:
        case TRACK_2_SET_ACTIVE:
        case TRACK_3_SET_ACTIVE:
        case TRACK_4_SET_ACTIVE:
        case TRACK_5_SET_ACTIVE:
        case TRACK_6_SET_ACTIVE:
        case TRACK_7_SET_ACTIVE:
        case TRACK_8_SET_ACTIVE:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SET_ACTIVE.ordinal()).isActivated() ? 127 : 0;
        case TRACK_SELECTED_TOGGLE_ACTIVE:
        case TRACK_SELECTED_SET_ACTIVE:
            return cursorTrack.doesExist() && cursorTrack.isActivated() ? 127 : 0;
        case TRACK_1_SET_VOLUME:
        case TRACK_2_SET_VOLUME:
        case TRACK_3_SET_VOLUME:
        case TRACK_4_SET_VOLUME:
        case TRACK_5_SET_VOLUME:
        case TRACK_6_SET_VOLUME:
        case TRACK_7_SET_VOLUME:
        case TRACK_8_SET_VOLUME:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SET_VOLUME.ordinal()).getVolume();
        case TRACK_SELECTED_SET_VOLUME_TRACK:
            return cursorTrack.doesExist() ? cursorTrack.getVolume() : 0;
        case TRACK_1_SET_PANORAMA:
        case TRACK_2_SET_PANORAMA:
        case TRACK_3_SET_PANORAMA:
        case TRACK_4_SET_PANORAMA:
        case TRACK_5_SET_PANORAMA:
        case TRACK_6_SET_PANORAMA:
        case TRACK_7_SET_PANORAMA:
        case TRACK_8_SET_PANORAMA:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SET_PANORAMA.ordinal()).getPan();
        case TRACK_SELECTED_SET_PANORAMA:
            return cursorTrack.doesExist() ? cursorTrack.getPan() : 0;
        case TRACK_1_TOGGLE_MUTE:
        case TRACK_2_TOGGLE_MUTE:
        case TRACK_3_TOGGLE_MUTE:
        case TRACK_4_TOGGLE_MUTE:
        case TRACK_5_TOGGLE_MUTE:
        case TRACK_6_TOGGLE_MUTE:
        case TRACK_7_TOGGLE_MUTE:
        case TRACK_8_TOGGLE_MUTE:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_TOGGLE_MUTE.ordinal()).isMute() ? 127 : 0;
        case TRACK_1_SET_MUTE:
        case TRACK_2_SET_MUTE:
        case TRACK_3_SET_MUTE:
        case TRACK_4_SET_MUTE:
        case TRACK_5_SET_MUTE:
        case TRACK_6_SET_MUTE:
        case TRACK_7_SET_MUTE:
        case TRACK_8_SET_MUTE:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SET_MUTE.ordinal()).isMute() ? 127 : 0;
        case TRACK_SELECTED_TOGGLE_MUTE:
        case TRACK_SELECTED_SET_MUTE:
            return cursorTrack.doesExist() && cursorTrack.isMute() ? 127 : 0;
        case TRACK_1_TOGGLE_SOLO:
        case TRACK_2_TOGGLE_SOLO:
        case TRACK_3_TOGGLE_SOLO:
        case TRACK_4_TOGGLE_SOLO:
        case TRACK_5_TOGGLE_SOLO:
        case TRACK_6_TOGGLE_SOLO:
        case TRACK_7_TOGGLE_SOLO:
        case TRACK_8_TOGGLE_SOLO:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_TOGGLE_SOLO.ordinal()).isSolo() ? 127 : 0;
        case TRACK_1_SET_SOLO:
        case TRACK_2_SET_SOLO:
        case TRACK_3_SET_SOLO:
        case TRACK_4_SET_SOLO:
        case TRACK_5_SET_SOLO:
        case TRACK_6_SET_SOLO:
        case TRACK_7_SET_SOLO:
        case TRACK_8_SET_SOLO:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SET_SOLO.ordinal()).isSolo() ? 127 : 0;
        case TRACK_SELECTED_TOGGLE_SOLO:
        case TRACK_SELECTED_SET_SOLO:
            return cursorTrack.doesExist() && cursorTrack.isSolo() ? 127 : 0;
        case TRACK_1_TOGGLE_ARM:
        case TRACK_2_TOGGLE_ARM:
        case TRACK_3_TOGGLE_ARM:
        case TRACK_4_TOGGLE_ARM:
        case TRACK_5_TOGGLE_ARM:
        case TRACK_6_TOGGLE_ARM:
        case TRACK_7_TOGGLE_ARM:
        case TRACK_8_TOGGLE_ARM:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_TOGGLE_ARM.ordinal()).isRecArm() ? 127 : 0;
        case TRACK_1_SET_ARM:
        case TRACK_2_SET_ARM:
        case TRACK_3_SET_ARM:
        case TRACK_4_SET_ARM:
        case TRACK_5_SET_ARM:
        case TRACK_6_SET_ARM:
        case TRACK_7_SET_ARM:
        case TRACK_8_SET_ARM:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SET_ARM.ordinal()).isRecArm() ? 127 : 0;
        case TRACK_SELECTED_TOGGLE_ARM:
        case TRACK_SELECTED_SET_ARM:
            return cursorTrack.doesExist() && cursorTrack.isRecArm() ? 127 : 0;
        case TRACK_1_TOGGLE_MONITOR:
        case TRACK_2_TOGGLE_MONITOR:
        case TRACK_3_TOGGLE_MONITOR:
        case TRACK_4_TOGGLE_MONITOR:
        case TRACK_5_TOGGLE_MONITOR:
        case TRACK_6_TOGGLE_MONITOR:
        case TRACK_7_TOGGLE_MONITOR:
        case TRACK_8_TOGGLE_MONITOR:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_TOGGLE_MONITOR.ordinal()).isMonitor() ? 127 : 0;
        case TRACK_1_SET_MONITOR:
        case TRACK_2_SET_MONITOR:
        case TRACK_3_SET_MONITOR:
        case TRACK_4_SET_MONITOR:
        case TRACK_5_SET_MONITOR:
        case TRACK_6_SET_MONITOR:
        case TRACK_7_SET_MONITOR:
        case TRACK_8_SET_MONITOR:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SET_MONITOR.ordinal()).isMonitor() ? 127 : 0;
        case TRACK_SELECTED_TOGGLE_MONITOR:
        case TRACK_SELECTED_SET_MONITOR:
            return cursorTrack.doesExist() && cursorTrack.isMonitor() ? 127 : 0;
        case TRACK_1_TOGGLE_AUTO_MONITOR:
        case TRACK_2_TOGGLE_AUTO_MONITOR:
        case TRACK_3_TOGGLE_AUTO_MONITOR:
        case TRACK_4_TOGGLE_AUTO_MONITOR:
        case TRACK_5_TOGGLE_AUTO_MONITOR:
        case TRACK_6_TOGGLE_AUTO_MONITOR:
        case TRACK_7_TOGGLE_AUTO_MONITOR:
        case TRACK_8_TOGGLE_AUTO_MONITOR:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_TOGGLE_AUTO_MONITOR.ordinal()).isAutoMonitor() ? 127 : 0;
        case TRACK_1_SET_AUTO_MONITOR:
        case TRACK_2_SET_AUTO_MONITOR:
        case TRACK_3_SET_AUTO_MONITOR:
        case TRACK_4_SET_AUTO_MONITOR:
        case TRACK_5_SET_AUTO_MONITOR:
        case TRACK_6_SET_AUTO_MONITOR:
        case TRACK_7_SET_AUTO_MONITOR:
        case TRACK_8_SET_AUTO_MONITOR:
            return trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SET_AUTO_MONITOR.ordinal()).isAutoMonitor() ? 127 : 0;
        case TRACK_SELECTED_TOGGLE_AUTO_MONITOR:
        case TRACK_SELECTED_SET_AUTO_MONITOR:
            return cursorTrack.doesExist() && cursorTrack.isAutoMonitor() ? 127 : 0;
        case TRACK_SELECTED_TOGGLE_PIN:
        case TRACK_SELECTED_SET_PIN:
            return cursorTrack.doesExist() && cursorTrack.isPinned() ? 127 : 0;
        case TRACK_1_SET_SEND_1:
        case TRACK_2_SET_SEND_1:
        case TRACK_3_SET_SEND_1:
        case TRACK_4_SET_SEND_1:
        case TRACK_5_SET_SEND_1:
        case TRACK_6_SET_SEND_1:
        case TRACK_7_SET_SEND_1:
        case TRACK_8_SET_SEND_1:
            return this.getSendValue(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_1.ordinal(), 0);
        case TRACK_1_SET_SEND_2:
        case TRACK_2_SET_SEND_2:
        case TRACK_3_SET_SEND_2:
        case TRACK_4_SET_SEND_2:
        case TRACK_5_SET_SEND_2:
        case TRACK_6_SET_SEND_2:
        case TRACK_7_SET_SEND_2:
        case TRACK_8_SET_SEND_2:
            return this.getSendValue(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_2.ordinal(), 1);
        case TRACK_1_SET_SEND_3:
        case TRACK_2_SET_SEND_3:
        case TRACK_3_SET_SEND_3:
        case TRACK_4_SET_SEND_3:
        case TRACK_5_SET_SEND_3:
        case TRACK_6_SET_SEND_3:
        case TRACK_7_SET_SEND_3:
        case TRACK_8_SET_SEND_3:
            return this.getSendValue(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_3.ordinal(), 2);
        case TRACK_1_SET_SEND_4:
        case TRACK_2_SET_SEND_4:
        case TRACK_3_SET_SEND_4:
        case TRACK_4_SET_SEND_4:
        case TRACK_5_SET_SEND_4:
        case TRACK_6_SET_SEND_4:
        case TRACK_7_SET_SEND_4:
        case TRACK_8_SET_SEND_4:
            return this.getSendValue(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_4.ordinal(), 3);
        case TRACK_1_SET_SEND_5:
        case TRACK_2_SET_SEND_5:
        case TRACK_3_SET_SEND_5:
        case TRACK_4_SET_SEND_5:
        case TRACK_5_SET_SEND_5:
        case TRACK_6_SET_SEND_5:
        case TRACK_7_SET_SEND_5:
        case TRACK_8_SET_SEND_5:
            return this.getSendValue(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_5.ordinal(), 4);
        case TRACK_1_SET_SEND_6:
        case TRACK_2_SET_SEND_6:
        case TRACK_3_SET_SEND_6:
        case TRACK_4_SET_SEND_6:
        case TRACK_5_SET_SEND_6:
        case TRACK_6_SET_SEND_6:
        case TRACK_7_SET_SEND_6:
        case TRACK_8_SET_SEND_6:
            return this.getSendValue(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_6.ordinal(), 5);
        case TRACK_1_SET_SEND_7:
        case TRACK_2_SET_SEND_7:
        case TRACK_3_SET_SEND_7:
        case TRACK_4_SET_SEND_7:
        case TRACK_5_SET_SEND_7:
        case TRACK_6_SET_SEND_7:
        case TRACK_7_SET_SEND_7:
        case TRACK_8_SET_SEND_7:
            return this.getSendValue(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_7.ordinal(), 6);
        case TRACK_1_SET_SEND_8:
        case TRACK_2_SET_SEND_8:
        case TRACK_3_SET_SEND_8:
        case TRACK_4_SET_SEND_8:
        case TRACK_5_SET_SEND_8:
        case TRACK_6_SET_SEND_8:
        case TRACK_7_SET_SEND_8:
        case TRACK_8_SET_SEND_8:
            return this.getSendValue(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_8.ordinal(), 7);
        case TRACK_SELECTED_SET_SEND_1:
        case TRACK_SELECTED_SET_SEND_2:
        case TRACK_SELECTED_SET_SEND_3:
        case TRACK_SELECTED_SET_SEND_4:
        case TRACK_SELECTED_SET_SEND_5:
        case TRACK_SELECTED_SET_SEND_6:
        case TRACK_SELECTED_SET_SEND_7:
        case TRACK_SELECTED_SET_SEND_8:
            return this.getSendValue(-1, command.ordinal() - FlexiCommand.TRACK_SELECTED_SET_SEND_1.ordinal());
        default:
            return -1;
    }
}
Also used : ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ICursorTrack(de.mossgrabers.framework.daw.data.ICursorTrack)

Example 9 with ICursorTrack

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

the class TrackHandler method handle.

/**
 * {@inheritDoc}
 */
@Override
public void handle(final FlexiCommand command, final KnobMode knobMode, final MidiValue value) {
    final ITrackBank trackBank = this.model.getCurrentTrackBank();
    if (trackBank == null)
        return;
    final ICursorTrack cursorTrack = this.model.getCursorTrack();
    final boolean isButtonPressed = this.isButtonPressed(knobMode, value);
    switch(command) {
        case TRACK_TOGGLE_TRACK_BANK:
            if (isButtonPressed)
                this.toggleTrackBankCommand.execute(ButtonEvent.DOWN, 127);
            break;
        // Track: Add Audio Track
        case TRACK_ADD_AUDIO_TRACK:
            if (isButtonPressed)
                this.model.getTrackBank().addChannel(ChannelType.AUDIO);
            break;
        // Track: Add Effect Track
        case TRACK_ADD_EFFECT_TRACK:
            if (isButtonPressed)
                this.model.getApplication().addEffectTrack();
            break;
        // Track: Add Instrument Track
        case TRACK_ADD_INSTRUMENT_TRACK:
            if (isButtonPressed)
                this.model.getTrackBank().addChannel(ChannelType.INSTRUMENT);
            break;
        // Track: Select Previous Bank Page
        case TRACK_SELECT_PREVIOUS_BANK_PAGE:
            if (isButtonPressed)
                this.scrollTrackLeft(true);
            break;
        // Track: Select Next Bank Page
        case TRACK_SELECT_NEXT_BANK_PAGE:
            if (isButtonPressed)
                this.scrollTrackRight(true);
            break;
        // Track: Select Previous Track
        case TRACK_SELECT_PREVIOUS_TRACK:
            if (isButtonPressed)
                this.scrollTrackLeft(false);
            break;
        // Track: Select Next Track
        case TRACK_SELECT_NEXT_TRACK:
            if (isButtonPressed)
                this.scrollTrackRight(false);
            break;
        case TRACK_SCROLL_TRACKS:
            this.scrollTrack(knobMode, value);
            break;
        // Track 1-8: Select
        case TRACK_1_SELECT:
        case TRACK_2_SELECT:
        case TRACK_3_SELECT:
        case TRACK_4_SELECT:
        case TRACK_5_SELECT:
        case TRACK_6_SELECT:
        case TRACK_7_SELECT:
        case TRACK_8_SELECT:
            if (isButtonPressed) {
                trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SELECT.ordinal()).selectOrExpandGroup();
                this.mvHelper.notifySelectedTrack();
            }
            break;
        // Track 1-8: Toggle Active
        case TRACK_1_TOGGLE_ACTIVE:
        case TRACK_2_TOGGLE_ACTIVE:
        case TRACK_3_TOGGLE_ACTIVE:
        case TRACK_4_TOGGLE_ACTIVE:
        case TRACK_5_TOGGLE_ACTIVE:
        case TRACK_6_TOGGLE_ACTIVE:
        case TRACK_7_TOGGLE_ACTIVE:
        case TRACK_8_TOGGLE_ACTIVE:
            if (isButtonPressed)
                trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_TOGGLE_ACTIVE.ordinal()).toggleIsActivated();
            break;
        // Track 1-8: Set Active
        case TRACK_1_SET_ACTIVE:
        case TRACK_2_SET_ACTIVE:
        case TRACK_3_SET_ACTIVE:
        case TRACK_4_SET_ACTIVE:
        case TRACK_5_SET_ACTIVE:
        case TRACK_6_SET_ACTIVE:
        case TRACK_7_SET_ACTIVE:
        case TRACK_8_SET_ACTIVE:
            if (isButtonPressed)
                trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SET_ACTIVE.ordinal()).setIsActivated(value.isPositive());
            break;
        case TRACK_SELECTED_TOGGLE_ACTIVE:
            if (isButtonPressed)
                cursorTrack.toggleIsActivated();
            break;
        case TRACK_SELECTED_SET_ACTIVE:
            if (isButtonPressed)
                cursorTrack.setIsActivated(value.isPositive());
            break;
        // Track 1-8: Set Volume
        case TRACK_1_SET_VOLUME:
        case TRACK_2_SET_VOLUME:
        case TRACK_3_SET_VOLUME:
        case TRACK_4_SET_VOLUME:
        case TRACK_5_SET_VOLUME:
        case TRACK_6_SET_VOLUME:
        case TRACK_7_SET_VOLUME:
        case TRACK_8_SET_VOLUME:
            this.changeTrackVolume(knobMode, command.ordinal() - FlexiCommand.TRACK_1_SET_VOLUME.ordinal(), value);
            break;
        // Track Selected: Set Volume Track
        case TRACK_SELECTED_SET_VOLUME_TRACK:
            this.changeTrackVolume(knobMode, -1, value);
            break;
        // Track 1-8: Set Panorama
        case TRACK_1_SET_PANORAMA:
        case TRACK_2_SET_PANORAMA:
        case TRACK_3_SET_PANORAMA:
        case TRACK_4_SET_PANORAMA:
        case TRACK_5_SET_PANORAMA:
        case TRACK_6_SET_PANORAMA:
        case TRACK_7_SET_PANORAMA:
        case TRACK_8_SET_PANORAMA:
            this.changeTrackPanorama(knobMode, command.ordinal() - FlexiCommand.TRACK_1_SET_PANORAMA.ordinal(), value);
            break;
        // Track Selected: Set Panorama
        case TRACK_SELECTED_SET_PANORAMA:
            this.changeTrackPanorama(knobMode, -1, value);
            break;
        // Track 1-8: Toggle Mute
        case TRACK_1_TOGGLE_MUTE:
        case TRACK_2_TOGGLE_MUTE:
        case TRACK_3_TOGGLE_MUTE:
        case TRACK_4_TOGGLE_MUTE:
        case TRACK_5_TOGGLE_MUTE:
        case TRACK_6_TOGGLE_MUTE:
        case TRACK_7_TOGGLE_MUTE:
        case TRACK_8_TOGGLE_MUTE:
            if (isButtonPressed)
                trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_TOGGLE_MUTE.ordinal()).toggleMute();
            break;
        // Track 1-8: Set Mute
        case TRACK_1_SET_MUTE:
        case TRACK_2_SET_MUTE:
        case TRACK_3_SET_MUTE:
        case TRACK_4_SET_MUTE:
        case TRACK_5_SET_MUTE:
        case TRACK_6_SET_MUTE:
        case TRACK_7_SET_MUTE:
        case TRACK_8_SET_MUTE:
            if (isButtonPressed)
                trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SET_MUTE.ordinal()).setMute(value.isPositive());
            break;
        // Track Selected: Toggle Mute
        case TRACK_SELECTED_TOGGLE_MUTE:
            if (isButtonPressed)
                cursorTrack.toggleMute();
            break;
        // Track Selected: Set Mute
        case TRACK_SELECTED_SET_MUTE:
            if (isButtonPressed)
                cursorTrack.setMute(value.isPositive());
            break;
        // Track 1-8: Toggle Solo
        case TRACK_1_TOGGLE_SOLO:
        case TRACK_2_TOGGLE_SOLO:
        case TRACK_3_TOGGLE_SOLO:
        case TRACK_4_TOGGLE_SOLO:
        case TRACK_5_TOGGLE_SOLO:
        case TRACK_6_TOGGLE_SOLO:
        case TRACK_7_TOGGLE_SOLO:
        case TRACK_8_TOGGLE_SOLO:
            if (isButtonPressed)
                trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_TOGGLE_SOLO.ordinal()).toggleSolo();
            break;
        // Track 1-8: Set Solo
        case TRACK_1_SET_SOLO:
        case TRACK_2_SET_SOLO:
        case TRACK_3_SET_SOLO:
        case TRACK_4_SET_SOLO:
        case TRACK_5_SET_SOLO:
        case TRACK_6_SET_SOLO:
        case TRACK_7_SET_SOLO:
        case TRACK_8_SET_SOLO:
            if (isButtonPressed)
                trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SET_SOLO.ordinal()).setSolo(value.isPositive());
            break;
        // Track Selected: Toggle Solo
        case TRACK_SELECTED_TOGGLE_SOLO:
            if (isButtonPressed)
                cursorTrack.toggleSolo();
            break;
        // Track Selected: Set Solo
        case TRACK_SELECTED_SET_SOLO:
            if (isButtonPressed)
                cursorTrack.setSolo(value.isPositive());
            break;
        // Track 1-8: Toggle Arm
        case TRACK_1_TOGGLE_ARM:
        case TRACK_2_TOGGLE_ARM:
        case TRACK_3_TOGGLE_ARM:
        case TRACK_4_TOGGLE_ARM:
        case TRACK_5_TOGGLE_ARM:
        case TRACK_6_TOGGLE_ARM:
        case TRACK_7_TOGGLE_ARM:
        case TRACK_8_TOGGLE_ARM:
            if (isButtonPressed)
                trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_TOGGLE_ARM.ordinal()).toggleRecArm();
            break;
        // Track 1-8: Set Arm
        case TRACK_1_SET_ARM:
        case TRACK_2_SET_ARM:
        case TRACK_3_SET_ARM:
        case TRACK_4_SET_ARM:
        case TRACK_5_SET_ARM:
        case TRACK_6_SET_ARM:
        case TRACK_7_SET_ARM:
        case TRACK_8_SET_ARM:
            if (isButtonPressed)
                trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SET_ARM.ordinal()).setRecArm(value.isPositive());
            break;
        // Track Selected: Toggle Arm
        case TRACK_SELECTED_TOGGLE_ARM:
            if (isButtonPressed)
                cursorTrack.toggleRecArm();
            break;
        // Track Selected: Set Arm
        case TRACK_SELECTED_SET_ARM:
            if (isButtonPressed)
                cursorTrack.setRecArm(value.isPositive());
            break;
        // Track 1-8: Toggle Monitor
        case TRACK_1_TOGGLE_MONITOR:
        case TRACK_2_TOGGLE_MONITOR:
        case TRACK_3_TOGGLE_MONITOR:
        case TRACK_4_TOGGLE_MONITOR:
        case TRACK_5_TOGGLE_MONITOR:
        case TRACK_6_TOGGLE_MONITOR:
        case TRACK_7_TOGGLE_MONITOR:
        case TRACK_8_TOGGLE_MONITOR:
            if (isButtonPressed)
                trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_TOGGLE_MONITOR.ordinal()).toggleMonitor();
            break;
        // Track 1-8: Set Monitor
        case TRACK_1_SET_MONITOR:
        case TRACK_2_SET_MONITOR:
        case TRACK_3_SET_MONITOR:
        case TRACK_4_SET_MONITOR:
        case TRACK_5_SET_MONITOR:
        case TRACK_6_SET_MONITOR:
        case TRACK_7_SET_MONITOR:
        case TRACK_8_SET_MONITOR:
            if (isButtonPressed)
                trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SET_MONITOR.ordinal()).setMonitor(value.isPositive());
            break;
        // Track Selected: Toggle Monitor
        case TRACK_SELECTED_TOGGLE_MONITOR:
            if (isButtonPressed)
                cursorTrack.toggleMonitor();
            break;
        // Track Selected: Set Monitor
        case TRACK_SELECTED_SET_MONITOR:
            if (isButtonPressed)
                cursorTrack.setMonitor(value.isPositive());
            break;
        // Track 1: Toggle Auto Monitor
        case TRACK_1_TOGGLE_AUTO_MONITOR:
        case TRACK_2_TOGGLE_AUTO_MONITOR:
        case TRACK_3_TOGGLE_AUTO_MONITOR:
        case TRACK_4_TOGGLE_AUTO_MONITOR:
        case TRACK_5_TOGGLE_AUTO_MONITOR:
        case TRACK_6_TOGGLE_AUTO_MONITOR:
        case TRACK_7_TOGGLE_AUTO_MONITOR:
        case TRACK_8_TOGGLE_AUTO_MONITOR:
            if (isButtonPressed)
                trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_TOGGLE_AUTO_MONITOR.ordinal()).toggleAutoMonitor();
            break;
        // Track 1: Set Auto Monitor
        case TRACK_1_SET_AUTO_MONITOR:
        case TRACK_2_SET_AUTO_MONITOR:
        case TRACK_3_SET_AUTO_MONITOR:
        case TRACK_4_SET_AUTO_MONITOR:
        case TRACK_5_SET_AUTO_MONITOR:
        case TRACK_6_SET_AUTO_MONITOR:
        case TRACK_7_SET_AUTO_MONITOR:
        case TRACK_8_SET_AUTO_MONITOR:
            if (isButtonPressed)
                trackBank.getItem(command.ordinal() - FlexiCommand.TRACK_1_SET_AUTO_MONITOR.ordinal()).setAutoMonitor(value.isPositive());
            break;
        // Track Selected: Toggle Auto Monitor
        case TRACK_SELECTED_TOGGLE_AUTO_MONITOR:
            if (isButtonPressed)
                cursorTrack.toggleAutoMonitor();
            break;
        // Track Selected: Set Auto Monitor
        case TRACK_SELECTED_SET_AUTO_MONITOR:
            if (isButtonPressed)
                cursorTrack.setAutoMonitor(value.isPositive());
            break;
        // Track Selected: Toggle Pinned
        case TRACK_SELECTED_TOGGLE_PIN:
            if (isButtonPressed)
                cursorTrack.togglePinned();
            break;
        // Track Selected: Set Pinned
        case TRACK_SELECTED_SET_PIN:
            if (isButtonPressed)
                cursorTrack.setPinned(value.isPositive());
            break;
        // Track 1-8: Set Send 1
        case TRACK_1_SET_SEND_1:
        case TRACK_2_SET_SEND_1:
        case TRACK_3_SET_SEND_1:
        case TRACK_4_SET_SEND_1:
        case TRACK_5_SET_SEND_1:
        case TRACK_6_SET_SEND_1:
        case TRACK_7_SET_SEND_1:
        case TRACK_8_SET_SEND_1:
            this.changeSendVolume(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_1.ordinal(), 0, knobMode, value);
            break;
        // Track 1-8: Set Send 2
        case TRACK_1_SET_SEND_2:
        case TRACK_2_SET_SEND_2:
        case TRACK_3_SET_SEND_2:
        case TRACK_4_SET_SEND_2:
        case TRACK_5_SET_SEND_2:
        case TRACK_6_SET_SEND_2:
        case TRACK_7_SET_SEND_2:
        case TRACK_8_SET_SEND_2:
            this.changeSendVolume(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_2.ordinal(), 1, knobMode, value);
            break;
        // Track 1-8: Set Send 3
        case TRACK_1_SET_SEND_3:
        case TRACK_2_SET_SEND_3:
        case TRACK_3_SET_SEND_3:
        case TRACK_4_SET_SEND_3:
        case TRACK_5_SET_SEND_3:
        case TRACK_6_SET_SEND_3:
        case TRACK_7_SET_SEND_3:
        case TRACK_8_SET_SEND_3:
            this.changeSendVolume(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_3.ordinal(), 2, knobMode, value);
            break;
        // Track 1-8: Set Send 4
        case TRACK_1_SET_SEND_4:
        case TRACK_2_SET_SEND_4:
        case TRACK_3_SET_SEND_4:
        case TRACK_4_SET_SEND_4:
        case TRACK_5_SET_SEND_4:
        case TRACK_6_SET_SEND_4:
        case TRACK_7_SET_SEND_4:
        case TRACK_8_SET_SEND_4:
            this.changeSendVolume(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_4.ordinal(), 3, knobMode, value);
            break;
        // Track 1: Set Send 5
        case TRACK_1_SET_SEND_5:
        case TRACK_2_SET_SEND_5:
        case TRACK_3_SET_SEND_5:
        case TRACK_4_SET_SEND_5:
        case TRACK_5_SET_SEND_5:
        case TRACK_6_SET_SEND_5:
        case TRACK_7_SET_SEND_5:
        case TRACK_8_SET_SEND_5:
            this.changeSendVolume(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_5.ordinal(), 4, knobMode, value);
            break;
        // Track 1: Set Send 6
        case TRACK_1_SET_SEND_6:
        case TRACK_2_SET_SEND_6:
        case TRACK_3_SET_SEND_6:
        case TRACK_4_SET_SEND_6:
        case TRACK_5_SET_SEND_6:
        case TRACK_6_SET_SEND_6:
        case TRACK_7_SET_SEND_6:
        case TRACK_8_SET_SEND_6:
            this.changeSendVolume(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_6.ordinal(), 5, knobMode, value);
            break;
        // Track 1-8: Set Send 7
        case TRACK_1_SET_SEND_7:
        case TRACK_2_SET_SEND_7:
        case TRACK_3_SET_SEND_7:
        case TRACK_4_SET_SEND_7:
        case TRACK_5_SET_SEND_7:
        case TRACK_6_SET_SEND_7:
        case TRACK_7_SET_SEND_7:
        case TRACK_8_SET_SEND_7:
            this.changeSendVolume(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_7.ordinal(), 6, knobMode, value);
            break;
        // Track 1-8: Set Send 8
        case TRACK_1_SET_SEND_8:
        case TRACK_2_SET_SEND_8:
        case TRACK_3_SET_SEND_8:
        case TRACK_4_SET_SEND_8:
        case TRACK_5_SET_SEND_8:
        case TRACK_6_SET_SEND_8:
        case TRACK_7_SET_SEND_8:
        case TRACK_8_SET_SEND_8:
            this.changeSendVolume(command.ordinal() - FlexiCommand.TRACK_1_SET_SEND_8.ordinal(), 7, knobMode, value);
            break;
        // Track Selected: Set Send 1-8
        case TRACK_SELECTED_SET_SEND_1:
        case TRACK_SELECTED_SET_SEND_2:
        case TRACK_SELECTED_SET_SEND_3:
        case TRACK_SELECTED_SET_SEND_4:
        case TRACK_SELECTED_SET_SEND_5:
        case TRACK_SELECTED_SET_SEND_6:
        case TRACK_SELECTED_SET_SEND_7:
        case TRACK_SELECTED_SET_SEND_8:
            this.changeSendVolume(-1, command.ordinal() - FlexiCommand.TRACK_SELECTED_SET_SEND_1.ordinal(), knobMode, value);
            break;
        default:
            throw new FlexiHandlerException(command);
    }
}
Also used : FlexiHandlerException(de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ICursorTrack(de.mossgrabers.framework.daw.data.ICursorTrack)

Example 10 with ICursorTrack

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

the class LaunchkeyMk3PanoramaMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ITextDisplay d = this.surface.getTextDisplay();
    d.setCell(LaunchkeyMk3Display.SCREEN_ROW_BASE, 0, "Pan   " + this.formatPageRange(" %d - %d"));
    final ICursorTrack cursorTrack = this.model.getCursorTrack();
    final String trackText = cursorTrack.doesExist() ? String.format("%d: %s", Integer.valueOf(cursorTrack.getPosition() + 1), cursorTrack.getName()) : "No sel. track";
    d.setCell(LaunchkeyMk3Display.SCREEN_ROW_BASE + 1, 0, trackText);
    // Format track names
    final ITrackBank tb = this.model.getCurrentTrackBank();
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getItem(i);
        final boolean exists = t.doesExist();
        final int offset = i * 2;
        d.setCell(LaunchkeyMk3Display.SCREEN_ROW_POTS + offset, 0, exists ? String.format("%d: %s", Integer.valueOf(t.getPosition() + 1), t.getName()) : "No track");
        d.setCell(LaunchkeyMk3Display.SCREEN_ROW_POTS + offset + 1, 0, exists ? "Pan: " + t.getPanStr() : "");
    }
    d.allDone();
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ICursorTrack(de.mossgrabers.framework.daw.data.ICursorTrack) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay)

Aggregations

ICursorTrack (de.mossgrabers.framework.daw.data.ICursorTrack)12 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)7 ITrack (de.mossgrabers.framework.daw.data.ITrack)5 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)4 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)4 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)3 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)2 ISend (de.mossgrabers.framework.daw.data.ISend)2 FlexiHandlerException (de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException)1 UnknownCommandException (de.mossgrabers.controller.osc.exception.UnknownCommandException)1 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)1 INoteClip (de.mossgrabers.framework.daw.INoteClip)1 IProject (de.mossgrabers.framework.daw.IProject)1 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)1 IParameter (de.mossgrabers.framework.daw.data.IParameter)1 ISlot (de.mossgrabers.framework.daw.data.ISlot)1 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)1 ISlotBank (de.mossgrabers.framework.daw.data.bank.ISlotBank)1 SendData (de.mossgrabers.framework.graphics.canvas.utils.SendData)1