Search in sources :

Example 71 with ITrackBank

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

the class ShiftView method onSelectTrack.

/**
 * {@inheritDoc}
 */
@Override
public void onSelectTrack(final int index, final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final ModeManager modeManager = this.surface.getModeManager();
    switch(index) {
        case 0:
            tb.getSceneBank().selectPreviousPage();
            break;
        case 1:
            tb.getSceneBank().selectNextPage();
            break;
        case 2:
            tb.selectPreviousPage();
            break;
        case 3:
            tb.selectNextPage();
            break;
        case 4:
            modeManager.setActive(Modes.VOLUME);
            this.surface.getConfiguration().setFaderCtrl("Volume");
            this.surface.getDisplay().notify("Volume");
            break;
        case 5:
            modeManager.setActive(Modes.PAN);
            this.surface.getConfiguration().setFaderCtrl("Pan");
            this.surface.getDisplay().notify("Pan");
            break;
        case 6:
            if (this.model.isEffectTrackBankActive())
                return;
            Modes mode = Modes.get(modeManager.getActiveID(), 1);
            // Wrap
            if (!Modes.isSendMode(mode))
                mode = Modes.SEND1;
            // Check if Send channel exists
            if (Modes.isSendMode(mode) && tb.canEditSend(mode.ordinal() - Modes.SEND1.ordinal()))
                mode = Modes.SEND1;
            modeManager.setActive(mode);
            final String name = "Send " + (mode.ordinal() - Modes.SEND1.ordinal() + 1);
            this.surface.getConfiguration().setFaderCtrl(name);
            this.surface.getDisplay().notify(name);
            break;
        case 7:
            if (modeManager.isActive(Modes.DEVICE_PARAMS))
                this.model.getBrowser().replace(this.model.getCursorDevice());
            else {
                modeManager.setActive(Modes.DEVICE_PARAMS);
                this.surface.getConfiguration().setFaderCtrl("Device");
                this.surface.getDisplay().notify("Device");
            }
            break;
        default:
            // Not used
            break;
    }
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 72 with ITrackBank

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

the class TrackMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2(final IGraphicDisplay display) {
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final Optional<ITrack> selectedTrack = tb.getSelectedItem();
    // Get the index at which to draw the Sends element
    final int selectedIndex = selectedTrack.isEmpty() ? -1 : selectedTrack.get().getIndex();
    int sendsIndex = selectedTrack.isEmpty() || this.model.isEffectTrackBankActive() ? -1 : selectedTrack.get().getIndex() + 1;
    if (sendsIndex == 8)
        sendsIndex = 6;
    this.updateMenuItems(0);
    final ICursorTrack cursorTrack = this.model.getCursorTrack();
    final PushConfiguration config = this.surface.getConfiguration();
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getItem(i);
        // The menu item
        final Pair<String, Boolean> pair = this.menu.get(i);
        final String topMenu = pair.getKey();
        final boolean topMenuSelected = pair.getValue().booleanValue();
        // Channel info
        final String bottomMenu = t.doesExist() ? t.getName() : "";
        final ColorEx bottomMenuColor = t.getColor();
        final boolean isBottomMenuOn = t.isSelected();
        final IValueChanger valueChanger = this.model.getValueChanger();
        if (t.isSelected()) {
            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(topMenu, topMenuSelected, bottomMenu, this.updateType(t), 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) : "", vuL, vuR, t.isMute(), t.isSolo(), t.isRecArm(), t.isActivated(), crossfadeMode, cursorTrack.isPinned());
        } else if (sendsIndex == i) {
            final ITrack selTrack = tb.getItem(selectedIndex);
            final SendData[] sendData = new SendData[4];
            for (int j = 0; j < 4; j++) {
                if (selTrack != null) {
                    final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
                    final int sendPos = sendOffset + j;
                    final ISend send = selTrack.getSendBank().getItem(sendPos);
                    if (send != null) {
                        final boolean exists = send.doesExist();
                        sendData[j] = new SendData(send.getName(), exists && this.isKnobTouched[4 + j] ? send.getDisplayedValue(8) : "", valueChanger.toDisplayValue(exists ? send.getValue() : 0), valueChanger.toDisplayValue(exists ? send.getModulatedValue() : 0), true);
                        continue;
                    }
                }
                sendData[j] = new SendData("", "", 0, 0, true);
            }
            display.addSendsElement(topMenu, topMenuSelected, bottomMenu, this.updateType(t), bottomMenuColor, isBottomMenuOn, sendData, true, selTrack == null || selTrack.isActivated(), t.isActivated());
        } else
            display.addChannelSelectorElement(topMenu, topMenuSelected, bottomMenu, this.updateType(t), bottomMenuColor, isBottomMenuOn, t.isActivated());
    }
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ColorEx(de.mossgrabers.framework.controller.color.ColorEx) ICursorTrack(de.mossgrabers.framework.daw.data.ICursorTrack) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) ISend(de.mossgrabers.framework.daw.data.ISend) SendData(de.mossgrabers.framework.graphics.canvas.utils.SendData)

