use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class VolumeMode method updateDisplay1.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay1(final ITextDisplay display) {
final ITrackBank tb = this.model.getCurrentTrackBank();
final PushConfiguration config = this.surface.getConfiguration();
final int upperBound = this.model.getValueChanger().getUpperBound();
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getItem(i);
display.setCell(0, i, t.doesExist() ? "Volume" : "").setCell(1, i, t.getVolumeStr(8));
if (t.doesExist())
display.setCell(2, i, config.isEnableVUMeters() ? Push1Display.formatValue(t.getVolume(), t.getVu(), upperBound) : Push1Display.formatValue(t.getVolume(), upperBound));
}
this.drawRow4(display);
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class ACVSMasterCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.DOWN)
return;
final IMasterTrack masterTrack = this.model.getMasterTrack();
final ITrackBank trackBank = this.model.getTrackBank();
if (masterTrack.isSelected())
trackBank.selectItemAtPosition(this.position);
else {
final Optional<ITrack> selectedTrack = trackBank.getSelectedItem();
this.position = selectedTrack.isPresent() ? selectedTrack.get().getPosition() : 0;
masterTrack.select();
}
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class MaschineControllerSetup method createModel.
/**
* {@inheritDoc}
*/
@Override
protected void createModel() {
final ModelSetup ms = new ModelSetup();
ms.setHasFullFlatTrackList(true);
ms.setNumTracks(this.maschine.hasGroupButtons() ? 8 : 16);
ms.setNumDevicesInBank(16);
ms.setNumScenes(16);
this.model = this.factory.createModel(this.configuration, this.colorManager, this.valueChanger, this.scales, ms);
final ITrackBank trackBank = this.model.getTrackBank();
trackBank.setIndication(true);
trackBank.addSelectionObserver((index, isSelected) -> this.handleTrackChange(isSelected));
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class KontrolProtocolControllerSetup method registerTriggerCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerTriggerCommands() {
final KontrolProtocolControlSurface surface = this.getSurface();
final ITransport t = this.model.getTransport();
this.addButton(ButtonID.PLAY, "Play", new PlayCommand<>(this.model, surface), 15, KontrolProtocolControlSurface.KONTROL_PLAY, t::isPlaying);
this.addButton(ButtonID.NEW, "Shift+\nPlay", new NewCommand<>(this.model, surface), 15, KontrolProtocolControlSurface.KONTROL_RESTART);
final ConfiguredRecordCommand<KontrolProtocolControlSurface, KontrolProtocolConfiguration> recordCommand = new ConfiguredRecordCommand<>(false, this.model, surface);
this.addButton(ButtonID.RECORD, "Record", recordCommand, 15, KontrolProtocolControlSurface.KONTROL_RECORD, recordCommand::isLit);
final ConfiguredRecordCommand<KontrolProtocolControlSurface, KontrolProtocolConfiguration> shiftedRecordCommand = new ConfiguredRecordCommand<>(true, this.model, surface);
this.addButton(ButtonID.REC_ARM, "Shift+\nRecord", shiftedRecordCommand, 15, KontrolProtocolControlSurface.KONTROL_COUNT_IN, shiftedRecordCommand::isLit);
this.addButton(ButtonID.STOP, "Stop", new StopCommand<>(this.model, surface), 15, KontrolProtocolControlSurface.KONTROL_STOP, () -> !t.isPlaying());
this.addButton(ButtonID.LOOP, "Loop", new ToggleLoopCommand<>(this.model, surface), 15, KontrolProtocolControlSurface.KONTROL_LOOP, t::isLoop);
this.addButton(ButtonID.METRONOME, "Metronome", new MetronomeCommand<>(this.model, surface, false), 15, KontrolProtocolControlSurface.KONTROL_METRO, t::isMetronomeOn);
this.addButton(ButtonID.TAP_TEMPO, "Tempo", new TapTempoCommand<>(this.model, surface), 15, KontrolProtocolControlSurface.KONTROL_TAP_TEMPO);
// Note: Since there is no pressed-state with this device, in the simulator-GUI the
// following buttons are always on
this.addButton(ButtonID.UNDO, "Undo", new UndoCommand<>(this.model, surface), 15, KontrolProtocolControlSurface.KONTROL_UNDO, () -> this.model.getApplication().canUndo());
this.addButton(ButtonID.REDO, "Redo", new RedoCommand<>(this.model, surface), 15, KontrolProtocolControlSurface.KONTROL_REDO, () -> this.model.getApplication().canRedo());
this.addButton(ButtonID.QUANTIZE, "Quantize", new QuantizeCommand<>(this.model, surface), 15, KontrolProtocolControlSurface.KONTROL_QUANTIZE, () -> true);
this.addButton(ButtonID.AUTOMATION, "Automation", new WriteArrangerAutomationCommand<>(this.model, surface), 15, KontrolProtocolControlSurface.KONTROL_AUTOMATION, t::isWritingArrangerAutomation);
this.addButton(ButtonID.DELETE, "Modes", new ModeMultiSelectCommand<>(this.model, surface, Modes.VOLUME, Modes.SEND, Modes.DEVICE_PARAMS), 15, KontrolProtocolControlSurface.KONTROL_CLEAR, () -> true);
this.addButton(ButtonID.CLIP, "Start Clip", new StartClipOrSceneCommand(this.model, surface), 15, KontrolProtocolControlSurface.KONTROL_PLAY_SELECTED_CLIP);
this.addButton(ButtonID.STOP_CLIP, "Stop Clip", new StopClipCommand<>(this.model, surface), 15, KontrolProtocolControlSurface.KONTROL_STOP_CLIP);
// Not implemented in NIHIA
this.addButton(ButtonID.SCENE1, "Play Scene", new StartSceneCommand<>(this.model, surface), 15, KontrolProtocolControlSurface.KONTROL_PLAY_SCENE);
// KONTROL_RECORD_SESSION - Not implemented in NIHIA
this.addButton(ButtonID.MUTE, "Mute", new MuteCommand<>(this.model, surface), 15, KontrolProtocolControlSurface.KONTROL_SELECTED_TRACK_MUTE, () -> {
final ITrackBank tb = this.model.getCurrentTrackBank();
final Optional<ITrack> selectedTrack = tb.getSelectedItem();
return selectedTrack.isPresent() && selectedTrack.get().isMute() ? 1 : 0;
});
this.addButton(ButtonID.SOLO, "Solo", new SoloCommand<>(this.model, surface), 15, KontrolProtocolControlSurface.KONTROL_SELECTED_TRACK_SOLO, () -> {
final ITrackBank tb = this.model.getCurrentTrackBank();
final Optional<ITrack> selectedTrack = tb.getSelectedItem();
return selectedTrack.isPresent() && selectedTrack.get().isSolo() ? 1 : 0;
});
this.addButtons(surface, 0, 8, ButtonID.ROW_SELECT_1, "Select", (event, index) -> {
if (event == ButtonEvent.DOWN)
this.model.getCurrentTrackBank().getItem(index).selectOrExpandGroup();
}, 15, KontrolProtocolControlSurface.KONTROL_TRACK_SELECTED, index -> this.model.getTrackBank().getItem(index).isSelected() ? 1 : 0);
this.addButtons(surface, 0, 8, ButtonID.ROW1_1, "Mute", (event, index) -> {
if (event == ButtonEvent.DOWN)
this.model.getTrackBank().getItem(index).toggleMute();
}, 15, KontrolProtocolControlSurface.KONTROL_TRACK_MUTE, index -> this.model.getTrackBank().getItem(index).isMute() ? 1 : 0);
this.addButtons(surface, 0, 8, ButtonID.ROW2_1, "Solo", (event, index) -> {
if (event == ButtonEvent.DOWN)
this.model.getTrackBank().getItem(index).toggleSolo();
}, 15, KontrolProtocolControlSurface.KONTROL_TRACK_SOLO, index -> this.model.getTrackBank().getItem(index).isSolo() ? 1 : 0);
this.addButtons(surface, 0, 8, ButtonID.ROW3_1, "Arm", (event, index) -> {
if (event == ButtonEvent.DOWN)
this.model.getTrackBank().getItem(index).toggleRecArm();
}, 15, KontrolProtocolControlSurface.KONTROL_TRACK_RECARM, index -> this.model.getTrackBank().getItem(index).isRecArm() ? 1 : 0);
this.addButton(ButtonID.F1, "", NopCommand.INSTANCE, 15, KontrolProtocolControlSurface.KONTROL_SELECTED_TRACK_AVAILABLE);
this.addButton(ButtonID.F2, "", NopCommand.INSTANCE, 15, KontrolProtocolControlSurface.KONTROL_SELECTED_TRACK_MUTED_BY_SOLO);
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class KontrolProtocolControllerSetup method flush.
/**
* {@inheritDoc}
*/
@Override
public void flush() {
// Do not flush until handshake has finished
if (!this.getSurface().isConnectedToNIHIA())
return;
final KontrolProtocolControlSurface surface = this.getSurface();
final String kompleteInstanceNew = this.getKompleteInstance();
if (!this.kompleteInstance.equals(kompleteInstanceNew)) {
this.kompleteInstance = kompleteInstanceNew;
surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_INSTANCE, 0, 0, kompleteInstanceNew);
}
final ITrackBank bank = this.model.getCurrentTrackBank();
final boolean hasSolo = this.model.getProject().hasSolo();
for (int i = 0; i < 8; i++) {
final ITrack track = bank.getItem(i);
surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_MUTE, track.isMute() ? 1 : 0, i);
surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_SOLO, track.isSolo() ? 1 : 0, i);
surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_MUTED_BY_SOLO, !track.isSolo() && hasSolo ? 1 : 0, i);
}
final ITrackBank tb = this.model.getCurrentTrackBank();
final Optional<ITrack> selectedTrack = tb.getSelectedItem();
surface.sendCommand(KontrolProtocolControlSurface.KONTROL_SELECTED_TRACK_AVAILABLE, selectedTrack.isPresent() ? TrackType.toTrackType(selectedTrack.get().getType()) : 0);
surface.sendCommand(KontrolProtocolControlSurface.KONTROL_SELECTED_TRACK_MUTED_BY_SOLO, selectedTrack.isPresent() && !selectedTrack.get().isSolo() && hasSolo ? 1 : 0);
super.flush();
}
Aggregations