Search in sources :

Example 11 with Scales

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

the class BeatstepControllerSetup 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 12 with Scales

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

the class OSCExtension method init.

/**
 * {@inheritDoc}
 */
@Override
public void init() {
    this.configuration.init(new SettingsUI(this.getHost().getPreferences()));
    final Scales scales = new Scales(this.valueChanger, 0, 128, 128, 1);
    scales.setChromatic(true);
    final ControllerHost host = this.getHost();
    final OSCModel model = new OSCModel(host, new ColorManager(), this.valueChanger, scales);
    final OscModule oscModule = host.getOscModule();
    // Send OSC messages
    this.writer = new OSCWriter(model, this.configuration, oscModule);
    // Receive OSC messages
    final OscAddressSpace addressSpace = oscModule.createAddressSpace();
    this.configuration.addSettingObserver(OSCConfiguration.DEBUG_COMMANDS, () -> addressSpace.setShouldLogMessages(this.configuration.getDebugCommands()));
    addressSpace.registerDefaultMethod(new OSCParser(host, this.writer, this.configuration, model));
    oscModule.createUdpServer(this.configuration.getReceivePort(), addressSpace);
    // Initial flush of the whole DAW state
    host.scheduleTask(() -> this.writer.flush(true), 1000);
    host.println("Initialized.");
}
Also used : ControllerHost(com.bitwig.extension.controller.api.ControllerHost) SettingsUI(de.mossgrabers.framework.bitwig.configuration.SettingsUI) OscAddressSpace(com.bitwig.extension.api.opensoundcontrol.OscAddressSpace) OscModule(com.bitwig.extension.api.opensoundcontrol.OscModule) Scales(de.mossgrabers.framework.scale.Scales) OSCWriter(de.mossgrabers.osc.protocol.OSCWriter) OSCModel(de.mossgrabers.osc.protocol.OSCModel) ColorManager(de.mossgrabers.framework.controller.color.ColorManager) OSCParser(de.mossgrabers.osc.protocol.OSCParser)

Example 13 with Scales

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

the class LaunchpadCursorCommand method updateArrowStates.

/**
 * {@inheritDoc}
 */
@Override
protected void updateArrowStates() {
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ViewManager viewManager = this.surface.getViewManager();
    if (viewManager.isActiveView(Views.VIEW_PLAY)) {
        final Scales scales = this.model.getScales();
        final int octave = scales.getOctave();
        this.canScrollUp = octave < 3;
        this.canScrollDown = octave > -3;
        final int scale = scales.getScale().ordinal();
        this.canScrollLeft = scale > 0;
        this.canScrollRight = scale < Scale.values().length - 1;
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_DRUM)) {
        final int octave = this.model.getScales().getDrumOctave();
        this.canScrollUp = octave < 5;
        this.canScrollDown = octave > -3;
        this.canScrollLeft = this.model.getCursorClip().getEditPage() > 0;
        // TODO API extension required - We do not know the number of steps
        this.canScrollRight = true;
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_DRUM64)) {
        final DrumView64 drumView64 = (DrumView64) viewManager.getView(Views.VIEW_DRUM64);
        final int octave = drumView64.getDrumOctave();
        this.canScrollUp = octave < 1;
        this.canScrollDown = octave > -2;
        this.canScrollLeft = false;
        this.canScrollRight = false;
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_SEQUENCER) || viewManager.isActiveView(Views.VIEW_RAINDROPS)) {
        final int octave = this.model.getScales().getOctave();
        this.canScrollUp = octave < Scales.OCTAVE_RANGE;
        this.canScrollDown = octave > -Scales.OCTAVE_RANGE;
        this.canScrollLeft = this.model.getCursorClip().getEditPage() > 0;
        // TODO API extension required - We do not know the number of steps
        this.canScrollRight = true;
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_DEVICE)) {
        final ICursorDevice cursorDevice = this.model.getCursorDevice();
        this.canScrollUp = cursorDevice.canSelectNextFX();
        this.canScrollDown = cursorDevice.canSelectPreviousFX();
        this.canScrollLeft = cursorDevice.hasPreviousParameterPage();
        this.canScrollRight = cursorDevice.hasNextParameterPage();
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_BROWSER)) {
        final IBrowser browser = this.model.getBrowser();
        final int index = browser.getSelectedContentTypeIndex();
        this.canScrollUp = false;
        this.canScrollDown = false;
        this.canScrollLeft = index > 0;
        this.canScrollRight = index < browser.getContentTypeNames().length - 1;
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_SHIFT) || viewManager.isActiveView(Views.VIEW_DRUM4) || viewManager.isActiveView(Views.VIEW_DRUM8)) {
        this.canScrollUp = false;
        this.canScrollDown = false;
        this.canScrollLeft = false;
        this.canScrollRight = false;
        return;
    }
    // VIEW_SESSION, VIEW_VOLUME, VIEW_PAN, VIEW_SENDS
    final ITrack sel = tb.getSelectedTrack();
    final int selIndex = sel != null ? sel.getIndex() : -1;
    this.canScrollLeft = selIndex > 0 || tb.canScrollTracksUp();
    this.canScrollRight = selIndex >= 0 && selIndex < 7 && tb.getTrack(selIndex + 1).doesExist() || tb.canScrollTracksDown();
    this.canScrollUp = tb.canScrollScenesUp();
    this.canScrollDown = tb.canScrollScenesDown();
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ViewManager(de.mossgrabers.framework.view.ViewManager) Scales(de.mossgrabers.framework.scale.Scales) DrumView64(de.mossgrabers.launchpad.view.DrumView64) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 14 with Scales

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

