use of de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException in project DrivenByMoss by git-moss.
the class DeviceHandler method handle.
/**
* {@inheritDoc}
*/
@Override
public void handle(final FlexiCommand command, final KnobMode knobMode, final MidiValue value) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final boolean isButtonPressed = this.isButtonPressed(knobMode, value);
switch(command) {
// Device: Toggle Window
case DEVICE_TOGGLE_WINDOW:
if (isButtonPressed)
cursorDevice.toggleWindowOpen();
break;
// Device: Bypass
case DEVICE_TOGGLE_BYPASS:
if (isButtonPressed)
cursorDevice.toggleEnabledState();
break;
// Device: Toggle Pinned
case DEVICE_TOGGLE_PIN:
if (isButtonPressed)
cursorDevice.togglePinned();
break;
// Device: Expand
case DEVICE_TOGGLE_EXPAND:
if (isButtonPressed)
cursorDevice.toggleExpanded();
break;
// Device: Parameters
case DEVICE_TOGGLE_PARAMETERS:
if (isButtonPressed)
cursorDevice.toggleParameterPageSectionVisible();
break;
// Device: Select Previous
case DEVICE_SELECT_PREVIOUS:
if (isButtonPressed)
cursorDevice.selectPrevious();
break;
// Device: Select Next
case DEVICE_SELECT_NEXT:
if (isButtonPressed)
cursorDevice.selectNext();
break;
case DEVICE_SCROLL_DEVICES:
this.scrollDevice(knobMode, value);
break;
case DEVICE_SELECT_PREVIOUS_PARAMETER_PAGE:
if (isButtonPressed)
cursorDevice.getParameterBank().scrollBackwards();
break;
case DEVICE_SELECT_NEXT_PARAMETER_PAGE:
if (isButtonPressed)
cursorDevice.getParameterBank().scrollForwards();
break;
case DEVICE_SELECT_PARAMETER_PAGE_1:
case DEVICE_SELECT_PARAMETER_PAGE_2:
case DEVICE_SELECT_PARAMETER_PAGE_3:
case DEVICE_SELECT_PARAMETER_PAGE_4:
case DEVICE_SELECT_PARAMETER_PAGE_5:
case DEVICE_SELECT_PARAMETER_PAGE_6:
case DEVICE_SELECT_PARAMETER_PAGE_7:
case DEVICE_SELECT_PARAMETER_PAGE_8:
if (isButtonPressed) {
cursorDevice.getParameterPageBank().selectPage(command.ordinal() - FlexiCommand.DEVICE_SELECT_PARAMETER_PAGE_1.ordinal());
this.mvHelper.notifySelectedDeviceAndParameterPage();
}
break;
case DEVICE_SCROLL_PARAMETER_PAGES:
this.scrollParameterPage(knobMode, value);
break;
// Device: Select Previous Parameter Bank
case DEVICE_SELECT_PREVIOUS_PARAMETER_BANK:
if (isButtonPressed)
cursorDevice.getParameterBank().selectPreviousPage();
break;
// Device: Select Next Parameter Bank
case DEVICE_SELECT_NEXT_PARAMETER_BANK:
if (isButtonPressed)
cursorDevice.getParameterBank().selectNextPage();
break;
case DEVICE_SCROLL_PARAMETER_BANKS:
this.scrollParameterBank(knobMode, value);
break;
// Device: Set Parameter 1-8
case DEVICE_SET_PARAMETER_1:
case DEVICE_SET_PARAMETER_2:
case DEVICE_SET_PARAMETER_3:
case DEVICE_SET_PARAMETER_4:
case DEVICE_SET_PARAMETER_5:
case DEVICE_SET_PARAMETER_6:
case DEVICE_SET_PARAMETER_7:
case DEVICE_SET_PARAMETER_8:
this.handleParameter(knobMode, command.ordinal() - FlexiCommand.DEVICE_SET_PARAMETER_1.ordinal(), value);
break;
default:
throw new FlexiHandlerException(command);
}
}
use of de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException 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.controller.generic.flexihandler.utils.FlexiHandlerException in project DrivenByMoss by git-moss.
the class EqHandler method handle.
/**
* {@inheritDoc}
*/
@Override
public void handle(final FlexiCommand command, final KnobMode knobMode, final MidiValue value) {
final IEqualizerDevice equalizer = (IEqualizerDevice) this.model.getSpecificDevice(DeviceID.EQ);
if (!equalizer.doesExist()) {
final ITrack cursorTrack = this.model.getCursorTrack();
if (cursorTrack.doesExist() && !this.eqRequested) {
cursorTrack.addEqualizerDevice();
this.eqRequested = true;
}
return;
}
this.eqRequested = false;
switch(command) {
case EQ_SET_TYPE_1:
case EQ_SET_TYPE_2:
case EQ_SET_TYPE_3:
case EQ_SET_TYPE_4:
case EQ_SET_TYPE_5:
case EQ_SET_TYPE_6:
case EQ_SET_TYPE_7:
case EQ_SET_TYPE_8:
final int bandIndex1 = command.ordinal() - FlexiCommand.EQ_SET_TYPE_1.ordinal();
final IParameter type = equalizer.getType(bandIndex1);
this.handleParameter(knobMode, type, value);
return;
case EQ_SET_FREQ_1:
case EQ_SET_FREQ_2:
case EQ_SET_FREQ_3:
case EQ_SET_FREQ_4:
case EQ_SET_FREQ_5:
case EQ_SET_FREQ_6:
case EQ_SET_FREQ_7:
case EQ_SET_FREQ_8:
final int bandIndex2 = command.ordinal() - FlexiCommand.EQ_SET_FREQ_1.ordinal();
ensureBandIsOn(equalizer, bandIndex2);
final IParameter frequency = equalizer.getFrequency(bandIndex2);
this.handleParameter(knobMode, frequency, value);
return;
case EQ_SET_GAIN_1:
case EQ_SET_GAIN_2:
case EQ_SET_GAIN_3:
case EQ_SET_GAIN_4:
case EQ_SET_GAIN_5:
case EQ_SET_GAIN_6:
case EQ_SET_GAIN_7:
case EQ_SET_GAIN_8:
final int bandIndex3 = command.ordinal() - FlexiCommand.EQ_SET_GAIN_1.ordinal();
ensureBandIsOn(equalizer, bandIndex3);
final IParameter gain = equalizer.getGain(bandIndex3);
this.handleParameter(knobMode, gain, value);
return;
case EQ_SET_Q_1:
case EQ_SET_Q_2:
case EQ_SET_Q_3:
case EQ_SET_Q_4:
case EQ_SET_Q_5:
case EQ_SET_Q_6:
case EQ_SET_Q_7:
case EQ_SET_Q_8:
final int bandIndex4 = command.ordinal() - FlexiCommand.EQ_SET_Q_1.ordinal();
ensureBandIsOn(equalizer, bandIndex4);
final IParameter q = equalizer.getQ(bandIndex4);
this.handleParameter(knobMode, q, value);
return;
default:
throw new FlexiHandlerException(command);
}
}
use of de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException in project DrivenByMoss by git-moss.
the class MarkerHandler method handle.
/**
* {@inheritDoc}
*/
@Override
public void handle(final FlexiCommand command, final KnobMode knobMode, final MidiValue value) {
if (!this.isButtonPressed(knobMode, value))
return;
final IMarkerBank markerBank = this.model.getMarkerBank();
switch(command) {
case MARKER_1_LAUNCH_MARKER:
case MARKER_2_LAUNCH_MARKER:
case MARKER_3_LAUNCH_MARKER:
case MARKER_4_LAUNCH_MARKER:
case MARKER_5_LAUNCH_MARKER:
case MARKER_6_LAUNCH_MARKER:
case MARKER_7_LAUNCH_MARKER:
case MARKER_8_LAUNCH_MARKER:
final int index = command.ordinal() - FlexiCommand.MARKER_1_LAUNCH_MARKER.ordinal();
markerBank.getItem(index).launch(true);
break;
case MARKER_SELECT_PREVIOUS_BANK:
markerBank.selectPreviousPage();
break;
case MARKER_SELECT_NEXT_BANK:
markerBank.selectNextPage();
break;
default:
throw new FlexiHandlerException(command);
}
}
use of de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException in project DrivenByMoss by git-moss.
the class UserHandler method handle.
/**
* {@inheritDoc}
*/
@Override
public void handle(final FlexiCommand command, final KnobMode knobMode, final MidiValue value) {
final IParameterBank userParameterBank = this.model.getUserParameterBank();
if (userParameterBank == null)
return;
switch(command) {
case USER_SET_PARAMETER_1:
case USER_SET_PARAMETER_2:
case USER_SET_PARAMETER_3:
case USER_SET_PARAMETER_4:
case USER_SET_PARAMETER_5:
case USER_SET_PARAMETER_6:
case USER_SET_PARAMETER_7:
case USER_SET_PARAMETER_8:
final int index = command.ordinal() - FlexiCommand.USER_SET_PARAMETER_1.ordinal();
final IParameter userParam = userParameterBank.getItem(index);
final int val = value.getValue();
if (isAbsolute(knobMode))
userParam.setValue(this.getAbsoluteValueChanger(value), val);
else
userParam.changeValue(this.getRelativeValueChanger(knobMode), val);
break;
case USER_TOGGLE_PARAMETER_1:
case USER_TOGGLE_PARAMETER_2:
case USER_TOGGLE_PARAMETER_3:
case USER_TOGGLE_PARAMETER_4:
case USER_TOGGLE_PARAMETER_5:
case USER_TOGGLE_PARAMETER_6:
case USER_TOGGLE_PARAMETER_7:
case USER_TOGGLE_PARAMETER_8:
final IParameter userToggleParam = userParameterBank.getItem(command.ordinal() - FlexiCommand.USER_TOGGLE_PARAMETER_1.ordinal());
if (this.isButtonPressed(knobMode, value)) {
final int v = userToggleParam.getValue();
userToggleParam.setValue(v > 0 ? 0 : this.model.getValueChanger().getUpperBound() - 1);
}
break;
case USER_SELECT_PREVIOUS_PAGE:
userParameterBank.scrollBackwards();
this.displaySelectedPage(userParameterBank);
break;
case USER_SELECT_NEXT_PAGE:
userParameterBank.scrollForwards();
this.displaySelectedPage(userParameterBank);
break;
default:
throw new FlexiHandlerException(command);
}
}
Aggregations