use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class StopClipCommand method executeNormal.
/**
* {@inheritDoc}
*/
@Override
public void executeNormal(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ITrackBank currentTrackBank = this.model.getCurrentTrackBank();
final Optional<ITrack> track = this.index == -1 ? currentTrackBank.getSelectedItem() : Optional.of(currentTrackBank.getItem(this.index));
if (track.isPresent())
track.get().stop();
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank 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.ITrackBank in project DrivenByMoss by git-moss.
the class AbstractSessionView method onGridNoteBirdsEyeView.
/**
* Handle pad presses in the birds eye view (session page selection).
*
* @param x The x position of the pad
* @param y The y position of the pad
* @param yOffset Optional offset in y-direction
*/
protected void onGridNoteBirdsEyeView(final int x, final int y, final int yOffset) {
final ITrackBank tb = this.model.getCurrentTrackBank();
final ISceneBank sceneBank = tb.getSceneBank();
final boolean flip = this.surface.getConfiguration().isFlipSession();
// Calculate page offsets
final int numTracks = tb.getPageSize();
final int numScenes = sceneBank.getPageSize();
final int trackPosition = tb.getItem(0).getPosition() / numTracks;
final int scenePosition = sceneBank.getScrollPosition() / numScenes;
final int selX = flip ? scenePosition : trackPosition;
final int selY = flip ? trackPosition : scenePosition;
final int padsX = flip ? this.rows : this.columns;
final int padsY = flip ? this.columns : this.rows + yOffset;
final int offsetX = selX / padsX * padsX;
final int offsetY = selY / padsY * padsY;
tb.scrollTo(offsetX * numTracks + (flip ? y : x) * padsX);
sceneBank.scrollTo(offsetY * numScenes + (flip ? x : y) * padsY);
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class AbstractKontrol1Mode method onMainKnobPressed.
/**
* {@inheritDoc}
*/
@Override
public void onMainKnobPressed() {
this.model.toggleCurrentTrackBank();
final ITrackBank tb = this.model.getCurrentTrackBank();
final Optional<ITrack> track = tb.getSelectedItem();
if (track.isEmpty())
tb.getItem(0).select();
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank 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);
});
}
Aggregations