use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class LeftCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack sel = tb.getSelectedTrack();
final int index = sel == null ? 0 : sel.getIndex() - 1;
final View view = this.surface.getViewManager().getActiveView();
if (index == -1 || this.surface.isShiftPressed()) {
if (!tb.canScrollTracksUp())
return;
tb.scrollTracksPageUp();
final int newSel = index == -1 || sel == null ? 7 : sel.getIndex();
this.surface.scheduleTask(() -> view.selectTrack(newSel), 75);
return;
}
view.selectTrack(index);
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class SelectNoteViewCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ViewManager viewManager = this.surface.getViewManager();
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack sel = tb.getSelectedTrack();
if (sel == null) {
viewManager.setActiveView(Views.VIEW_SESSION);
return;
}
final boolean isShifted = this.surface.isShiftPressed();
if (Views.isNoteView(isShifted ? viewManager.getPreviousViewId() : viewManager.getActiveViewId())) {
if (isShifted)
this.seqSelect.executeNormal(event);
else
this.playSelect.executeNormal(event);
} else {
final Integer viewID = viewManager.getPreferredView(sel.getPosition());
if (viewID == null)
this.seqSelect.executeNormal(event);
else
viewManager.setActiveView(viewID);
}
viewManager.setPreferredView(sel.getPosition(), viewManager.getActiveViewId());
this.surface.getDisplay().notify(viewManager.getActiveView().getName());
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class BaseMode method updateFirstRow.
/**
* {@inheritDoc}
*/
@Override
public void updateFirstRow() {
final IChannelBank tb = this.model.getCurrentTrackBank();
final int extenderOffset = this.surface.getExtenderOffset();
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(extenderOffset + i);
this.surface.updateButton(MCUControlSurface.MCU_ARM1 + i, track.isRecArm() ? MCUControllerSetup.MCU_BUTTON_STATE_ON : MCUControllerSetup.MCU_BUTTON_STATE_OFF);
this.surface.updateButton(MCUControlSurface.MCU_SOLO1 + i, track.isSolo() ? MCUControllerSetup.MCU_BUTTON_STATE_ON : MCUControllerSetup.MCU_BUTTON_STATE_OFF);
this.surface.updateButton(MCUControlSurface.MCU_MUTE1 + i, track.isMute() ? MCUControllerSetup.MCU_BUTTON_STATE_ON : MCUControllerSetup.MCU_BUTTON_STATE_OFF);
this.surface.updateButton(MCUControlSurface.MCU_SELECT1 + i, track.isSelected() ? MCUControllerSetup.MCU_BUTTON_STATE_ON : MCUControllerSetup.MCU_BUTTON_STATE_OFF);
}
this.updateKnobLEDs();
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class BaseMode method drawDisplay2.
protected void drawDisplay2() {
if (!this.surface.getConfiguration().hasDisplay2())
return;
final IChannelBank tb = this.model.getCurrentTrackBank();
// Format track names
final Display d2 = this.surface.getSecondDisplay();
final int extenderOffset = this.surface.getExtenderOffset();
final boolean isMainDevice = this.surface.isMainDevice();
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getTrack(extenderOffset + i);
d2.setCell(0, i, StringUtils.shortenAndFixASCII(t.getName(), isMainDevice ? 6 : 7));
}
if (isMainDevice)
d2.setCell(0, 8, "Maste");
d2.done(0);
d2.clearRow(1);
if (isMainDevice) {
final IMasterTrack masterTrack = this.model.getMasterTrack();
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final ITrack selectedTrack = masterTrack.isSelected() ? masterTrack : tb.getSelectedTrack();
d2.setBlock(1, 0, "Sel.track: ").setBlock(1, 1, selectedTrack == null ? "None" : StringUtils.fixASCII(selectedTrack.getName()));
d2.setBlock(1, 2, "Sel.devce: ").setBlock(1, 3, cursorDevice.hasSelectedDevice() ? cursorDevice.getName() : "None");
}
d2.done(1);
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class PitchbendVolumeCommand method handleTrack.
private void handleTrack(final int index, final double value) {
final boolean effectTrackBankActive = this.model.isEffectTrackBankActive();
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selectedTrack = tb.getSelectedTrack();
switch(index) {
case 0:
selectedTrack.setVolume(value);
return;
case 1:
selectedTrack.setPan(value);
return;
}
final MCUConfiguration config = this.surface.getConfiguration();
if (index == 2) {
if (config.isDisplayCrossfader()) {
final double range = this.model.getValueChanger().getUpperBound() / 3.0;
selectedTrack.setCrossfadeModeAsNumber((int) Math.round(value / range));
} else if (!effectTrackBankActive)
selectedTrack.getSend(0).setValue(value);
} else if (!effectTrackBankActive)
selectedTrack.getSend(index - (config.isDisplayCrossfader() ? 3 : 2)).setValue(value);
}
Aggregations