use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class GenericFlexiControllerSetup method updateIndication.
protected void updateIndication() {
final Set<FlexiCommand> commands = this.configuration.getMappedCommands();
final FlexiCommand[] allCommands = FlexiCommand.values();
final ITrackBank trackBank = this.model.getTrackBank();
final Optional<ITrack> selectedTrack = trackBank.getSelectedItem();
for (int i = 0; i < trackBank.getPageSize(); i++) {
final boolean hasTrackSel = selectedTrack.isPresent() && selectedTrack.get().getIndex() == i;
final ITrack track = trackBank.getItem(i);
track.setVolumeIndication(this.testVolumeIndication(commands, allCommands, i, hasTrackSel));
track.setPanIndication(this.testPanIndication(commands, allCommands, i, hasTrackSel));
final ISendBank sendBank = track.getSendBank();
final int sendPageSize = sendBank.getPageSize();
for (int j = 0; j < sendPageSize; j++) sendBank.getItem(j).setIndication(this.testSendIndication(commands, allCommands, i, hasTrackSel, sendPageSize, j));
}
final IMasterTrack masterTrack = this.model.getMasterTrack();
masterTrack.setVolumeIndication(commands.contains(FlexiCommand.MASTER_SET_VOLUME));
masterTrack.setPanIndication(commands.contains(FlexiCommand.MASTER_SET_PANORAMA));
final IParameterBank parameterBank = this.model.getCursorDevice().getParameterBank();
for (int i = 0; i < parameterBank.getPageSize(); i++) parameterBank.getItem(i).setIndication(this.testParameterIndication(commands, allCommands, i));
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class FxTrackHandler method handle.
/**
* {@inheritDoc}
*/
@Override
public void handle(final FlexiCommand command, final KnobMode knobMode, final MidiValue value) {
final ITrackBank effectTrackBank = this.model.getEffectTrackBank();
if (effectTrackBank == null)
return;
final boolean isButtonPressed = this.isButtonPressed(knobMode, value);
switch(command) {
// Track: Select Previous Bank Page
case FX_TRACK_SELECT_PREVIOUS_BANK_PAGE:
if (isButtonPressed)
this.scrollTrackLeft(true);
break;
// Track: Select Next Bank Page
case FX_TRACK_SELECT_NEXT_BANK_PAGE:
if (isButtonPressed)
this.scrollTrackRight(true);
break;
// Track: Select Previous Track
case FX_TRACK_SELECT_PREVIOUS_TRACK:
if (isButtonPressed)
this.scrollTrackLeft(false);
break;
// Track: Select Next Track
case FX_TRACK_SELECT_NEXT_TRACK:
if (isButtonPressed)
this.scrollTrackRight(false);
break;
case FX_TRACK_SCROLL_TRACKS:
this.scrollTrack(knobMode, value);
break;
// Track 1-8: Select
case FX_TRACK_1_SELECT:
case FX_TRACK_2_SELECT:
case FX_TRACK_3_SELECT:
case FX_TRACK_4_SELECT:
case FX_TRACK_5_SELECT:
case FX_TRACK_6_SELECT:
case FX_TRACK_7_SELECT:
case FX_TRACK_8_SELECT:
if (isButtonPressed) {
final ITrack track = effectTrackBank.getItem(command.ordinal() - FlexiCommand.FX_TRACK_1_SELECT.ordinal());
track.select();
this.mvHelper.notifySelectedTrack();
}
break;
// Track 1-8: Toggle Active
case FX_TRACK_1_TOGGLE_ACTIVE:
case FX_TRACK_2_TOGGLE_ACTIVE:
case FX_TRACK_3_TOGGLE_ACTIVE:
case FX_TRACK_4_TOGGLE_ACTIVE:
case FX_TRACK_5_TOGGLE_ACTIVE:
case FX_TRACK_6_TOGGLE_ACTIVE:
case FX_TRACK_7_TOGGLE_ACTIVE:
case FX_TRACK_8_TOGGLE_ACTIVE:
if (isButtonPressed)
effectTrackBank.getItem(command.ordinal() - FlexiCommand.FX_TRACK_1_TOGGLE_ACTIVE.ordinal()).toggleIsActivated();
break;
// Track 1-8: Set Active
case FX_TRACK_1_SET_ACTIVE:
case FX_TRACK_2_SET_ACTIVE:
case FX_TRACK_3_SET_ACTIVE:
case FX_TRACK_4_SET_ACTIVE:
case FX_TRACK_5_SET_ACTIVE:
case FX_TRACK_6_SET_ACTIVE:
case FX_TRACK_7_SET_ACTIVE:
case FX_TRACK_8_SET_ACTIVE:
if (isButtonPressed)
effectTrackBank.getItem(command.ordinal() - FlexiCommand.FX_TRACK_1_SET_ACTIVE.ordinal()).setIsActivated(value.isPositive());
break;
// Track 1-8: Set Volume
case FX_TRACK_1_SET_VOLUME:
case FX_TRACK_2_SET_VOLUME:
case FX_TRACK_3_SET_VOLUME:
case FX_TRACK_4_SET_VOLUME:
case FX_TRACK_5_SET_VOLUME:
case FX_TRACK_6_SET_VOLUME:
case FX_TRACK_7_SET_VOLUME:
case FX_TRACK_8_SET_VOLUME:
this.changeTrackVolume(knobMode, command.ordinal() - FlexiCommand.FX_TRACK_1_SET_VOLUME.ordinal(), value);
break;
// Track 1-8: Set Panorama
case FX_TRACK_1_SET_PANORAMA:
case FX_TRACK_2_SET_PANORAMA:
case FX_TRACK_3_SET_PANORAMA:
case FX_TRACK_4_SET_PANORAMA:
case FX_TRACK_5_SET_PANORAMA:
case FX_TRACK_6_SET_PANORAMA:
case FX_TRACK_7_SET_PANORAMA:
case FX_TRACK_8_SET_PANORAMA:
this.changeTrackPanorama(knobMode, command.ordinal() - FlexiCommand.FX_TRACK_1_SET_PANORAMA.ordinal(), value);
break;
// Track 1-8: Toggle Mute
case FX_TRACK_1_TOGGLE_MUTE:
case FX_TRACK_2_TOGGLE_MUTE:
case FX_TRACK_3_TOGGLE_MUTE:
case FX_TRACK_4_TOGGLE_MUTE:
case FX_TRACK_5_TOGGLE_MUTE:
case FX_TRACK_6_TOGGLE_MUTE:
case FX_TRACK_7_TOGGLE_MUTE:
case FX_TRACK_8_TOGGLE_MUTE:
if (isButtonPressed)
effectTrackBank.getItem(command.ordinal() - FlexiCommand.FX_TRACK_1_TOGGLE_MUTE.ordinal()).toggleMute();
break;
// Track 1-8: Set Mute
case FX_TRACK_1_SET_MUTE:
case FX_TRACK_2_SET_MUTE:
case FX_TRACK_3_SET_MUTE:
case FX_TRACK_4_SET_MUTE:
case FX_TRACK_5_SET_MUTE:
case FX_TRACK_6_SET_MUTE:
case FX_TRACK_7_SET_MUTE:
case FX_TRACK_8_SET_MUTE:
if (isButtonPressed)
effectTrackBank.getItem(command.ordinal() - FlexiCommand.FX_TRACK_1_SET_MUTE.ordinal()).setMute(value.isPositive());
break;
// Track 1-8: Toggle Solo
case FX_TRACK_1_TOGGLE_SOLO:
case FX_TRACK_2_TOGGLE_SOLO:
case FX_TRACK_3_TOGGLE_SOLO:
case FX_TRACK_4_TOGGLE_SOLO:
case FX_TRACK_5_TOGGLE_SOLO:
case FX_TRACK_6_TOGGLE_SOLO:
case FX_TRACK_7_TOGGLE_SOLO:
case FX_TRACK_8_TOGGLE_SOLO:
if (isButtonPressed)
effectTrackBank.getItem(command.ordinal() - FlexiCommand.FX_TRACK_1_TOGGLE_SOLO.ordinal()).toggleSolo();
break;
// Track 1-8: Set Solo
case FX_TRACK_1_SET_SOLO:
case FX_TRACK_2_SET_SOLO:
case FX_TRACK_3_SET_SOLO:
case FX_TRACK_4_SET_SOLO:
case FX_TRACK_5_SET_SOLO:
case FX_TRACK_6_SET_SOLO:
case FX_TRACK_7_SET_SOLO:
case FX_TRACK_8_SET_SOLO:
if (isButtonPressed)
effectTrackBank.getItem(command.ordinal() - FlexiCommand.FX_TRACK_1_SET_SOLO.ordinal()).setSolo(value.isPositive());
break;
// Track 1-8: Toggle Arm
case FX_TRACK_1_TOGGLE_ARM:
case FX_TRACK_2_TOGGLE_ARM:
case FX_TRACK_3_TOGGLE_ARM:
case FX_TRACK_4_TOGGLE_ARM:
case FX_TRACK_5_TOGGLE_ARM:
case FX_TRACK_6_TOGGLE_ARM:
case FX_TRACK_7_TOGGLE_ARM:
case FX_TRACK_8_TOGGLE_ARM:
if (isButtonPressed)
effectTrackBank.getItem(command.ordinal() - FlexiCommand.FX_TRACK_1_TOGGLE_ARM.ordinal()).toggleRecArm();
break;
// Track 1-8: Set Arm
case FX_TRACK_1_SET_ARM:
case FX_TRACK_2_SET_ARM:
case FX_TRACK_3_SET_ARM:
case FX_TRACK_4_SET_ARM:
case FX_TRACK_5_SET_ARM:
case FX_TRACK_6_SET_ARM:
case FX_TRACK_7_SET_ARM:
case FX_TRACK_8_SET_ARM:
if (isButtonPressed)
effectTrackBank.getItem(command.ordinal() - FlexiCommand.FX_TRACK_1_SET_ARM.ordinal()).setRecArm(value.isPositive());
break;
// Track 1-8: Toggle Monitor
case FX_TRACK_1_TOGGLE_MONITOR:
case FX_TRACK_2_TOGGLE_MONITOR:
case FX_TRACK_3_TOGGLE_MONITOR:
case FX_TRACK_4_TOGGLE_MONITOR:
case FX_TRACK_5_TOGGLE_MONITOR:
case FX_TRACK_6_TOGGLE_MONITOR:
case FX_TRACK_7_TOGGLE_MONITOR:
case FX_TRACK_8_TOGGLE_MONITOR:
if (isButtonPressed)
effectTrackBank.getItem(command.ordinal() - FlexiCommand.FX_TRACK_1_TOGGLE_MONITOR.ordinal()).toggleMonitor();
break;
// Track 1-8: Set Monitor
case FX_TRACK_1_SET_MONITOR:
case FX_TRACK_2_SET_MONITOR:
case FX_TRACK_3_SET_MONITOR:
case FX_TRACK_4_SET_MONITOR:
case FX_TRACK_5_SET_MONITOR:
case FX_TRACK_6_SET_MONITOR:
case FX_TRACK_7_SET_MONITOR:
case FX_TRACK_8_SET_MONITOR:
if (isButtonPressed)
effectTrackBank.getItem(command.ordinal() - FlexiCommand.FX_TRACK_1_SET_MONITOR.ordinal()).setMonitor(value.isPositive());
break;
// Track 1: Toggle Auto Monitor
case FX_TRACK_1_TOGGLE_AUTO_MONITOR:
case FX_TRACK_2_TOGGLE_AUTO_MONITOR:
case FX_TRACK_3_TOGGLE_AUTO_MONITOR:
case FX_TRACK_4_TOGGLE_AUTO_MONITOR:
case FX_TRACK_5_TOGGLE_AUTO_MONITOR:
case FX_TRACK_6_TOGGLE_AUTO_MONITOR:
case FX_TRACK_7_TOGGLE_AUTO_MONITOR:
case FX_TRACK_8_TOGGLE_AUTO_MONITOR:
if (isButtonPressed)
effectTrackBank.getItem(command.ordinal() - FlexiCommand.FX_TRACK_1_TOGGLE_AUTO_MONITOR.ordinal()).toggleAutoMonitor();
break;
// Track 1: Set Auto Monitor
case FX_TRACK_1_SET_AUTO_MONITOR:
case FX_TRACK_2_SET_AUTO_MONITOR:
case FX_TRACK_3_SET_AUTO_MONITOR:
case FX_TRACK_4_SET_AUTO_MONITOR:
case FX_TRACK_5_SET_AUTO_MONITOR:
case FX_TRACK_6_SET_AUTO_MONITOR:
case FX_TRACK_7_SET_AUTO_MONITOR:
case FX_TRACK_8_SET_AUTO_MONITOR:
if (isButtonPressed)
effectTrackBank.getItem(command.ordinal() - FlexiCommand.FX_TRACK_1_SET_AUTO_MONITOR.ordinal()).setAutoMonitor(value.isPositive());
break;
default:
throw new FlexiHandlerException(command);
}
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class FxTrackHandler method scrollTrackLeft.
private void scrollTrackLeft(final boolean switchBank) {
final ITrackBank tb = this.model.getCurrentTrackBank();
final Optional<ITrack> sel = tb.getSelectedItem();
final int index = sel.isEmpty() ? 0 : sel.get().getIndex() - 1;
if (index == -1 || switchBank) {
tb.selectPreviousPage();
return;
}
tb.getItem(index).select();
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class FxTrackHandler method changeTrackVolume.
private void changeTrackVolume(final KnobMode knobMode, final int trackIndex, final MidiValue value) {
final Optional<ITrack> track = this.getTrack(trackIndex);
if (track.isEmpty())
return;
final int val = value.getValue();
final IParameter volumeParameter = track.get().getVolumeParameter();
if (isAbsolute(knobMode))
volumeParameter.setValue(this.getAbsoluteValueChanger(value), val);
else
volumeParameter.changeValue(this.getRelativeValueChanger(knobMode), val);
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class FxTrackHandler method scrollTrackRight.
private void scrollTrackRight(final boolean switchBank) {
final ITrackBank tb = this.model.getCurrentTrackBank();
final Optional<ITrack> sel = tb.getSelectedItem();
final int index = sel.isEmpty() ? 0 : sel.get().getIndex() + 1;
if (index == 8 || switchBank) {
tb.selectNextPage();
return;
}
tb.getItem(index).select();
}
Aggregations