Search in sources :

Example 1 with IMarkerBank

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);
    }
}
Also used : IMarkerBank(de.mossgrabers.framework.daw.data.bank.IMarkerBank) ColorEx(de.mossgrabers.framework.controller.color.ColorEx) IMarker(de.mossgrabers.framework.daw.data.IMarker)

Example 2 with IMarkerBank

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);
    }
}
Also used : FlexiHandlerException(de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException) IMarkerBank(de.mossgrabers.framework.daw.data.bank.IMarkerBank)

Example 3 with IMarkerBank

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();
}
Also used : IMarkerBank(de.mossgrabers.framework.daw.data.bank.IMarkerBank) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay) IMarker(de.mossgrabers.framework.daw.data.IMarker)

Example 4 with IMarkerBank

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);
    }
}
Also used : IMarkerBank(de.mossgrabers.framework.daw.data.bank.IMarkerBank)

Example 5 with IMarkerBank

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);
    }
}
Also used : IMarkerBank(de.mossgrabers.framework.daw.data.bank.IMarkerBank) UnknownCommandException(de.mossgrabers.controller.osc.exception.UnknownCommandException)

Aggregations

IMarkerBank (de.mossgrabers.framework.daw.data.bank.IMarkerBank)5 IMarker (de.mossgrabers.framework.daw.data.IMarker)2 FlexiHandlerException (de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException)1 UnknownCommandException (de.mossgrabers.controller.osc.exception.UnknownCommandException)1 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)1 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)1