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);
}
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);
}
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());
}
}
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;
}
}
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();
}
Aggregations