Example 73 with ITrackBank

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

the class ControlMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ACVSDisplay d = (ACVSDisplay) this.surface.getDisplay();
    final ACVSConfiguration configuration = this.surface.getConfiguration();
    final boolean isForce = configuration.isActiveACVSDevice(ACVSDevice.FORCE);
    final boolean isMPC = !isForce;
    final boolean isMPC_X = configuration.isActiveACVSDevice(ACVSDevice.MPC_X);
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final ICursorDevice device = this.model.getCursorDevice();
    final int maxScene = calcMaxScene(this.model.getSceneBank());
    d.setScreenItem(ScreenItem.TRACK_NUMBER_OF_SCENES, maxScene);
    // Maximum number of sends
    d.setScreenItem(ScreenItem.TRACK_SENDS_NO, calcNumberOfSends(tb));
    for (int i = 0; i < 8; i++) {
        // Send track data
        final ITrack track = tb.getItem(i);
        sendTrackData(d, i, track);
        this.sendClipData(d, isMPC, i, track.getSlotBank());
    }
    this.sendSceneData(d, isMPC);
    // Set device data
    final boolean exists = device.doesExist();
    final Optional<String> selectedPage = device.getParameterPageBank().getSelectedItem();
    d.setRow(ACVSDisplay.ITEM_ID_DEVICE_BANK_NAME, exists ? selectedPage.orElse("") : "");
    d.setRow(ACVSDisplay.ITEM_ID_DEVICE_NAME, exists ? device.getName() : "");
    d.setScreenItem(ScreenItem.DEVICE_COUNT, device.doesExist() ? device.getDeviceBank().getItemCount() : 0);
    final int devicePosition = device.getPosition();
    d.setScreenItem(ScreenItem.CURRENT_DEVICE_INDEX, devicePosition >= 0 ? devicePosition : 0);
    d.setScreenItem(ScreenItem.CURRENT_DEVICE_ACTIVE, device.isEnabled() ? 127 : 0);
    final IParameterBank parameterBank = device.getParameterBank();
    for (int i = 0; i < 8; i++) {
        final IParameter param = parameterBank.getItem(i);
        d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAMETER_NAME_FIRST + i, param.getName());
        d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAMETER_VALUE_FIRST + i, param.getDisplayedValue());
        d.setScreenItem(ScreenItem.get(ScreenItem.DEVICE_PARAM1_ENABLED, i), param.doesExist() ? 127 : 0);
        d.setScreenItem(ScreenItem.get(ScreenItem.DEVICE_PARAM1_VALUE, i), param.getValue());
        if (isForce || isMPC_X) {
            d.setScreenItem(ScreenItem.get(ScreenItem.KNOBSTYLE1_COLOR, 8 + i), param.doesExist() ? 1 : 0);
            d.setScreenItem(ScreenItem.get(ScreenItem.KNOB_VALUE1, 8 + i), param.getValue());
            d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAM_NAME1 + 8 + i, param.getName());
            d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAM_VALUE1 + 8 + i, param.getDisplayedValue());
            final ITrack track = tb.getItem(i);
            d.setScreenItem(ScreenItem.get(ScreenItem.KNOBSTYLE1_COLOR, i), track.doesExist() ? 1 : 0);
            d.setScreenItem(ScreenItem.get(ScreenItem.KNOB_VALUE1, i), track.getVolume());
            d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAM_NAME1 + i, track.getName());
            d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAM_VALUE1 + i, track.getVolumeStr());
        }
    }
    // Set transport data
    final ITransport transport = this.model.getTransport();
    d.setRow(ACVSDisplay.ITEM_ID_TEMPO, transport.getTempoParameter().getDisplayedValue());
    d.setRow(ACVSDisplay.ITEM_ID_ARRANGEMENT_POSITION, transport.getBeatText().split(":")[0].replace('.', ':'));
    d.setRow(ACVSDisplay.ITEM_ID_LOOP_START, transport.getLoopStartBeatText().split(":")[0].replace('.', ':'));
    d.setRow(ACVSDisplay.ITEM_ID_LOOP_LENGTH, transport.getLoopLengthBeatText().split(":")[0].replace('.', ':'));
    this.sendAdditionalMPCParameters(d);
    if (!isMPC)
        this.sendAdditionalForceParameters(d);
    d.allDone();
    if (this.currentMaxScene != maxScene) {
        this.currentMaxScene = maxScene;
        this.surface.forceFlush();
    }
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) ITrack(de.mossgrabers.framework.daw.data.ITrack) ACVSDisplay(de.mossgrabers.controller.akai.acvs.controller.ACVSDisplay) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ITransport(de.mossgrabers.framework.daw.ITransport) ACVSConfiguration(de.mossgrabers.controller.akai.acvs.ACVSConfiguration) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 74 with ITrackBank

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

