use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class CursorCommand method scrollTrackBankLeft.
protected void scrollTrackBankLeft(final ITrack sel, final int index) {
final IChannelBank tb = this.model.getCurrentTrackBank();
if (!tb.canScrollTracksUp())
return;
tb.scrollTracksPageUp();
final int newSel = index == -1 || sel == null ? 7 : sel.getIndex();
this.surface.scheduleTask(() -> this.selectTrack(newSel), BUTTON_REPEAT_INTERVAL);
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class CursorCommand method scrollTrackBankRight.
protected void scrollTrackBankRight(final ITrack sel, final int index) {
final IChannelBank tb = this.model.getCurrentTrackBank();
if (!tb.canScrollTracksDown())
return;
tb.scrollTracksPageDown();
final int newSel = index == 8 || sel == null ? 0 : sel.getIndex();
this.surface.scheduleTask(() -> this.selectTrack(newSel), BUTTON_REPEAT_INTERVAL);
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class TrackView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
if (velocity == 0)
return;
final IChannelBank tb = this.model.getCurrentTrackBank();
int track;
ITrack selectedTrack;
ITrack sel;
int index;
int newSel;
switch(note - 36) {
// Toggle Activate
case 0:
selectedTrack = tb.getSelectedTrack();
if (selectedTrack != null)
selectedTrack.toggleIsActivated();
break;
// Track left
case 1:
sel = tb.getSelectedTrack();
index = sel == null ? 0 : sel.getIndex() - 1;
if (index == -1 || this.surface.isShiftPressed()) {
if (!tb.canScrollTracksUp())
return;
tb.scrollTracksPageUp();
newSel = index == -1 || sel == null ? 7 : sel.getIndex();
this.surface.scheduleTask(() -> this.selectTrack(newSel), 75);
return;
}
this.selectTrack(index);
break;
// Track right
case 2:
sel = tb.getSelectedTrack();
index = sel == null ? 0 : sel.getIndex() + 1;
if (index == 8 || this.surface.isShiftPressed()) {
if (!tb.canScrollTracksDown())
return;
tb.scrollTracksPageDown();
newSel = index == 8 || sel == null ? 0 : sel.getIndex();
this.surface.scheduleTask(() -> this.selectTrack(newSel), 75);
return;
}
this.selectTrack(index);
break;
// Move down
case 3:
if (tb instanceof ITrackBank)
((ITrackBank) tb).selectChildren();
break;
// Move up
case 4:
if (tb instanceof ITrackBank)
((ITrackBank) tb).selectParent();
break;
// Unused
case 5:
break;
// Track Page down
case 6:
this.scrollTracksLeft();
break;
// Track Page up
case 7:
this.scrollTracksRight();
break;
default:
track = note - 36 - 8;
this.selectTrack(track);
break;
}
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class PushControllerSetup method updateButtons.
private void updateButtons() {
final ITransport t = this.model.getTransport();
final PushControlSurface surface = this.getSurface();
surface.updateButton(PushControlSurface.PUSH_BUTTON_METRONOME, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_PLAY, t.isPlaying() ? PushColors.PUSH_BUTTON_STATE_PLAY_HI : PushColors.PUSH_BUTTON_STATE_PLAY_ON);
final boolean isShift = surface.isShiftPressed();
final boolean isFlipRecord = this.configuration.isFlipRecord();
final boolean isRecordShifted = isShift && !isFlipRecord || !isShift && isFlipRecord;
if (isRecordShifted)
surface.updateButton(PushControlSurface.PUSH_BUTTON_AUTOMATION, t.isWritingClipLauncherAutomation() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
else
surface.updateButton(PushControlSurface.PUSH_BUTTON_AUTOMATION, t.isWritingArrangerAutomation() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_RECORD, isRecordShifted ? t.isLauncherOverdub() ? PushColors.PUSH_BUTTON_STATE_OVR_HI : PushColors.PUSH_BUTTON_STATE_OVR_ON : t.isRecording() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_ACCENT, this.configuration.isAccentActive() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
final PushConfiguration config = surface.getConfiguration();
if (this.isPush2) {
final ModeManager modeManager = surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER)) {
final ICursorDevice cd = this.model.getCursorDevice();
final IChannel layer = cd.getSelectedLayerOrDrumPad();
surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, layer != null && layer.isMute() ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, layer != null && layer.isSolo() ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
} else {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selTrack = modeManager.isActiveMode(Modes.MODE_MASTER) ? this.model.getMasterTrack() : tb.getSelectedTrack();
surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, selTrack != null && selTrack.isMute() ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, selTrack != null && selTrack.isSolo() ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
}
surface.updateButton(PushControlSurface.PUSH_BUTTON_CONVERT, this.model.canConvertClip() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
} else {
final boolean isMuteState = config.isMuteState();
surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, isMuteState ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, !isMuteState ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
}
final ViewManager viewManager = surface.getViewManager();
final boolean isSessionView = Views.isSessionView(viewManager.getActiveViewId());
surface.updateButton(PushControlSurface.PUSH_BUTTON_NOTE, isSessionView ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_HI);
if (this.host.hasClips()) {
surface.updateButton(PushControlSurface.PUSH_BUTTON_CLIP_STOP, surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP) ? PushColors.PUSH_BUTTON_STATE_STOP_HI : PushColors.PUSH_BUTTON_STATE_STOP_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SESSION, isSessionView ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
} else {
surface.updateButton(PushControlSurface.PUSH_BUTTON_CLIP_STOP, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SESSION, ColorManager.BUTTON_STATE_OFF);
}
surface.updateButton(PushControlSurface.PUSH_BUTTON_ACCENT, config.isAccentActive() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
final View activeView = viewManager.getActiveView();
if (activeView != null) {
((PushCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
((SceneView) activeView).updateSceneButtons();
}
final ICursorClip clip = activeView instanceof AbstractSequencerView && !(activeView instanceof ClipView) ? ((AbstractSequencerView<?, ?>) activeView).getClip() : null;
surface.updateButton(PushControlSurface.PUSH_BUTTON_DEVICE_LEFT, clip != null && clip.canScrollStepsBackwards() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(PushControlSurface.PUSH_BUTTON_DEVICE_RIGHT, clip != null && clip.canScrollStepsForwards() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class SessionView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
final ModeManager modeManager = this.surface.getModeManager();
final Integer activeModeId = modeManager.getActiveModeId();
// Block 1st row if mode is active
final boolean isNotRow1 = note >= 44;
if (activeModeId == null || isNotRow1) {
if (this.surface.isShiftPressed()) {
this.onGridNoteBankSelection(note, velocity, isNotRow1);
return;
}
final int n = note - (activeModeId != null ? 8 : 0);
final int index = n - 36;
final int t = index % this.columns;
// Duplicate a clip
if (this.surface.isPressed(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DUPLICATE)) {
this.surface.setButtonConsumed(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DUPLICATE);
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack track = tb.getTrack(t);
if (track.doesExist()) {
final int s = this.rows - 1 - index / this.columns;
track.getSlot(s).duplicate();
}
return;
}
super.onGridNote(n, velocity);
return;
}
if (velocity != 0)
this.handleFirstRowModes(note, modeManager);
}
Aggregations