use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class AddTrackCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
IChannelBank tb = this.model.getTrackBank();
final IApplication application = this.model.getApplication();
if (this.surface.isShiftPressed()) {
application.addEffectTrack();
tb = this.model.getEffectTrackBank();
} else if (this.surface.isSelectPressed())
application.addAudioTrack();
else
application.addInstrumentTrack();
final IChannelBank bank = tb;
this.surface.scheduleTask(() -> {
final int pos = bank.getTrackCount() - 1;
bank.scrollToChannel(pos);
bank.getTrack(pos % bank.getNumTracks()).select();
}, 200);
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class MuteCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
// Update for key combinations
this.surface.getViewManager().getActiveView().updateNoteMapping();
final PushConfiguration config = this.surface.getConfiguration();
if (!config.isPush2()) {
config.setTrackState(TrackState.MUTE);
return;
}
// Toggle mute lock mode
if (this.surface.isShiftPressed()) {
if (event == ButtonEvent.UP)
config.setMuteSoloLocked(!config.isMuteSoloLocked());
return;
}
// Behaviour like Push 1
if (config.isMuteSoloLocked()) {
config.setTrackState(TrackState.MUTE);
return;
}
if (event == ButtonEvent.DOWN) {
config.setIsMuteLongPressed(false);
return;
}
if (event == ButtonEvent.LONG) {
config.setIsMuteLongPressed(true);
config.setTrackState(TrackState.MUTE);
return;
}
if (config.isMuteLongPressed()) {
config.setIsMuteLongPressed(false);
return;
}
final Integer activeModeId = this.surface.getModeManager().getActiveModeId();
if (Modes.isTrackMode(activeModeId)) {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selTrack = tb.getSelectedTrack();
if (selTrack != null)
selTrack.toggleMute();
} else if (Modes.isLayerMode(activeModeId)) {
final ICursorDevice cd = this.model.getCursorDevice();
final IChannel layer = cd.getSelectedLayerOrDrumPad();
if (layer != null)
cd.toggleLayerOrDrumPadMute(layer.getIndex());
} else if (activeModeId == Modes.MODE_MASTER)
this.model.getMasterTrack().toggleMute();
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class SoloCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
// Update for key combinations
this.surface.getViewManager().getActiveView().updateNoteMapping();
final PushConfiguration config = this.surface.getConfiguration();
if (!config.isPush2()) {
config.setTrackState(TrackState.SOLO);
return;
}
// Toggle solo lock mode
if (this.surface.isShiftPressed()) {
if (event == ButtonEvent.UP)
config.setMuteSoloLocked(!config.isMuteSoloLocked());
return;
}
// Behaviour like Push 1
if (config.isMuteSoloLocked()) {
config.setTrackState(TrackState.SOLO);
return;
}
if (event == ButtonEvent.DOWN) {
config.setIsSoloLongPressed(false);
return;
}
if (event == ButtonEvent.LONG) {
config.setIsSoloLongPressed(true);
config.setTrackState(TrackState.SOLO);
return;
}
if (config.isSoloLongPressed()) {
config.setIsSoloLongPressed(false);
return;
}
final Integer activeModeId = this.surface.getModeManager().getActiveModeId();
if (Modes.isTrackMode(activeModeId)) {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selTrack = tb.getSelectedTrack();
if (selTrack != null)
selTrack.toggleSolo();
} else if (Modes.isLayerMode(activeModeId)) {
final ICursorDevice cd = this.model.getCursorDevice();
final IChannel layer = cd.getSelectedLayerOrDrumPad();
if (layer != null)
cd.toggleLayerOrDrumPadSolo(layer.getIndex());
} else if (activeModeId == Modes.MODE_MASTER)
this.model.getMasterTrack().toggleSolo();
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class TrackMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final IChannelBank currentTrackBank = this.model.getCurrentTrackBank();
final ITrack t = currentTrackBank.getSelectedTrack();
final Display d = this.surface.getDisplay();
if (t == null) {
d.setRow(0, " Please select a track... ").clearRow(2).done(2);
return;
}
d.setCell(0, 0, "Volume").setCell(2, 0, t.getVolumeStr(8)).setCell(0, 1, "Pan").setCell(2, 1, t.getPanStr(8));
int sendStart = 2;
int sendCount = 6;
if (this.surface.getConfiguration().isDisplayCrossfader()) {
sendStart = 3;
sendCount = 5;
final String crossfadeMode = t.getCrossfadeMode();
d.setCell(0, 2, "Crossfdr").setCell(2, 2, "A".equals(crossfadeMode) ? "A" : "B".equals(crossfadeMode) ? " B" : " <> ");
}
final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
int pos;
if (fxTrackBank != null) {
final boolean isFX = this.model.isEffectTrackBankActive();
for (int i = 0; i < sendCount; i++) {
final ITrack fxTrack = fxTrackBank.getTrack(i);
final boolean isEmpty = isFX || !fxTrack.doesExist();
pos = sendStart + i;
d.setCell(0, pos, isEmpty ? "" : fxTrack.getName()).setCell(2, pos, isEmpty ? "" : t.getSend(i).getDisplayedValue(8));
}
if (isFX)
d.setCell(0, 7, t.getName());
} else {
for (int i = 0; i < sendCount; i++) {
pos = sendStart + i;
final ISend send = t.getSend(i);
d.setCell(0, pos, send.getName(8)).setCell(2, pos, send.getDisplayedValue(8));
}
}
d.done(0).done(2);
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class CursorCommand method scrollTracksLeft.
protected void scrollTracksLeft() {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack sel = tb.getSelectedTrack();
final int index = sel == null ? 0 : sel.getIndex() - 1;
if (index == -1 || this.surface.isShiftPressed()) {
this.scrollTrackBankLeft(sel, index);
return;
}
this.selectTrack(index);
}
Aggregations