Search in sources :

Example 6 with INoteRepeat

use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.

the class DrumView method getButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getButtonColor(final ButtonID buttonID) {
    final int ordinal = buttonID.ordinal();
    if (ordinal < ButtonID.SCENE1.ordinal() || ordinal > ButtonID.SCENE8.ordinal())
        return 0;
    final int scene = ordinal - ButtonID.SCENE1.ordinal();
    if (ButtonID.isSceneButton(buttonID)) {
        final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
        if (this.noteRepeatPeriodOn) {
            final int periodIndex = Resolution.getMatch(noteRepeat.getPeriod());
            return buttonID == ButtonID.get(ButtonID.SCENE1, 7 - periodIndex) ? LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_LO;
        }
        if (this.noteRepeatLengthOn) {
            final int lengthIndex = Resolution.getMatch(noteRepeat.getNoteLength());
            return buttonID == ButtonID.get(ButtonID.SCENE1, 7 - lengthIndex) ? LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_LO;
        }
    }
    if (!this.isActive())
        return LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK;
    return scene == 7 - this.selectedResolutionIndex ? LaunchpadColorManager.LAUNCHPAD_COLOR_YELLOW : LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN;
}
Also used : INoteRepeat(de.mossgrabers.framework.daw.midi.INoteRepeat)

Example 7 with INoteRepeat

use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.

the class DrumView method drawPages.

/**
 * {@inheritDoc}
 */
@Override
protected void drawPages(final INoteClip clip, final boolean isActive) {
    super.drawPages(clip, isActive);
    // Draw the extra buttons
    final IPadGrid padGrid = this.surface.getPadGrid();
    if (this.extraButtonsOn) {
        padGrid.lightEx(4, 6, this.isSelectTrigger() ? LaunchpadColorManager.LAUNCHPAD_COLOR_WHITE : LaunchpadColorManager.LAUNCHPAD_COLOR_GREY_LO);
        padGrid.lightEx(5, 6, this.isMuteTrigger() ? LaunchpadColorManager.LAUNCHPAD_COLOR_YELLOW_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_YELLOW_LO);
        padGrid.lightEx(6, 6, this.isSoloTrigger() ? LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE_LO);
        padGrid.lightEx(7, 6, this.isBrowseTrigger() ? LaunchpadColorManager.LAUNCHPAD_COLOR_CYAN_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_CYAN_LO);
        final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
        padGrid.lightEx(4, 7, noteRepeat.isActive() ? LaunchpadColorManager.LAUNCHPAD_COLOR_ORCHID_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_ORCHID_LO);
        padGrid.lightEx(5, 7, this.noteRepeatPeriodOn ? LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_SKY_LO);
        padGrid.lightEx(6, 7, this.noteRepeatLengthOn ? LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_PINK_LO);
    }
    padGrid.lightEx(7, 7, this.extraButtonsOn ? LaunchpadColorManager.LAUNCHPAD_COLOR_RED_HI : LaunchpadColorManager.LAUNCHPAD_COLOR_RED_LO);
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) INoteRepeat(de.mossgrabers.framework.daw.midi.INoteRepeat)

Example 8 with INoteRepeat

use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.

the class TouchstripCommand method updateValue.

/**
 * {@inheritDoc}
 */
@Override
public void updateValue() {
    if (this.surface.getViewManager().isActive(Views.SESSION)) {
        this.surface.setRibbonValue(this.model.getValueChanger().toMidiValue(this.model.getTransport().getCrossfade()));
        return;
    }
    final PushConfiguration config = this.surface.getConfiguration();
    // Check if Note Repeat is active and its settings should be changed
    final int ribbonNoteRepeat = config.getRibbonNoteRepeat();
    if (config.isNoteRepeatActive() && ribbonNoteRepeat > PushConfiguration.NOTE_REPEAT_OFF) {
        final Resolution[] values = Resolution.values();
        final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
        final double value = ribbonNoteRepeat == PushConfiguration.NOTE_REPEAT_PERIOD ? noteRepeat.getPeriod() : noteRepeat.getNoteLength();
        final int index = Resolution.getMatch(value);
        this.surface.setRibbonValue(127 - (int) Math.round(index * 127.0 / (values.length - 1)));
        return;
    }
    switch(config.getRibbonMode()) {
        case PushConfiguration.RIBBON_MODE_CC:
            this.surface.setRibbonValue(this.pitchValue);
            break;
        case PushConfiguration.RIBBON_MODE_FADER:
            final ITrack t = this.model.getCursorTrack();
            this.surface.setRibbonValue(this.model.getValueChanger().toMidiValue(t.getVolume()));
            break;
        default:
            this.surface.setRibbonValue(64);
            break;
    }
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) INoteRepeat(de.mossgrabers.framework.daw.midi.INoteRepeat) ITrack(de.mossgrabers.framework.daw.data.ITrack) Resolution(de.mossgrabers.framework.daw.constants.Resolution)

