use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class PanView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final ColorManager cm = this.model.getColorManager();
final IChannelBank tb = this.model.getCurrentTrackBank();
final IMidiOutput output = this.surface.getOutput();
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
final int color = cm.getColor(BitwigColors.getColorIndex(track.getColor()));
if (this.trackColors[i] != color || !track.doesExist())
this.setupFader(i);
this.trackColors[i] = color;
output.sendCC(LaunchpadControlSurface.LAUNCHPAD_FADER_1 + i, track.getPan());
}
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class PushCursorCommand method updateArrowStates.
/**
* {@inheritDoc}
*/
@Override
protected void updateArrowStates() {
final IChannelBank tb = this.model.getCurrentTrackBank();
this.canScrollUp = tb.canScrollScenesUp();
this.canScrollDown = tb.canScrollScenesDown();
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS)) {
final DeviceParamsMode mode = (DeviceParamsMode) modeManager.getActiveMode();
this.canScrollLeft = mode.canSelectPreviousPage();
this.canScrollRight = mode.canSelectNextPage();
return;
}
if (modeManager.isActiveMode(Modes.MODE_BROWSER)) {
final IBrowser browser = this.model.getBrowser();
final int index = browser.getSelectedContentTypeIndex();
this.canScrollLeft = index > 0;
this.canScrollRight = index < browser.getContentTypeNames().length - 1;
return;
}
if (Modes.isLayerMode(modeManager.getActiveModeId())) {
final ICursorDevice cd = this.model.getCursorDevice();
this.canScrollLeft = cd.canScrollLayersOrDrumPadsUp();
this.canScrollRight = cd.canScrollLayersOrDrumPadsDown();
return;
}
final ITrack sel = tb.getSelectedTrack();
final int selIndex = sel != null ? sel.getIndex() : -1;
this.canScrollLeft = selIndex > 0 || tb.canScrollTracksUp();
this.canScrollRight = selIndex >= 0 && selIndex < 7 && tb.getTrack(selIndex + 1).doesExist() || tb.canScrollTracksDown();
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class APCControllerSetup method updateIndication.
private void updateIndication(final Integer mode) {
final ITrackBank tb = this.model.getTrackBank();
final IChannelBank tbe = this.model.getEffectTrackBank();
final APCControlSurface surface = this.getSurface();
final boolean isSession = surface.getViewManager().isActiveView(Views.VIEW_SESSION);
final boolean isEffect = this.model.isEffectTrackBankActive();
final boolean isPan = mode == Modes.MODE_PAN;
tb.setIndication(!isEffect && isSession);
tbe.setIndication(isEffect && isSession);
final ICursorDevice cursorDevice = this.model.getCursorDevice();
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
track.setVolumeIndication(!isEffect);
track.setPanIndication(!isEffect && isPan);
for (int j = 0; j < 8; j++) track.getSend(j).setIndication(!isEffect && (mode == Modes.MODE_SEND1 && j == 0 || mode == Modes.MODE_SEND2 && j == 1 || mode == Modes.MODE_SEND3 && j == 2 || mode == Modes.MODE_SEND4 && j == 3 || mode == Modes.MODE_SEND5 && j == 4 || mode == Modes.MODE_SEND6 && j == 5 || mode == Modes.MODE_SEND7 && j == 6 || mode == Modes.MODE_SEND8 && j == 7));
final ITrack fxTrack = tbe.getTrack(i);
fxTrack.setVolumeIndication(isEffect);
fxTrack.setPanIndication(isEffect && isPan);
cursorDevice.indicateParameter(i, true);
}
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class APCControllerSetup method updateButtons.
private void updateButtons() {
final APCControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
final View activeView = viewManager.getActiveView();
if (activeView != null) {
((APCCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
((SceneView) activeView).updateSceneButtons();
}
final boolean isShift = surface.isShiftPressed();
final boolean isSendA = surface.isPressed(APCControlSurface.APC_BUTTON_SEND_A);
final ITransport t = this.model.getTransport();
surface.updateButton(APCControlSurface.APC_BUTTON_PLAY, t.isPlaying() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_RECORD, t.isRecording() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
// Activator, Solo, Record Arm
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selTrack = tb.getSelectedTrack();
final int selIndex = selTrack == null ? -1 : selTrack.getIndex();
final int clipLength = surface.getConfiguration().getNewClipLength();
final ModeManager modeManager = surface.getModeManager();
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
boolean isOn;
if (isShift)
isOn = i == clipLength;
else
isOn = isSendA ? modeManager.isActiveMode(Integer.valueOf(Modes.MODE_SEND1.intValue() + i)) : i == selIndex;
surface.updateButtonEx(APCControlSurface.APC_BUTTON_TRACK_SELECTION, i, isOn ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButtonEx(APCControlSurface.APC_BUTTON_SOLO, i, track.doesExist() && (isShift ? track.isAutoMonitor() : track.isSolo()) ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButtonEx(APCControlSurface.APC_BUTTON_ACTIVATOR, i, track.doesExist() && (isShift ? track.isMonitor() : !track.isMute()) ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
if (this.isMkII) {
surface.updateButtonEx(APCControlSurface.APC_BUTTON_A_B, i, track.doesExist() && !"AB".equals(track.getCrossfadeMode()) ? "A".equals(track.getCrossfadeMode()) ? ColorManager.BUTTON_STATE_ON : APCColors.BUTTON_STATE_BLINK : ColorManager.BUTTON_STATE_OFF);
surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && track.isRecArm() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
} else {
if (isShift)
surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && !"AB".equals(track.getCrossfadeMode()) ? "A".equals(track.getCrossfadeMode()) ? ColorManager.BUTTON_STATE_ON : APCColors.BUTTON_STATE_BLINK : ColorManager.BUTTON_STATE_OFF);
else
surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && track.isRecArm() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
}
}
surface.updateButton(APCControlSurface.APC_BUTTON_MASTER, this.model.getMasterTrack().isSelected() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
final ICursorDevice device = this.model.getCursorDevice();
if (this.isMkII) {
surface.updateButton(APCControlSurface.APC_BUTTON_SESSION, t.isLauncherOverdub() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_SEND_C, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DETAIL_VIEW, device.isEnabled() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_REC_QUANT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_MIDI_OVERDUB, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_METRONOME, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_CLIP_TRACK, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_ON_OFF, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_LEFT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_RIGHT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_BANK, this.model.getBrowser().isActive() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
} else {
surface.updateButton(APCControlSurface.APC_BUTTON_DETAIL_VIEW, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_REC_QUANT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_MIDI_OVERDUB, t.isLauncherOverdub() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_METRONOME, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_CLIP_TRACK, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_ON_OFF, device.isEnabled() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_LEFT, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_RIGHT, ColorManager.BUTTON_STATE_OFF);
}
this.updateDeviceKnobs();
}
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) {
if (velocity == 0)
return;
final int channel = note % 8;
final int scene = 7 - note / 8;
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack track = tb.getTrack(channel);
final ISlot slot = track.getSlot(scene);
if (track.isRecArm() && !slot.isRecording())
slot.record();
slot.launch();
if (this.doSelectClipOnLaunch())
slot.select();
}
Aggregations