the class SelectTrackSendOrClipLengthCommand method executeNormal.

/**
 * {@inheritDoc}
 */
@Override
public void executeNormal(final ButtonEvent event) {
    if (event != ButtonEvent.UP)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    if (this.surface.isPressed(ButtonID.SEND1)) {
        final Modes sendModeId = Modes.get(Modes.SEND1, this.index);
        this.surface.setTriggerConsumed(ButtonID.SEND1);
        // Keep the send step selection in sync
        if (this.surface.isMkII())
            ((ModeMultiSelectCommand<?, ?>) this.surface.getButton(ButtonID.SEND1).getCommand()).activateMode(sendModeId);
        else
            modeManager.setActive(sendModeId);
        // Display the sends name
        String modeName = "Send " + (this.index + 1) + ": ";
        final ITrackBank trackBank = this.model.getTrackBank();
        Optional<ITrack> selectedTrack = trackBank.getSelectedItem();
        if (selectedTrack.isEmpty()) {
            final ITrack item = trackBank.getItem(0);
            selectedTrack = item.doesExist() ? Optional.of(item) : Optional.empty();
        }
        if (selectedTrack.isEmpty())
            modeName += "-";
        else
            modeName += selectedTrack.get().getSendBank().getItem(this.index).getName();
        this.surface.getDisplay().notify(modeName);
        return;
    }
    if (this.surface.isMkII() && this.surface.isPressed(ButtonID.SEND2)) {
        modeManager.setActive(Modes.USER);
        this.surface.setTriggerConsumed(ButtonID.USER);
        modeManager.get(Modes.USER).selectItemPage(this.index);
        return;
    }
    this.model.getCurrentTrackBank().getItem(this.index).selectOrExpandGroup();
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 75 with ITrackBank

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

the class BeatstepControllerSetup method updateIndication.

protected void updateIndication() {
    final BeatstepControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    final boolean isTrack = viewManager.isActive(Views.TRACK);
    final boolean isDevice = viewManager.isActive(Views.DEVICE);
    final boolean isSession = viewManager.isActive(Views.SESSION);
    final IMasterTrack mt = this.model.getMasterTrack();
    mt.setVolumeIndication(!isDevice);
    final ITrackBank tb = this.model.getTrackBank();
    final Optional<ITrack> selectedTrack = tb.getSelectedItem();
    final ITrackBank tbe = this.model.getEffectTrackBank();
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final boolean isEffect = this.model.isEffectTrackBankActive();
    tb.setIndication(!isEffect && isSession);
    if (tbe != null)
        tbe.setIndication(isEffect && isSession);
    final IParameterBank parameterBank = cursorDevice.getParameterBank();
    for (int i = 0; i < 8; i++) {
        final boolean hasTrackSel = selectedTrack.isPresent() && selectedTrack.get().getIndex() == i;
        final ITrack track = tb.getItem(i);
        track.setVolumeIndication(!isEffect && hasTrackSel && !isDevice);
        track.setPanIndication(!isEffect && hasTrackSel && !isDevice);
        final ISendBank sendBank = track.getSendBank();
        for (int j = 0; j < 6; j++) sendBank.getItem(j).setIndication(!isEffect && hasTrackSel && isTrack);
        if (tbe != null) {
            final Optional<ITrack> selectedFXTrack = tbe.getSelectedItem();
            final boolean hasFXTrackSel = selectedFXTrack.isPresent() && selectedFXTrack.get().getIndex() == i;
            final ITrack fxTrack = tbe.getItem(i);
            fxTrack.setVolumeIndication(isEffect && hasFXTrackSel && isTrack);
            fxTrack.setPanIndication(isEffect && hasFXTrackSel && isTrack);
        }
        parameterBank.getItem(i).setIndication(isDevice);
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) BeatstepControlSurface(de.mossgrabers.controller.arturia.beatstep.controller.BeatstepControlSurface) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Aggregations

ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)121 ITrack (de.mossgrabers.framework.daw.data.ITrack)85 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)17 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)16 Modes (de.mossgrabers.framework.mode.Modes)15 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)10 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)10 ISend (de.mossgrabers.framework.daw.data.ISend)10 ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)8 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)7 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)7 ICursorTrack (de.mossgrabers.framework.daw.data.ICursorTrack)6 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)5 ITransport (de.mossgrabers.framework.daw.ITransport)5 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)5 ISceneBank (de.mossgrabers.framework.daw.data.bank.ISceneBank)5 SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)4 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)4 Kontrol1Display (de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display)3 IHost (de.mossgrabers.framework.daw.IHost)3