use of de.mossgrabers.controller.osc.exception.UnknownCommandException in project DrivenByMoss by git-moss.
the class ClipModule method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final String command, final LinkedList<String> path, final Object value) throws IllegalParameterException, UnknownCommandException, MissingCommandException {
if (!"clip".equals(command))
throw new UnknownCommandException(command);
final String subCommand = getSubCommand(path);
if ("stopall".equals(subCommand)) {
this.model.getTrackBank().stop();
return;
}
// Cursor clip related commands
final INoteClip cursorClip = this.model.getCursorClip();
switch(subCommand) {
case "pinned":
if (value == null)
cursorClip.togglePinned();
else
cursorClip.setPinned(isTrigger(value));
return;
case "quantize":
if (cursorClip.doesExist())
cursorClip.quantize(1);
return;
default:
// Fall through
break;
}
// Slot bank related commands
final ICursorTrack cursorTrack = this.model.getCursorTrack();
if (!cursorTrack.doesExist())
return;
if ("stop".equals(subCommand)) {
cursorTrack.stop();
return;
}
final ISlotBank slotBank = cursorTrack.getSlotBank();
switch(subCommand) {
case "+":
slotBank.selectNextItem();
return;
case "-":
slotBank.selectPreviousItem();
return;
default:
// Fall through
break;
}
final Optional<ISlot> selectedSlotOptional = slotBank.getSelectedItem();
if (selectedSlotOptional.isEmpty())
return;
final ISlot selectedSlot = selectedSlotOptional.get();
switch(subCommand) {
case "launch":
selectedSlot.launch();
return;
case "record":
this.model.recordNoteClip(cursorTrack, selectedSlot);
return;
case "create":
this.model.createNoteClip(cursorTrack, selectedSlot, toInteger(value), true);
return;
default:
throw new UnknownCommandException(command);
}
}
use of de.mossgrabers.controller.osc.exception.UnknownCommandException in project DrivenByMoss by git-moss.
the class MarkerModule method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final String command, final LinkedList<String> path, final Object value) throws IllegalParameterException, UnknownCommandException, MissingCommandException {
if (!"marker".equals(command))
throw new UnknownCommandException(command);
final String subCommand = getSubCommand(path);
try {
final int markerNo = Integer.parseInt(subCommand) - 1;
final String subCommand2 = getSubCommand(path);
if ("launch".equals(subCommand2))
this.model.getMarkerBank().getItem(markerNo).launch(true);
else
throw new UnknownCommandException(subCommand2);
} catch (final NumberFormatException ex) {
final IMarkerBank markerBank = this.model.getMarkerBank();
if ("bank".equals(subCommand)) {
final String subCommand2 = getSubCommand(path);
switch(subCommand2) {
case "+":
markerBank.selectNextPage();
break;
case "-":
markerBank.selectPreviousPage();
break;
default:
throw new UnknownCommandException(subCommand2);
}
} else
throw new UnknownCommandException(subCommand);
}
}
Aggregations