Search in sources :

Example 16 with Scales

use of de.mossgrabers.framework.scale.Scales in project DrivenByMoss by git-moss.

the class SLControllerSetup method createScales.

/**
 * {@inheritDoc}
 */
@Override
protected void createScales() {
    this.scales = new Scales(this.valueChanger, 36, 52, 8, 2);
    this.scales.setDrumMatrix(DRUM_MATRIX);
    this.scales.setDrumNoteEnd(52);
}
Also used : Scales(de.mossgrabers.framework.scale.Scales)

Example 17 with Scales

use of de.mossgrabers.framework.scale.Scales in project DrivenByMoss by git-moss.

the class AutoColorSetup method createScales.

/**
 * {@inheritDoc}
 */
@Override
protected void createScales() {
    this.scales = new Scales(this.valueChanger, 0, 128, 128, 1);
    this.scales.setChromatic(true);
}
Also used : Scales(de.mossgrabers.framework.scale.Scales)

Example 18 with Scales

use of de.mossgrabers.framework.scale.Scales in project DrivenByMoss by git-moss.

the class NoteInputHandler method handle.

/**
 * {@inheritDoc}
 */
@Override
public void handle(final FlexiCommand command, final KnobMode knobMode, final MidiValue value) {
    final boolean isButtonPressed = this.isButtonPressed(knobMode, value);
    final GenericFlexiConfiguration configuration = this.surface.getConfiguration();
    final Resolution[] resolutions = Resolution.values();
    final Scales scales = this.model.getScales();
    final double val = value.isHighRes() ? value.getValue() / 128.0 : value.getValue();
    switch(command) {
        // Note Repeat: Toggle Active
        case NOTE_INPUT_REPEAT_ACTIVE:
            if (isButtonPressed) {
                configuration.toggleNoteRepeatActive();
                this.mvHelper.delayDisplay(() -> "Repeat: " + (configuration.isNoteRepeatActive() ? "On" : "Off"));
            }
            break;
        // Note Repeat: Set Period
        case NOTE_INPUT_REPEAT_PERIOD:
            final int selPeriod;
            if (isAbsolute(knobMode))
                selPeriod = (int) Math.min(Math.round(val / 127.0 * resolutions.length), resolutions.length - 1L);
            else
                selPeriod = Resolution.change(Resolution.getMatch(configuration.getNoteRepeatPeriod().getValue()), this.isIncrease(knobMode, value));
            configuration.setNoteRepeatPeriod(resolutions[selPeriod]);
            this.mvHelper.delayDisplay(() -> "Repeat Period: " + configuration.getNoteRepeatPeriod().getName());
            break;
        // Note Repeat: Set Length
        case NOTE_INPUT_REPEAT_LENGTH:
            if (this.model.getHost().supports(Capability.NOTE_REPEAT_LENGTH)) {
                final int selLength;
                if (isAbsolute(knobMode))
                    selLength = (int) Math.min(Math.round(val / 127.0 * resolutions.length), resolutions.length - 1L);
                else
                    selLength = Resolution.change(Resolution.getMatch(configuration.getNoteRepeatLength().getValue()), this.isIncrease(knobMode, value));
                configuration.setNoteRepeatLength(resolutions[selLength]);
                this.mvHelper.delayDisplay(() -> "Repeat Length: " + configuration.getNoteRepeatLength().getName());
            }
            break;
        case NOTE_INPUT_REPEAT_MODE:
            if (this.host.supports(Capability.NOTE_REPEAT_MODE)) {
                final List<ArpeggiatorMode> modes = configuration.getArpeggiatorModes();
                final int newIndex;
                if (isAbsolute(knobMode)) {
                    if (val >= modes.size())
                        return;
                    newIndex = (int) val;
                } else {
                    final ArpeggiatorMode arpMode = configuration.getNoteRepeatMode();
                    final int modeIndex = configuration.lookupArpeggiatorModeIndex(arpMode);
                    final boolean increase = this.isIncrease(knobMode, value);
                    newIndex = Math.max(0, Math.min(modes.size() - 1, modeIndex + (increase ? 1 : -1)));
                }
                configuration.setNoteRepeatMode(modes.get(newIndex));
                this.mvHelper.delayDisplay(() -> "Repeat Mode: " + modes.get(newIndex).getName());
            }
            break;
        case NOTE_INPUT_REPEAT_OCTAVE:
            if (this.host.supports(Capability.NOTE_REPEAT_OCTAVES)) {
                final int octave;
                if (isAbsolute(knobMode))
                    octave = (int) val;
                else
                    octave = configuration.getNoteRepeatOctave() + (this.isIncrease(knobMode, value) ? 1 : -1);
                configuration.setNoteRepeatOctave(octave);
                this.mvHelper.delayDisplay(() -> "Repeat Octave: " + octave);
            }
            break;
        case NOTE_INPUT_TRANSPOSE_OCTAVE_UP:
            if (isButtonPressed) {
                scales.incOctave();
                this.updateOctave(scales);
            }
            break;
        case NOTE_INPUT_TRANSPOSE_OCTAVE_DOWN:
            if (isButtonPressed) {
                scales.decOctave();
                this.updateOctave(scales);
            }
            break;
        default:
            throw new FlexiHandlerException(command);
    }
}
Also used : ArpeggiatorMode(de.mossgrabers.framework.daw.midi.ArpeggiatorMode) FlexiHandlerException(de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException) GenericFlexiConfiguration(de.mossgrabers.controller.generic.GenericFlexiConfiguration) Scales(de.mossgrabers.framework.scale.Scales) Resolution(de.mossgrabers.framework.daw.constants.Resolution)

