Search in sources :

Example 1 with ArpeggiatorMode

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

the class Configuration method setPrevNextNoteRepeatMode.

/**
 * Select the next or previous note repeat mode.
 *
 * @param increase True to select the next otherwise the previous
 */
default void setPrevNextNoteRepeatMode(final boolean increase) {
    final ArpeggiatorMode arpMode = this.getNoteRepeatMode();
    final int modeIndex = this.lookupArpeggiatorModeIndex(arpMode);
    final List<ArpeggiatorMode> modes = this.getArpeggiatorModes();
    final int newIndex = Math.max(0, Math.min(modes.size() - 1, modeIndex + (increase ? 1 : -1)));
    this.setNoteRepeatMode(modes.get(newIndex));
}
Also used : ArpeggiatorMode(de.mossgrabers.framework.daw.midi.ArpeggiatorMode)

Example 2 with ArpeggiatorMode

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

the class NoteRepeatMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ITextDisplay d = this.surface.getTextDisplay().clear();
    final String[] names = Resolution.getNames();
    final int selPeriodIndex = this.getSelectedPeriodIndex();
    d.setBlock(0, 0, this.mark("Period", 0));
    d.setBlock(1, 0, names[selPeriodIndex >= 0 && selPeriodIndex < names.length ? selPeriodIndex : 0]);
    if (this.host.supports(Capability.NOTE_REPEAT_LENGTH)) {
        final int selLengthIndex = this.getSelectedNoteLengthIndex();
        d.setBlock(0, 1, this.mark("Length", 2));
        d.setBlock(1, 1, names[selLengthIndex >= 0 && selLengthIndex < names.length ? selLengthIndex : 0]);
    }
    if (this.host.supports(Capability.NOTE_REPEAT_MODE)) {
        final ArpeggiatorMode mode = this.noteRepeat.getMode();
        d.setBlock(0, 2, this.mark("Mode", 4));
        d.setBlock(1, 2, StringUtils.optimizeName(mode.getName(), 12));
    }
    if (this.host.supports(Capability.NOTE_REPEAT_OCTAVES)) {
        final int octaves = this.noteRepeat.getOctaves();
        d.setBlock(0, 3, this.mark("Octaves", 6));
        d.setBlock(1, 3, Integer.toString(octaves));
    }
    d.allDone();
}
Also used : ArpeggiatorMode(de.mossgrabers.framework.daw.midi.ArpeggiatorMode) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay)

Example 3 with ArpeggiatorMode

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

the class NoteRepeatView method executeFunction.

/**
 * {@inheritDoc}
 */
@Override
protected void executeFunction(final int padIndex) {
    final IHost host = this.model.getHost();
    final MaschineConfiguration configuration = this.surface.getConfiguration();
    switch(padIndex) {
        case 6:
        case 7:
            if (host.supports(Capability.NOTE_REPEAT_MODE)) {
                final ArpeggiatorMode arpMode = configuration.getNoteRepeatMode();
                final int modeIndex = configuration.lookupArpeggiatorModeIndex(arpMode);
                final boolean increase = padIndex == 7;
                final List<ArpeggiatorMode> modes = configuration.getArpeggiatorModes();
                final int newIndex = Math.max(0, Math.min(modes.size() - 1, modeIndex + (increase ? 1 : -1)));
                configuration.setNoteRepeatMode(modes.get(newIndex));
                this.mvHelper.delayDisplay(() -> "Mode: " + configuration.getNoteRepeatMode().getName());
            }
            break;
        case 8:
        case 9:
            if (host.supports(Capability.NOTE_REPEAT_LENGTH)) {
                final int sel2 = Resolution.change(Resolution.getMatch(configuration.getNoteRepeatLength().getValue()), padIndex == 9);
                configuration.setNoteRepeatLength(Resolution.values()[sel2]);
                this.surface.scheduleTask(() -> this.surface.getDisplay().notify("Note Length: " + Resolution.getNameAt(sel2)), 100);
            }
            break;
        case 12:
        case 13:
            final int sel = Resolution.change(Resolution.getMatch(configuration.getNoteRepeatPeriod().getValue()), padIndex == 13);
            configuration.setNoteRepeatPeriod(Resolution.values()[sel]);
            this.mvHelper.delayDisplay(() -> "Period: " + Resolution.getNameAt(sel));
            break;
        case 14:
        case 15:
            if (host.supports(Capability.NOTE_REPEAT_OCTAVES)) {
                configuration.setNoteRepeatOctave(configuration.getNoteRepeatOctave() + (padIndex == 15 ? 1 : -1));
                this.mvHelper.delayDisplay(() -> "Octaves: " + configuration.getNoteRepeatOctave());
            }
            break;
        default:
            // Not used
            break;
    }
}
Also used : ArpeggiatorMode(de.mossgrabers.framework.daw.midi.ArpeggiatorMode) MaschineConfiguration(de.mossgrabers.controller.ni.maschine.mk3.MaschineConfiguration) IHost(de.mossgrabers.framework.daw.IHost)

Example 4 with ArpeggiatorMode

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

the class AbstractConfiguration method prevArpeggiatorMode.

