use of de.mossgrabers.framework.daw.data.bank.IMarkerBank in project DrivenByMoss by git-moss.
the class MarkerModule method flush.
/**
* {@inheritDoc}
*/
@Override
public void flush(final boolean dump) {
final IMarkerBank markerBank = this.model.getMarkerBank();
for (int i = 0; i < markerBank.getPageSize(); i++) {
final String markerAddress = "/marker/" + (i + 1) + "/";
final IMarker marker = markerBank.getItem(i);
this.writer.sendOSC(markerAddress + "exists", marker.doesExist(), dump);
this.writer.sendOSC(markerAddress + TAG_NAME, marker.getName(), dump);
final ColorEx color = marker.getColor();
this.writer.sendOSCColor(markerAddress + "color", color.getRed(), color.getGreen(), color.getBlue(), dump);
}
}
use of de.mossgrabers.framework.daw.data.bank.IMarkerBank 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.framework.daw.data.bank.IMarkerBank in project DrivenByMoss by git-moss.
the class MarkerMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final ITextDisplay d = this.surface.getTextDisplay().clear();
final IMarkerBank markerBank = this.model.getMarkerBank();
final int extenderOffset = this.surface.getExtenderOffset();
for (int i = 0; i < 8; i++) {
final IMarker marker = markerBank.getItem(extenderOffset + i);
if (!marker.doesExist())
continue;
final String name = StringUtils.shortenAndFixASCII(marker.getName(), 6);
d.setCell(0, i, name);
}
d.allDone();
}
use of de.mossgrabers.framework.daw.data.bank.IMarkerBank in project DrivenByMoss by git-moss.
the class MarkerMode method updateKnobLEDs.
/**
* {@inheritDoc}
*/
@Override
public void updateKnobLEDs() {
final int extenderOffset = this.surface.getExtenderOffset();
final IMarkerBank markerBank = this.model.getMarkerBank();
for (int i = 0; i < 8; i++) {
final boolean exists = markerBank.getItem(extenderOffset + i).doesExist();
this.surface.setKnobLED(i, MCUControlSurface.KNOB_LED_MODE_WRAP, 0, exists ? 1 : 0);
}
}
use of de.mossgrabers.framework.daw.data.bank.IMarkerBank 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