Search in sources :

Example 51 with ICursorDevice

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

the class AbstractConfiguration method registerDeactivatedItemsHandler.

/**
 * Register a handler for the 'exclude deactivated items' setting.
 *
 * @param model The model for getting the banks to configure
 */
public void registerDeactivatedItemsHandler(final IModel model) {
    this.addSettingObserver(AbstractConfiguration.EXCLUDE_DEACTIVATED_ITEMS, () -> {
        final boolean exclude = this.areDeactivatedItemsExcluded();
        final ITrackBank trackBank = model.getTrackBank();
        trackBank.setSkipDisabledItems(exclude);
        for (int i = 0; i < trackBank.getPageSize(); i++) trackBank.getItem(i).getSendBank().setSkipDisabledItems(exclude);
        final ITrackBank effectTrackBank = model.getEffectTrackBank();
        if (effectTrackBank != null)
            effectTrackBank.setSkipDisabledItems(exclude);
        final ICursorDevice cursorDevice = model.getCursorDevice();
        final IDeviceBank deviceBank = cursorDevice.getDeviceBank();
        deviceBank.setSkipDisabledItems(exclude);
        cursorDevice.getLayerBank().setSkipDisabledItems(exclude);
        final IDrumPadBank drumPadBank = cursorDevice.getDrumPadBank();
        if (drumPadBank != null)
            drumPadBank.setSkipDisabledItems(exclude);
    });
}
Also used : ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) IDeviceBank(de.mossgrabers.framework.daw.data.bank.IDeviceBank) IDrumPadBank(de.mossgrabers.framework.daw.data.bank.IDrumPadBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 52 with ICursorDevice

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

the class MoveTrackBankCommand method executeNormal.

/**
 * {@inheritDoc}
 */
@Override
public void executeNormal(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActive(this.deviceMode)) {
        final ICursorDevice cursorDevice = this.model.getCursorDevice();
        if (this.moveBy1) {
            this.handleBankMovement(cursorDevice.getParameterBank());
            return;
        }
        if (this.moveLeft)
            cursorDevice.selectPrevious();
        else
            cursorDevice.selectNext();
        return;
    }
    if (modeManager.isActive(Modes.MARKERS)) {
        this.handleBankMovement(this.model.getMarkerBank());
        return;
    }
    this.handleBankMovement(this.model.getCurrentTrackBank());
}
Also used : ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 53 with ICursorDevice

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

the class DeviceParamsMode method moveUp.

/**
 * Move up the hierarchy.
 */
protected void moveUp() {
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActive(Modes.DEVICE_CHAINS)) {
        modeManager.setActive(Modes.DEVICE_PARAMS);
        return;
    }
    // There is no device on the track move upwards to the track view
    final ICursorDevice cd = this.model.getCursorDevice();
    if (!cd.doesExist()) {
        this.surface.getButton(ButtonID.TRACK).trigger(ButtonEvent.DOWN);
        return;
    }
    // Parameter banks are shown -> show devices
    final DeviceParamsMode deviceParamsMode = (DeviceParamsMode) modeManager.get(Modes.DEVICE_PARAMS);
    if (!deviceParamsMode.isShowDevices()) {
        deviceParamsMode.setShowDevices(true);
        return;
    }
    // Devices are shown, if nested show the layers otherwise move up to the tracks
    if (cd.isNested()) {
        cd.selectParent();
        this.model.getHost().scheduleTask(() -> {
            if (cd.hasLayers())
                modeManager.setActive(this.surface.getConfiguration().getCurrentLayerMixMode());
            else
                modeManager.setActive(Modes.DEVICE_PARAMS);
            deviceParamsMode.setShowDevices(false);
            cd.selectChannel();
        }, 300);
        return;
    }
    // Move up to the track
    if (this.model.isCursorDeviceOnMasterTrack())
        this.surface.getButton(ButtonID.MASTERTRACK).trigger(ButtonEvent.DOWN);
    else
        this.surface.getButton(ButtonID.TRACK).trigger(ButtonEvent.DOWN);
}
Also used : ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 54 with ICursorDevice

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

the class DeviceParamsMode method onFirstRow.

/**
 * {@inheritDoc}
 */
