use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class SendModeCommand method handleExecute.
private void handleExecute(final ButtonEvent event, final int index) {
// No Sends on FX tracks
if (event != ButtonEvent.DOWN || this.model.isEffectTrackBankActive())
return;
final ModeManager modeManager = this.surface.getModeManager();
modeManager.setActive(Modes.get(Modes.SEND1, index));
String modeName = "Send " + (index + 1) + ": ";
final ITrackBank trackBank = this.model.getTrackBank();
Optional<ITrack> selectedTrack = trackBank.getSelectedItem();
if (selectedTrack.isEmpty()) {
final ITrack item = trackBank.getItem(0);
selectedTrack = item.doesExist() ? Optional.of(item) : Optional.empty();
}
if (selectedTrack.isPresent())
modeName += selectedTrack.get().getSendBank().getItem(index).getName();
else
modeName += "-";
this.model.getHost().showNotification(modeName);
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class Kontrol1ControllerSetup method createObservers.
/**
* {@inheritDoc}
*/
@Override
protected void createObservers() {
super.createObservers();
this.createScaleObservers(this.configuration);
this.configuration.addSettingObserver(Kontrol1Configuration.SCALE_IS_ACTIVE, this::updateViewNoteMapping);
final ITrackBank trackBank = this.model.getTrackBank();
trackBank.addSelectionObserver((index, isSelected) -> this.handleTrackChange(isSelected));
final ITrackBank effectTrackBank = this.model.getEffectTrackBank();
if (effectTrackBank != null)
effectTrackBank.addSelectionObserver((index, isSelected) -> this.handleTrackChange(isSelected));
this.configuration.registerDeactivatedItemsHandler(this.model);
this.activateBrowserObserver(Modes.BROWSER);
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class BaseMode method getButtonColor.
/**
* {@inheritDoc}
*/
@Override
public int getButtonColor(final ButtonID buttonID) {
final ITrackBank tb = this.getTrackBank();
final int extenderOffset = this.getExtenderOffset();
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getItem(extenderOffset + i);
final boolean exists = track.doesExist();
if (buttonID == ButtonID.get(ButtonID.ROW_SELECT_1, i))
return exists && track.isSelected() ? MCUControllerSetup.MCU_BUTTON_STATE_ON : MCUControllerSetup.MCU_BUTTON_STATE_OFF;
if (buttonID == ButtonID.get(ButtonID.ROW2_1, i))
return exists && track.isRecArm() ? MCUControllerSetup.MCU_BUTTON_STATE_ON : MCUControllerSetup.MCU_BUTTON_STATE_OFF;
if (buttonID == ButtonID.get(ButtonID.ROW3_1, i))
return exists && track.isSolo() ? MCUControllerSetup.MCU_BUTTON_STATE_ON : MCUControllerSetup.MCU_BUTTON_STATE_OFF;
if (buttonID == ButtonID.get(ButtonID.ROW4_1, i))
return exists && track.isMute() ? MCUControllerSetup.MCU_BUTTON_STATE_ON : MCUControllerSetup.MCU_BUTTON_STATE_OFF;
}
return MCUControllerSetup.MCU_BUTTON_STATE_OFF;
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class VolumeMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final Kontrol1Display d = (Kontrol1Display) this.surface.getDisplay();
d.clear();
d.setCell(0, 0, this.model.isEffectTrackBankActive() ? "VOL-FX" : "VOLUME").setCell(1, 0, this.formatPageRange("%d - %d"));
final ITrackBank tb = this.model.getCurrentTrackBank();
final Optional<ITrack> selTrack = tb.getSelectedItem();
final int selIndex = selTrack.isEmpty() ? -1 : selTrack.get().getIndex();
for (int i = 0; i < 8; i++) {
final boolean isSel = i == selIndex;
final ITrack t = tb.getItem(i);
final String n = StringUtils.shortenAndFixASCII(t.getName(), isSel ? 7 : 8).toUpperCase(Locale.US);
d.setCell(0, 1 + i, isSel ? ">" + n : n).setCell(1, 1 + i, getSecondLineText(t));
d.setBar(1 + i, this.surface.getContinuous(ContinuousID.get(ContinuousID.KNOB1, i)).isTouched() && t.doesExist(), t.getVolume());
}
d.allDone();
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class TrackMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final ITrackBank currentTrackBank = this.model.getCurrentTrackBank();
final Optional<ITrack> t = currentTrackBank.getSelectedItem();
final Kontrol1Display d = (Kontrol1Display) this.surface.getDisplay();
d.clear();
if (t.isEmpty()) {
d.setCell(0, 3, " PLEASE").setCell(0, 4, "SELECT A").setCell(0, 5, "TRACK").allDone();
return;
}
final boolean isEffectTrackBankActive = this.model.isEffectTrackBankActive();
final ITrack track = t.get();
d.setCell(0, 0, (isEffectTrackBankActive ? "TR-FX " : "TRACK ") + (track.getPosition() + 1)).setCell(1, 0, StringUtils.shortenAndFixASCII(track.getName(), 8).toUpperCase(Locale.US));
d.setCell(0, 1, "VOLUME").setCell(1, 1, getSecondLineText(track)).setCell(0, 2, "PAN").setCell(1, 2, track.getPanStr(8));
d.setBar(1, this.surface.getContinuous(ContinuousID.KNOB1).isTouched(), track.getVolume());
d.setPanBar(2, this.surface.getContinuous(ContinuousID.KNOB2).isTouched(), track.getPan());
if (!isEffectTrackBankActive) {
final ISendBank sendBank = track.getSendBank();
for (int i = 0; i < 6; i++) {
final int pos = 3 + i;
final ISend sendData = sendBank.getItem(i);
d.setCell(0, pos, StringUtils.shortenAndFixASCII(sendData.getName(8), 8).toUpperCase(Locale.US)).setCell(1, pos, sendData.getDisplayedValue(8));
d.setBar(pos, this.surface.getContinuous(ContinuousID.get(ContinuousID.KNOB3, i)).isTouched() && sendData.doesExist(), sendData.getValue());
}
}
d.allDone();
}
Aggregations