/**
 * Get the previous arpeggiator mode.
 *
 * @return The previous
 */
public ArpeggiatorMode prevArpeggiatorMode() {
    final ArpeggiatorMode arpMode = this.getNoteRepeatMode();
    final int index = this.lookupArpeggiatorModeIndex(arpMode) - 1;
    return this.arpeggiatorModes.get(index < 0 ? this.arpeggiatorModes.size() - 1 : index);
}
Also used : ArpeggiatorMode(de.mossgrabers.framework.daw.midi.ArpeggiatorMode)

Example 5 with ArpeggiatorMode

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

the class NoteRepeatMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2(final IGraphicDisplay display) {
    if (this.noteRepeat == null)
        return;
    display.addOptionElement("Period", "", false, "", "", false, false);
    final int selPeriodIndex = this.getSelectedPeriodIndex();
    display.addListElement(6, Resolution.getNames(), selPeriodIndex);
    if (this.host.supports(Capability.NOTE_REPEAT_LENGTH)) {
        display.addOptionElement("  Length", "", false, "", "", false, false);
        final int selLengthIndex = this.getSelectedNoteLengthIndex();
        display.addListElement(6, Resolution.getNames(), selLengthIndex);
    } else {
        display.addEmptyElement();
        display.addEmptyElement();
    }
    display.addEmptyElement();
    final int upperBound = this.model.getValueChanger().getUpperBound();
    if (this.host.supports(Capability.NOTE_REPEAT_MODE)) {
        final String bottomMenu = this.host.supports(Capability.NOTE_REPEAT_USE_PRESSURE_TO_VELOCITY) ? "Use Pressure" : "";
        final boolean isBottomMenuEnabled = this.noteRepeat.usePressure();
        final ArpeggiatorMode mode = this.noteRepeat.getMode();
        final Configuration configuration = this.surface.getConfiguration();
        final List<ArpeggiatorMode> arpeggiatorModes = configuration.getArpeggiatorModes();
        final int modeIndex = configuration.lookupArpeggiatorModeIndex(mode);
        final int value = modeIndex * upperBound / (arpeggiatorModes.size() - 1);
        display.addParameterElementWithPlainMenu("", false, bottomMenu, null, isBottomMenuEnabled, "Mode", value, StringUtils.optimizeName(mode.getName(), 8), this.isKnobTouched[5], -1);
    } else
        display.addEmptyElement();
    if (this.host.supports(Capability.NOTE_REPEAT_OCTAVES)) {
        final String bottomMenu = this.host.supports(Capability.NOTE_REPEAT_IS_FREE_RUNNING) ? "Sync" : "";
        final boolean isBottomMenuEnabled = !this.noteRepeat.isFreeRunning();
        final int octaves = this.noteRepeat.getOctaves();
        final int value = octaves * upperBound / 8;
        display.addParameterElementWithPlainMenu("", false, bottomMenu, null, isBottomMenuEnabled, "Octaves", value, Integer.toString(octaves), this.isKnobTouched[6], -1);
    } else
        display.addEmptyElement();
    if (this.host.supports(Capability.NOTE_REPEAT_SWING)) {
        final IGroove groove = this.model.getGroove();
        final IParameter shuffleParam = groove.getParameter(GrooveParameterID.SHUFFLE_AMOUNT);
        final IParameter enabledParam = groove.getParameter(GrooveParameterID.ENABLED);
        final int value = enabledParam.getValue();
        display.addParameterElementWithPlainMenu("Groove " + enabledParam.getDisplayedValue(8), value != 0, "Shuffle", null, this.noteRepeat.isShuffle(), shuffleParam.getName(10), shuffleParam.getValue(), shuffleParam.getDisplayedValue(8), this.isKnobTouched[7], -1);
    } else
        display.addEmptyElement();
}
Also used : ArpeggiatorMode(de.mossgrabers.framework.daw.midi.ArpeggiatorMode) IParameter(de.mossgrabers.framework.daw.data.IParameter) Configuration(de.mossgrabers.framework.configuration.Configuration) PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) IGroove(de.mossgrabers.framework.daw.IGroove)

Aggregations

ArpeggiatorMode (de.mossgrabers.framework.daw.midi.ArpeggiatorMode)9 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)2 GenericFlexiConfiguration (de.mossgrabers.controller.generic.GenericFlexiConfiguration)2 Configuration (de.mossgrabers.framework.configuration.Configuration)2 IParameter (de.mossgrabers.framework.daw.data.IParameter)2 FlexiHandlerException (de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException)1 MaschineConfiguration (de.mossgrabers.controller.ni.maschine.mk3.MaschineConfiguration)1 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)1 IGroove (de.mossgrabers.framework.daw.IGroove)1 IHost (de.mossgrabers.framework.daw.IHost)1 Resolution (de.mossgrabers.framework.daw.constants.Resolution)1 INoteInput (de.mossgrabers.framework.daw.midi.INoteInput)1 INoteRepeat (de.mossgrabers.framework.daw.midi.INoteRepeat)1 Scales (de.mossgrabers.framework.scale.Scales)1