use of de.mossgrabers.framework.daw.data.bank.IDrumPadBank 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.bank.IDrumPadBank in project DrivenByMoss by git-moss.
the class AbstractDrumView method handleNoteAreaButtonCombinations.
protected void handleNoteAreaButtonCombinations(final int playedPad) {
if (this.isDeleteTrigger()) {
// Delete all of the notes on that 'pad'
this.handleDeleteButton(playedPad);
return;
}
if (this.isMuteTrigger()) {
// Mute that 'pad'
this.handleMuteButton(playedPad);
return;
}
if (this.isSoloTrigger()) {
// Solo that 'pad'
this.handleSoloButton(playedPad);
return;
}
if (this.isBrowseTrigger()) {
this.surface.setTriggerConsumed(this.buttonBrowse);
final IDrumDevice primary = this.model.getDrumDevice();
if (!primary.hasDrumPads())
return;
final IDrumPadBank drumPadBank = primary.getDrumPadBank();
this.scrollPosition = drumPadBank.getScrollPosition();
this.model.getBrowser().replace(drumPadBank.getItem(playedPad));
return;
}
if (this.isSelectTrigger() || this.configuration.isAutoSelectDrum()) {
// Also select the matching device layer channel of the pad
this.handleSelectButton(playedPad);
}
}
use of de.mossgrabers.framework.daw.data.bank.IDrumPadBank in project DrivenByMoss by git-moss.
the class DrumView method getDrumPadColor.
private int getDrumPadColor(final int index, final IDrumDevice primary) {
final int offsetY = this.scales.getDrumOffset();
// Playing note?
if (this.keyManager.isKeyPressed(offsetY + index))
return BeatstepColorManager.BEATSTEP_BUTTON_STATE_PINK;
// Selected?
if (this.selectedPad == index)
return BeatstepColorManager.BEATSTEP_BUTTON_STATE_RED;
// Exists and active?
final IDrumPadBank drumPadBank = primary.getDrumPadBank();
final IChannel drumPad = drumPadBank.getItem(index);
if (!drumPad.doesExist() || !drumPad.isActivated())
return BeatstepColorManager.BEATSTEP_BUTTON_STATE_OFF;
// Muted or soloed?
if (drumPad.isMute() || drumPadBank.hasSoloedPads() && !drumPad.isSolo())
return BeatstepColorManager.BEATSTEP_BUTTON_STATE_OFF;
return BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE;
}
use of de.mossgrabers.framework.daw.data.bank.IDrumPadBank in project DrivenByMoss by git-moss.
the class AbstractDrum64View method getDrumPadColor.
private String getDrumPadColor(final int index, final IDrumDevice primary, final boolean isRecording) {
// Playing note?
if (this.pressedKeys[this.offsetY + index] > 0)
return isRecording ? AbstractDrumView.COLOR_PAD_RECORD : AbstractDrumView.COLOR_PAD_PLAY;
// Selected?
if (this.selectedPad == index)
return AbstractDrumView.COLOR_PAD_SELECTED;
// Exists and active?
final IDrumPadBank drumPadBank = primary.getDrumPadBank();
final IChannel drumPad = drumPadBank.getItem(index);
if (!drumPad.doesExist() || !drumPad.isActivated())
return this.surface.getConfiguration().isTurnOffEmptyDrumPads() ? AbstractDrumView.COLOR_PAD_OFF : AbstractDrumView.COLOR_PAD_NO_CONTENT;
// Muted or soloed?
if (drumPad.isMute() || drumPadBank.hasSoloedPads() && !drumPad.isSolo())
return AbstractDrumView.COLOR_PAD_MUTED;
return this.getPadContentColor(drumPad);
}
use of de.mossgrabers.framework.daw.data.bank.IDrumPadBank in project DrivenByMoss by git-moss.
the class AbstractDrum64View method onOctaveDown.
/**
* {@inheritDoc}
*/
@Override
public void onOctaveDown(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
this.clearPressedKeys();
final int oldDrumOctave = this.drumOctave;
this.drumOctave = Math.max(-2, this.drumOctave - 1);
this.offsetY = DRUM_START_KEY + this.drumOctave * BLOCK_SIZE;
this.updateNoteMapping();
this.surface.getDisplay().notify(this.getDrumRangeText());
if (oldDrumOctave != this.drumOctave) {
final IDrumDevice drumDevice64 = this.model.getDrumDevice64();
final IDrumPadBank drumPadBank = drumDevice64.getDrumPadBank();
for (int i = 0; i < BLOCK_SIZE; i++) drumPadBank.scrollBackwards();
}
}
Aggregations