Example 9 with INoteRepeat

use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.

the class MidiModule method parseNoteRepeat.

/**
 * Parse note repeat parameters.
 *
 * @param path The rest of the path
 * @param value The value
 * @throws MissingCommandException Could not find the sub-command
 * @throws UnknownCommandException Unknown sub-command
 * @throws IllegalParameterException Added an illegal parameter
 */
private void parseNoteRepeat(final LinkedList<String> path, final Object value) throws MissingCommandException, UnknownCommandException, IllegalParameterException {
    final INoteInput noteInput = this.surface.getMidiInput().getDefaultNoteInput();
    if (noteInput == null)
        return;
    final INoteRepeat noteRepeat = noteInput.getNoteRepeat();
    final String subCommand = getSubCommand(path);
    switch(subCommand) {
        case "isActive":
            noteRepeat.setActive(toInteger(value) > 0);
            break;
        case "period":
            if (value == null)
                throw new IllegalParameterException("Value must not be empty.");
            final Resolution period = Resolution.getByName(value.toString());
            if (period == null)
                throw new IllegalParameterException("Value must be one of {1/4, 1/4t, 1/8, 1/8t, 1/16, 1/16t, 1/32, 1/32t}.");
            noteRepeat.setPeriod(period.getValue());
            break;
        case "length":
            if (value == null)
                throw new IllegalParameterException("Value must not be empty.");
            final Resolution length = Resolution.getByName(value.toString());
            if (length == null)
                throw new IllegalParameterException("Value must be one of {1/4, 1/4t, 1/8, 1/8t, 1/16, 1/16t, 1/32, 1/32t}.");
            noteRepeat.setNoteLength(length.getValue());
            break;
        default:
            throw new UnknownCommandException(subCommand);
    }
}
Also used : INoteRepeat(de.mossgrabers.framework.daw.midi.INoteRepeat) UnknownCommandException(de.mossgrabers.controller.osc.exception.UnknownCommandException) IllegalParameterException(de.mossgrabers.controller.osc.exception.IllegalParameterException) INoteInput(de.mossgrabers.framework.daw.midi.INoteInput) Resolution(de.mossgrabers.framework.daw.constants.Resolution)

Example 10 with INoteRepeat

use of de.mossgrabers.framework.daw.midi.INoteRepeat in project DrivenByMoss by git-moss.

the class NoteRepeatSceneHelper method getButtonColorID.

/**
 * Get the color ID for a scene button, which is controlled by the view.
 *
 * @param surface The surface
 * @param buttonID The ID of the button
 * @return A color ID
 */
public static String getButtonColorID(final PushControlSurface surface, final ButtonID buttonID) {
    final INoteRepeat noteRepeat = surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
    final int sceneIndex = 7 - (buttonID.ordinal() - ButtonID.SCENE1.ordinal());
    if (surface.isShiftPressed())
        return Resolution.getMatch(noteRepeat.getNoteLength()) == sceneIndex ? PushColorManager.NOTE_REPEAT_LENGTH_HI : PushColorManager.NOTE_REPEAT_LENGTH_OFF;
    return Resolution.getMatch(noteRepeat.getPeriod()) == sceneIndex ? PushColorManager.NOTE_REPEAT_PERIOD_HI : PushColorManager.NOTE_REPEAT_PERIOD_OFF;
}
Also used : INoteRepeat(de.mossgrabers.framework.daw.midi.INoteRepeat)

Aggregations

INoteRepeat (de.mossgrabers.framework.daw.midi.INoteRepeat)14 Resolution (de.mossgrabers.framework.daw.constants.Resolution)5 INoteInput (de.mossgrabers.framework.daw.midi.INoteInput)4 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)3 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)2 RibbonMode (de.mossgrabers.controller.ni.maschine.core.RibbonMode)2 ITrack (de.mossgrabers.framework.daw.data.ITrack)2 GenericFlexiConfiguration (de.mossgrabers.controller.generic.GenericFlexiConfiguration)1 MaschineConfiguration (de.mossgrabers.controller.ni.maschine.mk3.MaschineConfiguration)1 LaunchpadConfiguration (de.mossgrabers.controller.novation.launchpad.LaunchpadConfiguration)1 IllegalParameterException (de.mossgrabers.controller.osc.exception.IllegalParameterException)1 UnknownCommandException (de.mossgrabers.controller.osc.exception.UnknownCommandException)1 IHost (de.mossgrabers.framework.daw.IHost)1 ITransport (de.mossgrabers.framework.daw.ITransport)1 ArpeggiatorMode (de.mossgrabers.framework.daw.midi.ArpeggiatorMode)1