Example 19 with Scales

use of de.mossgrabers.framework.scale.Scales in project DrivenByMoss by git-moss.

the class SLMkIIILightGuide method draw.

/**
 * Draw the light guide.
 *
 * @param isEnabled True if enabled
 */
public void draw(final boolean isEnabled) {
    final boolean isRecording = this.model.hasRecordingState();
    final Scales scales = this.model.getScales();
    this.keyboardScales.setScaleOffset(scales.getScaleOffset());
    this.keyboardScales.setScale(scales.getScale());
    final ITrack cursorTrack = this.model.getCursorTrack();
    for (int i = this.keyboardScales.getStartNote(); i < this.keyboardScales.getEndNote(); i++) this.light(i - 36, this.getGridColor(isEnabled, isRecording, cursorTrack, i));
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) Scales(de.mossgrabers.framework.scale.Scales)

Example 20 with Scales

use of de.mossgrabers.framework.scale.Scales in project DrivenByMoss by git-moss.

the class DrumConfigurationMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ITextDisplay d = this.surface.getTextDisplay().clear();
    final Scales scales = this.model.getScales();
    final int octave = scales.getDrumOffset();
    d.setBlock(0, 3, this.mark("Drum Offset", 6)).setBlock(1, 3, (octave > 0 ? "+" : "") + Integer.toString(octave));
    d.allDone();
}
Also used : ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay) Scales(de.mossgrabers.framework.scale.Scales)

Aggregations

Scales (de.mossgrabers.framework.scale.Scales)26 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)3 ViewManager (de.mossgrabers.framework.view.ViewManager)3 PlayView (de.mossgrabers.controller.ni.maschine.mk3.view.PlayView)2 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)2 ITrack (de.mossgrabers.framework.daw.data.ITrack)2 INoteMode (de.mossgrabers.framework.mode.INoteMode)2 AbstractSequencerView (de.mossgrabers.framework.view.AbstractSequencerView)2 View (de.mossgrabers.framework.view.View)2 DrumView (de.mossgrabers.launchpad.view.DrumView)2 PlayView (de.mossgrabers.launchpad.view.PlayView)2 RaindropsView (de.mossgrabers.launchpad.view.RaindropsView)2 SequencerView (de.mossgrabers.launchpad.view.SequencerView)2 OscAddressSpace (com.bitwig.extension.api.opensoundcontrol.OscAddressSpace)1 OscModule (com.bitwig.extension.api.opensoundcontrol.OscModule)1 ControllerHost (com.bitwig.extension.controller.api.ControllerHost)1 GenericFlexiConfiguration (de.mossgrabers.controller.generic.GenericFlexiConfiguration)1 FlexiHandlerException (de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException)1 MaschineConfiguration (de.mossgrabers.controller.ni.maschine.mk3.MaschineConfiguration)1 DrumView (de.mossgrabers.controller.ni.maschine.mk3.view.DrumView)1