Search in sources :

Example 21 with ICursorDevice

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

the class DeviceParamsKnobRowCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final int value) {
    final ICursorDevice cd = this.model.getCursorDevice();
    if (!cd.doesExist())
        return;
    cd.getParameterBank().getItem(this.index).setValue(value);
    this.moveStartTime = new Date().getTime();
    if (this.isKnobMoving)
        return;
    this.isKnobMoving = true;
    this.startCheckKnobMovement();
}
Also used : ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) Date(java.util.Date)

Example 22 with ICursorDevice

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

the class BrowserCommand method activateBrowser.

/**
 * Activate the browser depending on the parameters and the currently active mode.
 *
 * @param insertDevice Insert a device if true otherwise select preset
 * @param beforeCurrent Insert the device before the current device if any
 * @return True if activated
 */
private boolean activateBrowser(final boolean insertDevice, final boolean beforeCurrent) {
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final boolean hasCursorDevice = cursorDevice.doesExist();
    final IBrowser browser = this.model.getBrowser();
    if (hasCursorDevice) {
        // Replace the cursor device
        if (!insertDevice) {
            browser.replace(cursorDevice);
            return true;
        }
        if (Modes.isLayerMode(this.surface.getModeManager().getActiveID())) {
            final Optional<ILayer> layer = cursorDevice.getLayerBank().getSelectedItem();
            if (layer.isEmpty())
                return false;
            browser.addDevice(layer.get());
            return true;
        }
        if (beforeCurrent)
            browser.insertBeforeCursorDevice();
        else
            browser.insertAfterCursorDevice();
        return true;
    }
    // No cursor device, add to the selected channel, if any
    final Optional<ITrack> channel = this.model.getCurrentTrackBank().getSelectedItem();
    if (channel.isPresent()) {
        browser.addDevice(channel.get());
        return true;
    }
    final IMasterTrack master = this.model.getMasterTrack();
    if (!master.isSelected())
        return false;
    browser.addDevice(master);
    return true;
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) ITrack(de.mossgrabers.framework.daw.data.ITrack) ILayer(de.mossgrabers.framework.daw.data.ILayer) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack)

Example 23 with ICursorDevice

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

the class DeviceLayerLeftCommand method executeNormal.

/**
 * {@inheritDoc}
 */
@Override
public void executeNormal(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ICursorDevice cd = this.model.getCursorDevice();
    final IChannelBank<ILayer> bank = cd.getLayerBank();
    if (!cd.hasLayers() || bank.getSelectedItem().isEmpty())
        cd.selectPrevious();
    else
        bank.selectPreviousItem();
}
Also used : ILayer(de.mossgrabers.framework.daw.data.ILayer) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 24 with ICursorDevice

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

the class DeviceLayerLeftCommand method executeShifted.

/**
 * {@inheritDoc}
 */
@Override
public void executeShifted(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    // Exit layer
    final ICursorDevice cd = this.model.getCursorDevice();
    final IChannelBank<ILayer> bank = cd.getLayerBank();
    final Optional<ILayer> layer = bank.getSelectedItem();
    if (!cd.hasLayers() || layer.isEmpty()) {
        if (cd.isNested()) {
            cd.selectParent();
            cd.selectChannel();
        }
    } else
        layer.get().setSelected(false);
}
Also used : ILayer(de.mossgrabers.framework.daw.data.ILayer) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 25 with ICursorDevice

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

the class SelectedDeviceMode method onKnobValue.

/**
 * {@inheritDoc}
 */
@Override
public void onKnobValue(final int index, final int value) {
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    if (cursorDevice == null)
        return;
    final IParameter item = cursorDevice.getParameterBank().getItem(index < 0 ? this.selParam : index);
    if (item.doesExist())
        item.changeValue(value);
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) 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