Search in sources :

Example 6 with ISlotBank

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

the class DuplicateCommand method executeNormal.

/**
 * {@inheritDoc}
 */
@Override
public void executeNormal(final ButtonEvent event) {
    if (event != ButtonEvent.UP)
        return;
    // Is there a selected track?
    final ITrack cursorTrack = this.model.getCursorTrack();
    if (!cursorTrack.doesExist())
        return;
    // Is there a selected slot?
    final ISlotBank slotBank = cursorTrack.getSlotBank();
    final Optional<ISlot> slot = slotBank.getSelectedItem();
    if (slot.isEmpty())
        return;
    final boolean isPlaying = slot.get().isPlaying();
    // Duplicate the clip in the selected slot
    slot.get().duplicate();
    if (!isPlaying)
        return;
    // Need to wait a bit with starting the duplicated clip until it is selected
    this.model.getHost().scheduleTask(() -> {
        final Optional<ISlot> slotNew = slotBank.getSelectedItem();
        if (slotNew.isPresent()) {
            slotNew.get().launch();
            return;
        }
        // Try to find the clip in the next page...
        slotBank.selectNextPage();
        this.model.getHost().scheduleTask(() -> {
            final Optional<ISlot> slotNew2 = slotBank.getSelectedItem();
            if (slotNew2.isPresent())
                slotNew2.get().launch();
        }, 200);
    }, 200);
}
Also used : ISlotBank(de.mossgrabers.framework.daw.data.bank.ISlotBank) ITrack(de.mossgrabers.framework.daw.data.ITrack) ISlot(de.mossgrabers.framework.daw.data.ISlot)

Example 7 with ISlotBank

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

the class NewCommand method handleExecute.

/**
 * Execute the new command.
 *
 * @param enableOverdub True to enable overdub for the new clip
 */
public void handleExecute(final boolean enableOverdub) {
    final ITrack cursorTrack = this.model.getCursorTrack();
    if (!cursorTrack.doesExist()) {
        this.surface.getDisplay().notify("Please select an Instrument track first.");
        return;
    }
    final ISlotBank slotBank = cursorTrack.getSlotBank();
    final Optional<ISlot> selectedSlot = slotBank.getSelectedItem();
    final int slotIndex = selectedSlot.isEmpty() ? 0 : selectedSlot.get().getIndex();
    final Optional<ISlot> slot = slotBank.getEmptySlot(slotIndex);
    if (slot.isEmpty()) {
        this.surface.getDisplay().notify("No empty slot in the current page. Please scroll down.");
        return;
    }
    this.model.createNoteClip(cursorTrack, slot.get(), this.getClipLength(), enableOverdub);
}
Also used : ISlotBank(de.mossgrabers.framework.daw.data.bank.ISlotBank) ITrack(de.mossgrabers.framework.daw.data.ITrack) ISlot(de.mossgrabers.framework.daw.data.ISlot)

Example 8 with ISlotBank

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

the class AbstractSessionView method drawSessionGrid.

/**
 * Draw a session grid, where each pad stands for a clip.
 *
 * @param ignoreFlipCheck True to ignore the check for same columns and rows
 */
protected void drawSessionGrid(final boolean ignoreFlipCheck) {
    final boolean flipSession = this.surface.getConfiguration().isFlipSession();
    if (flipSession && this.columns != this.rows && !ignoreFlipCheck)
        throw new FrameworkException("Session flip is only supported for same size of rows and columns!");
    final ITrackBank tb = this.model.getCurrentTrackBank();
    for (int x = 0; x < this.columns; x++) {
        final ITrack t = tb.getItem(x);
        final ISlotBank slotBank = t.getSlotBank();
        for (int y = 0; y < this.rows; y++) this.drawPad(slotBank.getItem(y), flipSession ? y : x, flipSession ? x : y, t.isRecArm());
    }
}
Also used : ISlotBank(de.mossgrabers.framework.daw.data.bank.ISlotBank) FrameworkException(de.mossgrabers.framework.utils.FrameworkException) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank)

Example 9 with ISlotBank

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

the class PageCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (event != ButtonEvent.DOWN)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    final Modes mode = modeManager.getActiveID();
    switch(mode) {
        case DEVICE_PARAMS:
            final ICursorDevice cursorDevice = this.model.getCursorDevice();
            if (this.direction == Direction.LEFT)
                cursorDevice.selectPrevious();
            else
                cursorDevice.selectNext();
            this.mvHelper.notifySelectedDevice();
            break;
        case USER:
            final IParameterBank userBank = this.model.getUserParameterBank();
            if (this.direction == Direction.LEFT)
                userBank.selectPreviousPage();
            else
                userBank.selectNextPage();
            this.mvHelper.notifySelectedUserPage();
            break;
        case BROWSER:
            if (this.direction == Direction.LEFT)
                this.model.getBrowser().previousContentType();
            else
                this.model.getBrowser().nextContentType();
            break;
        default:
            final ITrack cursorTrack = this.model.getCursorTrack();
            if (!cursorTrack.doesExist())
                return;
            final ISlotBank slotBank = cursorTrack.getSlotBank();
            if (this.direction == Direction.LEFT) {
                if (this.surface.isShiftPressed()) {
                    this.surface.setStopConsumed();
                    slotBank.selectPreviousPage();
                } else
                    slotBank.selectPreviousItem();
            } else {
                if (this.surface.isShiftPressed()) {
                    this.surface.setStopConsumed();
                    slotBank.selectNextPage();
                } else
                    slotBank.selectNextItem();
            }
            break;
    }
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ISlotBank(de.mossgrabers.framework.daw.data.bank.ISlotBank) ITrack(de.mossgrabers.framework.daw.data.ITrack) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 10 with ISlotBank

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

the class KontrolProtocolControllerSetup method navigateClips.

/**
 * Navigate to the previous or next clip of the selected track (if any).
 *
 * @param isLeft Select the previous clip if true
 */
private void navigateClips(final boolean isLeft) {
    final ITrack cursorTrack = this.model.getCursorTrack();
    if (!cursorTrack.doesExist())
        return;
    final ISlotBank slotBank = cursorTrack.getSlotBank();
    if (isLeft)
        slotBank.selectPreviousItem();
    else
        slotBank.selectNextItem();
}
Also used : ISlotBank(de.mossgrabers.framework.daw.data.bank.ISlotBank) ITrack(de.mossgrabers.framework.daw.data.ITrack)

Aggregations

ISlotBank (de.mossgrabers.framework.daw.data.bank.ISlotBank)10 ITrack (de.mossgrabers.framework.daw.data.ITrack)9 ISlot (de.mossgrabers.framework.daw.data.ISlot)5 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)2 KontrolProtocolConfiguration (de.mossgrabers.controller.ni.kontrol.mkii.KontrolProtocolConfiguration)1 UnknownCommandException (de.mossgrabers.controller.osc.exception.UnknownCommandException)1 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)1 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)1 INoteClip (de.mossgrabers.framework.daw.INoteClip)1 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)1 ICursorTrack (de.mossgrabers.framework.daw.data.ICursorTrack)1 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)1 ISceneBank (de.mossgrabers.framework.daw.data.bank.ISceneBank)1 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)1 Modes (de.mossgrabers.framework.mode.Modes)1 FrameworkException (de.mossgrabers.framework.utils.FrameworkException)1