the class LaunchpadCursorCommand method scrollRight.

/**
 * {@inheritDoc}
 */
@SuppressWarnings("rawtypes")
@Override
protected void scrollRight() {
    final ViewManager viewManager = this.surface.getViewManager();
    if (viewManager.isActiveView(Views.VIEW_PLAY)) {
        final Scales scales = this.model.getScales();
        scales.nextScale();
        final String name = scales.getScale().getName();
        this.surface.getConfiguration().setScale(name);
        this.surface.getDisplay().notify(name);
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_DEVICE)) {
        final ICursorDevice cursorDevice = this.model.getCursorDevice();
        cursorDevice.nextParameterPage();
        this.surface.getDisplay().notify(cursorDevice.getSelectedParameterPageName());
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_BROWSER)) {
        this.model.getBrowser().nextContentType();
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_SHIFT) || viewManager.isActiveView(Views.VIEW_DRUM64))
        return;
    // VIEW_SEQUENCER, VIEW_RAINDROPS, VIEW_DRUM, VIEW_DRUM4, VIEW_DRUM8
    final View activeView = viewManager.getActiveView();
    if (activeView instanceof AbstractSequencerView) {
        ((AbstractSequencerView) activeView).onRight(ButtonEvent.DOWN);
        return;
    }
    // VIEW_SESSION, VIEW_VOLUME, VIEW_PAN, VIEW_SENDS
    this.scrollTracksRight();
}
Also used : ViewManager(de.mossgrabers.framework.view.ViewManager) Scales(de.mossgrabers.framework.scale.Scales) View(de.mossgrabers.framework.view.View) AbstractSequencerView(de.mossgrabers.framework.view.AbstractSequencerView) RaindropsView(de.mossgrabers.launchpad.view.RaindropsView) PlayView(de.mossgrabers.launchpad.view.PlayView) SequencerView(de.mossgrabers.launchpad.view.SequencerView) DrumView(de.mossgrabers.launchpad.view.DrumView) AbstractSequencerView(de.mossgrabers.framework.view.AbstractSequencerView) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 15 with Scales

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

the class LaunchpadCursorCommand method scrollLeft.

/**
 * {@inheritDoc}
 */
@SuppressWarnings("rawtypes")
@Override
protected void scrollLeft() {
    final ViewManager viewManager = this.surface.getViewManager();
    if (viewManager.isActiveView(Views.VIEW_PLAY)) {
        final Scales scales = this.model.getScales();
        scales.prevScale();
        final String name = scales.getScale().getName();
        this.surface.getConfiguration().setScale(name);
        this.surface.getDisplay().notify(name);
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_DEVICE)) {
        final ICursorDevice cursorDevice = this.model.getCursorDevice();
        cursorDevice.previousParameterPage();
        this.surface.getDisplay().notify(cursorDevice.getSelectedParameterPageName());
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_BROWSER)) {
        this.model.getBrowser().previousContentType();
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_SHIFT) || viewManager.isActiveView(Views.VIEW_DRUM64))
        return;
    // VIEW_SEQUENCER, VIEW_RAINDROPS, VIEW_DRUM, VIEW_DRUM4, VIEW_DRUM8
    final View activeView = viewManager.getActiveView();
    if (activeView instanceof AbstractSequencerView) {
        ((AbstractSequencerView) activeView).onLeft(ButtonEvent.DOWN);
        return;
    }
    // VIEW_SESSION, VIEW_VOLUME, VIEW_PAN, VIEW_SENDS
    this.scrollTracksLeft();
}
Also used : ViewManager(de.mossgrabers.framework.view.ViewManager) Scales(de.mossgrabers.framework.scale.Scales) View(de.mossgrabers.framework.view.View) AbstractSequencerView(de.mossgrabers.framework.view.AbstractSequencerView) RaindropsView(de.mossgrabers.launchpad.view.RaindropsView) PlayView(de.mossgrabers.launchpad.view.PlayView) SequencerView(de.mossgrabers.launchpad.view.SequencerView) DrumView(de.mossgrabers.launchpad.view.DrumView) AbstractSequencerView(de.mossgrabers.framework.view.AbstractSequencerView) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

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