use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class ModeMultiSelectCommand method executeNormal.
/**
* {@inheritDoc}
*/
@Override
public void executeNormal(final ButtonEvent event) {
if (event != ButtonEvent.UP)
return;
final Modes activeModeId = this.modeManager.getActiveID();
Modes newMode = this.currentModeID;
// If coming from a mode not on the list, activate the last one
if (this.currentModeID.equals(activeModeId)) {
final ITrackBank trackBank = this.model.getTrackBank();
int index = this.modeIds.indexOf(activeModeId);
// If a send mode is selected check if the according send exists
do {
index++;
if (index < 0 || index >= this.modeIds.size())
index = 0;
newMode = this.modeIds.get(index);
} while (Modes.isSendMode(newMode) && !trackBank.canEditSend(newMode.ordinal() - Modes.SEND1.ordinal()));
}
this.activateMode(newMode);
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class AddTrackCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.DOWN)
return;
ITrackBank tb = this.model.getTrackBank();
final IApplication application = this.model.getApplication();
if (this.combi1 != null && this.surface.isPressed(this.combi1)) {
application.addEffectTrack();
tb = this.model.getEffectTrackBank();
if (tb == null)
return;
} else if (this.combi2 != null && this.surface.isPressed(this.combi2))
this.model.getTrackBank().addChannel(ChannelType.AUDIO);
else
this.model.getTrackBank().addChannel(ChannelType.INSTRUMENT);
final ITrackBank bank = tb;
this.surface.scheduleTask(() -> {
final int pos = bank.getItemCount() - 1;
if (pos < 0) {
this.surface.errorln("Warning: No track created.");
return;
}
bank.scrollTo(pos);
bank.getItem(pos % bank.getPageSize()).select();
}, 200);
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class SelectCommand method executeNormal.
/**
* {@inheritDoc}
*/
@Override
public void executeNormal(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ITrackBank currentTrackBank = this.model.getCurrentTrackBank();
final ITrack track = currentTrackBank.getItem(this.index);
if (track != null)
track.select();
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class AbstractTrackMode method onFirstRow.
/**
* {@inheritDoc}
*/
@Override
public void onFirstRow(final int index, final ButtonEvent event) {
if (event == ButtonEvent.DOWN)
return;
final ITrackBank tb = this.model.getCurrentTrackBank();
final ITrack track = tb.getItem(index);
if (event == ButtonEvent.UP) {
if (this.surface.isPressed(ButtonID.DUPLICATE)) {
this.surface.setTriggerConsumed(ButtonID.DUPLICATE);
track.duplicate();
return;
}
if (this.surface.isPressed(ButtonID.DELETE)) {
this.surface.setTriggerConsumed(ButtonID.DELETE);
track.remove();
return;
}
if (this.surface.isPressed(ButtonID.STOP_CLIP)) {
this.surface.setTriggerConsumed(ButtonID.STOP_CLIP);
track.stop();
return;
}
if (this.surface.isPressed(ButtonID.RECORD)) {
this.surface.setTriggerConsumed(ButtonID.RECORD);
track.toggleRecArm();
return;
}
if (!track.isSelected()) {
track.select();
return;
}
// mode
if (track.isGroup()) {
if (this.surface.isShiftPressed())
track.toggleGroupExpanded();
else
track.enter();
} else
this.surface.getButton(ButtonID.DEVICE).trigger(ButtonEvent.DOWN);
return;
}
// LONG press, go out of group
if (!this.model.isEffectTrackBankActive()) {
this.model.getTrackBank().selectParent();
this.surface.setTriggerConsumed(ButtonID.get(ButtonID.ROW1_1, index));
}
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class AbstractTrackMode method updateChannelDisplay.
// Push 2
// Called from sub-classes
protected void updateChannelDisplay(final IGraphicDisplay display, final int selectedMenu, final boolean isVolume, final boolean isPan) {
this.updateMenuItems(selectedMenu);
final IValueChanger valueChanger = this.model.getValueChanger();
final ITrackBank tb = this.model.getCurrentTrackBank();
final PushConfiguration config = this.surface.getConfiguration();
final ICursorTrack cursorTrack = this.model.getCursorTrack();
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getItem(i);
final Pair<String, Boolean> pair = this.menu.get(i);
final String topMenu = pair.getKey();
final boolean isTopMenuOn = pair.getValue().booleanValue();
final int crossfadeMode = this.getCrossfadeModeAsNumber(t);
final boolean enableVUMeters = config.isEnableVUMeters();
final int vuR = valueChanger.toDisplayValue(enableVUMeters ? t.getVuRight() : 0);
final int vuL = valueChanger.toDisplayValue(enableVUMeters ? t.getVuLeft() : 0);
display.addChannelElement(selectedMenu, topMenu, isTopMenuOn, t.doesExist() ? t.getName(12) : "", this.updateType(t), t.getColor(), t.isSelected(), valueChanger.toDisplayValue(t.getVolume()), valueChanger.toDisplayValue(t.getModulatedVolume()), isVolume && this.isKnobTouched[i] ? t.getVolumeStr(8) : "", valueChanger.toDisplayValue(t.getPan()), valueChanger.toDisplayValue(t.getModulatedPan()), isPan && this.isKnobTouched[i] ? t.getPanStr(8) : "", vuL, vuR, t.isMute(), t.isSolo(), t.isRecArm(), t.isActivated(), crossfadeMode, t.isSelected() && cursorTrack.isPinned());
}
}
Aggregations