use of de.mossgrabers.framework.daw.data.IDrumPad in project DrivenByMoss by git-moss.
the class DrumView method handleSelectButton.
/**
* {@inheritDoc}
*/
@Override
public synchronized void handleSelectButton(final int playedPad) {
// Do we have drum pads?
final IDrumDevice primary = this.model.getDrumDevice();
if (!primary.hasDrumPads())
return;
final ICursorDevice cd = this.model.getCursorDevice();
final boolean isNested = cd.isNested();
if (isNested) {
// We have to move up to compare the main drum devices
cd.selectParent();
}
// Can only scroll to the channel if the cursor device is the primary device
if (primary.getPosition() != cd.getPosition())
return;
// Align the primary and cursor device drum bank view
final IDrumPadBank drumPadBank = primary.getDrumPadBank();
final int scrollPos = drumPadBank.getScrollPosition();
final IDrumPadBank cdDrumPadBank = cd.getDrumPadBank();
final int pageSize = cdDrumPadBank.getPageSize();
final int adjustedPage = playedPad / pageSize * pageSize;
cdDrumPadBank.scrollTo(scrollPos + adjustedPage, false);
// Do not reselect
final IDrumPad drumPad = drumPadBank.getItem(playedPad);
if (drumPad.isSelected()) {
// If the instrument of the pad was selected for editing, try to select it again
if (isNested) {
final IDrumPad selectedItem = cdDrumPadBank.getItem(playedPad % pageSize);
if (selectedItem != null)
selectedItem.enter();
}
return;
}
// Only activate layer mode if not one of the layer modes is already active
final ModeManager modeManager = this.surface.getModeManager();
if (!Modes.isLayerMode(modeManager.getActiveID()))
modeManager.setActive(Modes.DEVICE_LAYER);
drumPad.select();
this.updateNoteMapping();
}
use of de.mossgrabers.framework.daw.data.IDrumPad in project DrivenByMoss by git-moss.
the class Drum64View method handleSelectButton.
/**
* {@inheritDoc}
*/
@Override
protected void handleSelectButton(final int playedPad) {
// Do we have drum pads?
final IDrumDevice primary = this.model.getDrumDevice64();
if (!primary.hasDrumPads())
return;
final ICursorDevice cd = this.model.getCursorDevice();
final boolean isNested = cd.isNested();
if (isNested) {
// We have to move up to compare the main drum devices
cd.selectParent();
}
// Can only scroll to the channel if the cursor device is the primary device
if (primary.getPosition() != cd.getPosition())
return;
// Align the primary and cursor device drum bank view
final IDrumPadBank drumPadBank = primary.getDrumPadBank();
final int scrollPos = drumPadBank.getScrollPosition();
final IDrumPadBank cdDrumPadBank = cd.getDrumPadBank();
final int pageSize = cdDrumPadBank.getPageSize();
final int adjustedPage = playedPad / pageSize * pageSize;
cdDrumPadBank.scrollTo(scrollPos + adjustedPage, false);
// Do not reselect, if pad is already selected
final IDrumPad drumPad = drumPadBank.getItem(playedPad);
if (drumPad.isSelected()) {
// If the instrument of the pad was selected for editing, try to select it again
if (isNested) {
final IDrumPad selectedItem = cdDrumPadBank.getItem(playedPad % pageSize);
if (selectedItem != null)
selectedItem.enter();
}
return;
}
// Only activate layer mode if not one of the layer modes is already active
final ModeManager modeManager = this.surface.getModeManager();
if (!Modes.isLayerMode(modeManager.getActiveID()))
modeManager.setActive(Modes.DEVICE_LAYER);
drumPad.select();
}
Aggregations