@Override
public void onFirstRow(final int index, final ButtonEvent event) {
    if (event == ButtonEvent.DOWN)
        return;
    if (event == ButtonEvent.UP) {
        final ICursorDevice cd = this.model.getCursorDevice();
        if (!cd.doesExist())
            return;
        // Select parameter bank if parameter banks are visible
        if (!this.showDevices) {
            cd.getParameterPageBank().selectPage(index);
            return;
        }
        // Duplicate device
        if (this.surface.isPressed(ButtonID.DUPLICATE)) {
            this.surface.setTriggerConsumed(ButtonID.DUPLICATE);
            cd.duplicate();
            return;
        }
        // Delete device
        if (this.surface.isPressed(ButtonID.DELETE)) {
            this.surface.setTriggerConsumed(ButtonID.DELETE);
            cd.getDeviceBank().getItem(index).remove();
            return;
        }
        // Select device
        if (cd.getIndex() != index) {
            cd.getDeviceBank().getItem(index).select();
            return;
        }
        // No layers, show devices
        final ModeManager modeManager = this.surface.getModeManager();
        if (!cd.hasLayers()) {
            ((DeviceParamsMode) modeManager.get(Modes.DEVICE_PARAMS)).setShowDevices(false);
            return;
        }
        // If there are layers, make sure one is selected
        final Optional<?> layer = cd.getLayerBank().getSelectedItem();
        if (layer.isEmpty())
            cd.getLayerBank().getItem(0).select();
        modeManager.setActive(this.surface.getConfiguration().getCurrentLayerMixMode());
        return;
    }
    // LONG press - move upwards
    this.surface.setTriggerConsumed(ButtonID.get(ButtonID.ROW1_1, index));
    this.moveUp();
}
Also used : ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 55 with ICursorDevice

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

the class DeviceParamsMode method updateDisplay1.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay1(final ITextDisplay display) {
    final ICursorDevice cd = this.model.getCursorDevice();
    if (!this.checkExists1(display, cd))
        return;
    // Row 1 & 2
    final IParameterBank parameterBank = cd.getParameterBank();
    for (int i = 0; i < 8; i++) {
        final IParameter param = parameterBank.getItem(i);
        display.setCell(0, i, param.doesExist() ? StringUtils.fixASCII(param.getName()) : "").setCell(1, i, StringUtils.fixASCII(param.getDisplayedValue(8)));
    }
    // Row 3
    display.setBlock(2, 0, "Selected Device:").setBlock(2, 1, cd.getName());
    // Row 4
    if (this.showDevices) {
        final IDeviceBank deviceBank = cd.getDeviceBank();
        for (int i = 0; i < 8; i++) {
            final IDevice device = deviceBank.getItem(i);
            final StringBuilder sb = new StringBuilder();
            if (device.doesExist()) {
                if (i == cd.getIndex())
                    sb.append(Push1Display.SELECT_ARROW);
                sb.append(device.getName());
            }
            display.setCell(3, i, sb.toString());
        }
        return;
    }
    final IParameterPageBank bank = cd.getParameterPageBank();
    final int selectedItemIndex = bank.getSelectedItemIndex();
    for (int i = 0; i < bank.getPageSize(); i++) {
        final String item = bank.getItem(i);
        final String selectedStr = i == selectedItemIndex ? Push1Display.SELECT_ARROW : "";
        display.setCell(3, i, item.isEmpty() ? "" : selectedStr + item);
    }
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) IParameterPageBank(de.mossgrabers.framework.daw.data.bank.IParameterPageBank) IDevice(de.mossgrabers.framework.daw.data.IDevice) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) IDeviceBank(de.mossgrabers.framework.daw.data.bank.IDeviceBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Aggregations

ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)67 IParameter (de.mossgrabers.framework.daw.data.IParameter)17 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)14 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)10 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)8 ILayer (de.mossgrabers.framework.daw.data.ILayer)8 IParameterPageBank (de.mossgrabers.framework.daw.data.bank.IParameterPageBank)8 ITrack (de.mossgrabers.framework.daw.data.ITrack)7 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)7 IBrowser (de.mossgrabers.framework.daw.IBrowser)5 IDeviceBank (de.mossgrabers.framework.daw.data.bank.IDeviceBank)5 Modes (de.mossgrabers.framework.mode.Modes)5 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)3 ITransport (de.mossgrabers.framework.daw.ITransport)3 IDevice (de.mossgrabers.framework.daw.data.IDevice)3 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)3 IDrumPadBank (de.mossgrabers.framework.daw.data.bank.IDrumPadBank)3 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)3 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)2 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)2