Search in sources :

Example 31 with ICursorDevice

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

the class DeviceView method onKnob.

/**
 * {@inheritDoc}
 */
@Override
public void onKnob(final int index, final int value) {
    final ICursorDevice cd = this.model.getCursorDevice();
    if (index < 8) {
        this.extensions.onTrackKnob(index, value);
        return;
    }
    cd.changeParameter(index - 8, value);
}
Also used : ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 32 with ICursorDevice

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

the class DeviceView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final ICursorDevice cd = this.model.getCursorDevice();
    final int offset = cd.getSelectedParameterPage() / 8 * 8;
    final PadGrid padGrid = this.surface.getPadGrid();
    for (int i = 0; i < 8; i++) padGrid.light(44 + i, offset + i == cd.getSelectedParameterPage() ? BeatstepColors.BEATSTEP_BUTTON_STATE_BLUE : BeatstepColors.BEATSTEP_BUTTON_STATE_OFF);
    padGrid.light(36, cd.isEnabled() ? BeatstepColors.BEATSTEP_BUTTON_STATE_RED : BeatstepColors.BEATSTEP_BUTTON_STATE_OFF);
    padGrid.light(37, BeatstepColors.BEATSTEP_BUTTON_STATE_BLUE);
    padGrid.light(38, BeatstepColors.BEATSTEP_BUTTON_STATE_BLUE);
    padGrid.light(39, BeatstepColors.BEATSTEP_BUTTON_STATE_RED);
    padGrid.light(40, BeatstepColors.BEATSTEP_BUTTON_STATE_RED);
    padGrid.light(41, BeatstepColors.BEATSTEP_BUTTON_STATE_OFF);
    padGrid.light(42, BeatstepColors.BEATSTEP_BUTTON_STATE_BLUE);
    padGrid.light(43, BeatstepColors.BEATSTEP_BUTTON_STATE_BLUE);
}
Also used : PadGrid(de.mossgrabers.framework.controller.grid.PadGrid) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 33 with ICursorDevice

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

the class PushControllerSetup method updateButtons.

private void updateButtons() {
    final ITransport t = this.model.getTransport();
    final PushControlSurface surface = this.getSurface();
    surface.updateButton(PushControlSurface.PUSH_BUTTON_METRONOME, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
    surface.updateButton(PushControlSurface.PUSH_BUTTON_PLAY, t.isPlaying() ? PushColors.PUSH_BUTTON_STATE_PLAY_HI : PushColors.PUSH_BUTTON_STATE_PLAY_ON);
    final boolean isShift = surface.isShiftPressed();
    final boolean isFlipRecord = this.configuration.isFlipRecord();
    final boolean isRecordShifted = isShift && !isFlipRecord || !isShift && isFlipRecord;
    if (isRecordShifted)
        surface.updateButton(PushControlSurface.PUSH_BUTTON_AUTOMATION, t.isWritingClipLauncherAutomation() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
    else
        surface.updateButton(PushControlSurface.PUSH_BUTTON_AUTOMATION, t.isWritingArrangerAutomation() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
    surface.updateButton(PushControlSurface.PUSH_BUTTON_RECORD, isRecordShifted ? t.isLauncherOverdub() ? PushColors.PUSH_BUTTON_STATE_OVR_HI : PushColors.PUSH_BUTTON_STATE_OVR_ON : t.isRecording() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
    surface.updateButton(PushControlSurface.PUSH_BUTTON_ACCENT, this.configuration.isAccentActive() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
    final PushConfiguration config = surface.getConfiguration();
    if (this.isPush2) {
        final ModeManager modeManager = surface.getModeManager();
        if (modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER)) {
            final ICursorDevice cd = this.model.getCursorDevice();
            final IChannel layer = cd.getSelectedLayerOrDrumPad();
            surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, layer != null && layer.isMute() ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
            surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, layer != null && layer.isSolo() ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
        } else {
            final IChannelBank tb = this.model.getCurrentTrackBank();
            final ITrack selTrack = modeManager.isActiveMode(Modes.MODE_MASTER) ? this.model.getMasterTrack() : tb.getSelectedTrack();
            surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, selTrack != null && selTrack.isMute() ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
            surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, selTrack != null && selTrack.isSolo() ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
        }
        surface.updateButton(PushControlSurface.PUSH_BUTTON_CONVERT, this.model.canConvertClip() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
    } else {
        final boolean isMuteState = config.isMuteState();
        surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, isMuteState ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
        surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, !isMuteState ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
    }
    final ViewManager viewManager = surface.getViewManager();
    final boolean isSessionView = Views.isSessionView(viewManager.getActiveViewId());
    surface.updateButton(PushControlSurface.PUSH_BUTTON_NOTE, isSessionView ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_HI);
    if (this.host.hasClips()) {
        surface.updateButton(PushControlSurface.PUSH_BUTTON_CLIP_STOP, surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP) ? PushColors.PUSH_BUTTON_STATE_STOP_HI : PushColors.PUSH_BUTTON_STATE_STOP_ON);
        surface.updateButton(PushControlSurface.PUSH_BUTTON_SESSION, isSessionView ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
    } else {
        surface.updateButton(PushControlSurface.PUSH_BUTTON_CLIP_STOP, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(PushControlSurface.PUSH_BUTTON_SESSION, ColorManager.BUTTON_STATE_OFF);
    }
    surface.updateButton(PushControlSurface.PUSH_BUTTON_ACCENT, config.isAccentActive() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
    final View activeView = viewManager.getActiveView();
    if (activeView != null) {
        ((PushCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
        ((SceneView) activeView).updateSceneButtons();
    }
    final ICursorClip clip = activeView instanceof AbstractSequencerView && !(activeView instanceof ClipView) ? ((AbstractSequencerView<?, ?>) activeView).getClip() : null;
    surface.updateButton(PushControlSurface.PUSH_BUTTON_DEVICE_LEFT, clip != null && clip.canScrollStepsBackwards() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
    surface.updateButton(PushControlSurface.PUSH_BUTTON_DEVICE_RIGHT, clip != null && clip.canScrollStepsForwards() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITransport(de.mossgrabers.framework.daw.ITransport) ViewManager(de.mossgrabers.framework.view.ViewManager) ColorView(de.mossgrabers.push.view.ColorView) PlayView(de.mossgrabers.push.view.PlayView) SequencerView(de.mossgrabers.push.view.SequencerView) ScenePlayView(de.mossgrabers.push.view.ScenePlayView) DrumView(de.mossgrabers.push.view.DrumView) SceneView(de.mossgrabers.framework.view.SceneView) View(de.mossgrabers.framework.view.View) ClipView(de.mossgrabers.push.view.ClipView) AbstractSequencerView(de.mossgrabers.framework.view.AbstractSequencerView) PrgChangeView(de.mossgrabers.push.view.PrgChangeView) PianoView(de.mossgrabers.push.view.PianoView) SessionView(de.mossgrabers.push.view.SessionView) RaindropsView(de.mossgrabers.push.view.RaindropsView) AbstractSequencerView(de.mossgrabers.framework.view.AbstractSequencerView) PushCursorCommand(de.mossgrabers.push.command.trigger.PushCursorCommand) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ICursorClip(de.mossgrabers.framework.daw.ICursorClip) SceneView(de.mossgrabers.framework.view.SceneView) ClipView(de.mossgrabers.push.view.ClipView) PushControlSurface(de.mossgrabers.push.controller.PushControlSurface) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 34 with ICursorDevice

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

the class OSCWriter method flush.

/**
 * Flush out all values.
 *
 * @param dump Forces a flush if true otherwise only changed values are flushed
 */
public void flush(final boolean dump) {
    if (this.udpServer == null)
        return;
    // 
    // Transport
    // 
    final ITransport trans = this.model.getTransport();
    this.sendOSC("/play", trans.isPlaying(), dump);
    this.sendOSC("/record", trans.isRecording(), dump);
    this.sendOSC("/overdub", trans.isArrangerOverdub(), dump);
    this.sendOSC("/overdub/launcher", trans.isLauncherOverdub(), dump);
    this.sendOSC("/repeat", trans.isLoop(), dump);
    this.sendOSC("/punchIn", trans.isPunchInEnabled(), dump);
    this.sendOSC("/punchOut", trans.isPunchOutEnabled(), dump);
    this.sendOSC("/click", trans.isMetronomeOn(), dump);
    this.sendOSC("/click/ticks", trans.isMetronomeTicksOn(), dump);
    this.sendOSC("/click/volume", trans.getMetronomeVolume(), dump);
    this.sendOSC("/click/volumeStr", trans.getMetronomeVolumeStr(), dump);
    this.sendOSC("/click/preroll", trans.isPrerollMetronomeEnabled(), dump);
    this.sendOSC("/preroll", trans.getPrerollAsBars(), dump);
    this.sendOSC("/tempo/raw", trans.getTempo(), dump);
    this.sendOSC("/crossfade", trans.getCrossfade(), dump);
    this.sendOSC("/autowrite", trans.isWritingArrangerAutomation(), dump);
    this.sendOSC("/autowrite/launcher", trans.isWritingClipLauncherAutomation(), dump);
    this.sendOSC("/automationWriteMode", trans.getAutomationWriteMode(), dump);
    this.sendOSC("/time/str", trans.getPositionText(), dump);
    this.sendOSC("/time/signature", trans.getNumerator() + " / " + trans.getDenominator(), dump);
    this.sendOSC("/beat/str", trans.getBeatText(), dump);
    // 
    // Frames
    // 
    final IApplication app = this.model.getApplication();
    this.sendOSC("/layout", app.getPanelLayout().toLowerCase(), dump);
    final IArranger arrange = this.model.getArranger();
    this.sendOSC("/arranger/cueMarkerVisibility", arrange.areCueMarkersVisible(), dump);
    this.sendOSC("/arranger/playbackFollow", arrange.isPlaybackFollowEnabled(), dump);
    this.sendOSC("/arranger/trackRowHeight", arrange.hasDoubleRowTrackHeight(), dump);
    this.sendOSC("/arranger/clipLauncherSectionVisibility", arrange.isClipLauncherVisible(), dump);
    this.sendOSC("/arranger/timeLineVisibility", arrange.isTimelineVisible(), dump);
    this.sendOSC("/arranger/ioSectionVisibility", arrange.isIoSectionVisible(), dump);
    this.sendOSC("/arranger/effectTracksVisibility", arrange.areEffectTracksVisible(), dump);
    final IMixer mix = this.model.getMixer();
    this.sendOSC("/mixer/clipLauncherSectionVisibility", mix.isClipLauncherSectionVisible(), dump);
    this.sendOSC("/mixer/crossFadeSectionVisibility", mix.isCrossFadeSectionVisible(), dump);
    this.sendOSC("/mixer/deviceSectionVisibility", mix.isDeviceSectionVisible(), dump);
    this.sendOSC("/mixer/sendsSectionVisibility", mix.isSendSectionVisible(), dump);
    this.sendOSC("/mixer/ioSectionVisibility", mix.isIoSectionVisible(), dump);
    this.sendOSC("/mixer/meterSectionVisibility", mix.isMeterSectionVisible(), dump);
    // 
    // Project
    // 
    this.sendOSC("/project/name", this.model.getProject().getName(), dump);
    this.sendOSC("/project/engine", app.isEngineActive(), dump);
    // 
    // Master-/Track(-commands)
    // 
    final IChannelBank trackBank = this.model.getCurrentTrackBank();
    for (int i = 0; i < trackBank.getNumTracks(); i++) this.flushTrack("/track/" + (i + 1) + "/", trackBank.getTrack(i), dump);
    this.flushTrack("/master/", this.model.getMasterTrack(), dump);
    final ITrack selectedTrack = trackBank.getSelectedTrack();
    this.flushTrack("/track/selected/", selectedTrack == null ? EMPTY_TRACK : selectedTrack, dump);
    this.sendOSC("/track/toggleBank", this.model.isEffectTrackBankActive() ? 1 : 0, dump);
    // 
    // Scenes
    // 
    final ISceneBank sceneBank = this.model.getSceneBank();
    for (int i = 0; i < sceneBank.getNumScenes(); i++) this.flushScene("/scene/" + (i + 1) + "/", sceneBank.getScene(i), dump);
    // 
    // Device / Primary Device
    // 
    final ICursorDevice cd = this.model.getCursorDevice();
    this.flushDevice("/device/", cd, dump);
    if (cd.hasDrumPads()) {
        for (int i = 0; i < cd.getNumDrumPads(); i++) this.flushDeviceLayers("/device/drumpad/" + (i + 1) + "/", cd.getLayerOrDrumPad(i), dump);
    }
    for (int i = 0; i < cd.getNumLayers(); i++) this.flushDeviceLayers("/device/layer/" + (i + 1) + "/", cd.getLayerOrDrumPad(i), dump);
    this.flushDevice("/primary/", this.model.getPrimaryDevice(), dump);
    // 
    // Browser
    // 
    this.flushBrowser("/browser/", this.model.getBrowser(), dump);
    // 
    // Notes
    // 
    this.flushNotes("/vkb_midi/note/", dump);
    try {
        int pos = 0;
        this.udpServer.startBundle();
        for (final OscMessageData message : this.messages) {
            final String address = message.getAddress();
            final Object[] values = message.getValues();
            this.udpServer.sendMessage(address, values);
            pos++;
            if (pos > 1000) {
                pos = 0;
                this.udpServer.endBundle();
                this.udpServer.startBundle();
            }
        }
        this.udpServer.endBundle();
    } catch (final IOException ex) {
        this.model.getHost().error("Could not send UDP message.", ex);
    }
    this.messages.clear();
}
Also used : IMixer(de.mossgrabers.framework.daw.IMixer) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITransport(de.mossgrabers.framework.daw.ITransport) IArranger(de.mossgrabers.framework.daw.IArranger) IOException(java.io.IOException) ISceneBank(de.mossgrabers.framework.daw.ISceneBank) IApplication(de.mossgrabers.framework.daw.IApplication) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 35 with ICursorDevice

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

the class DeviceBrowserMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final IBrowser browser = this.model.getBrowser();
    final Display d = this.surface.getDisplay();
    final boolean isPresetSession = browser.isPresetContentType();
    final ICursorDevice cd = this.model.getCursorDevice();
    if (isPresetSession && !(browser.isActive() && cd.hasSelectedDevice())) {
        d.notify("No active Browsing Session. Select device and press Browser...");
        return;
    }
    d.clear();
    switch(this.selectionMode) {
        case SELECTION_OFF:
            for (int i = 0; i < 7; i++) {
                final IBrowserColumn column = this.getFilterColumn(i);
                final String value = column != null && column.doesCursorExist() ? column.getCursorName().equals(column.getWildcard()) ? "-" : column.getCursorName() : "";
                final String name = column == null ? "" : StringUtils.shortenAndFixASCII(column.getName(), 6);
                d.setCell(0, i, name).setCell(1, i, value);
            }
            final String selectedResult = browser.getSelectedResult();
            d.setCell(0, 7, browser.getSelectedContentType()).setCell(1, 7, selectedResult == null || selectedResult.length() == 0 ? "-" : selectedResult);
            break;
        case SELECTION_PRESET:
            final IBrowserColumnItem[] results = browser.getResultColumnItems();
            for (int i = 0; i < browser.getNumFilterColumnEntries(); i++) {
                if (i < results.length)
                    d.setBlock(i / 4, i % 4, (results[i].isSelected() ? ">" : " ") + StringUtils.fixASCII(results[i].getName()));
                else
                    break;
            }
            break;
        case SELECTION_FILTER:
            final IBrowserColumnItem[] items = browser.getFilterColumn(this.filterColumn).getItems();
            for (int i = 0; i < browser.getNumResults(); i++) d.setBlock(i / 4, i % 4, (items[i].isSelected() ? ">" : " ") + StringUtils.fixASCII(items[i].getName()));
            break;
    }
    d.allDone();
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumnItem(de.mossgrabers.framework.daw.data.IBrowserColumnItem) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) Display(de.mossgrabers.framework.controller.display.Display)

Aggregations

ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)72 IChannel (de.mossgrabers.framework.daw.data.IChannel)25 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)22 ITrack (de.mossgrabers.framework.daw.data.ITrack)19 Display (de.mossgrabers.framework.controller.display.Display)10 ModeManager (de.mossgrabers.framework.mode.ModeManager)9 View (de.mossgrabers.framework.view.View)8 ViewManager (de.mossgrabers.framework.view.ViewManager)8 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)7 IParameter (de.mossgrabers.framework.daw.data.IParameter)6 ITransport (de.mossgrabers.framework.daw.ITransport)5 PushConfiguration (de.mossgrabers.push.PushConfiguration)5 ICursorClip (de.mossgrabers.framework.daw.ICursorClip)4 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)4 SceneView (de.mossgrabers.framework.view.SceneView)4 APCControlSurface (de.mossgrabers.apc.controller.APCControlSurface)3 IBrowser (de.mossgrabers.framework.daw.IBrowser)3 Scales (de.mossgrabers.framework.scale.Scales)3 AbstractSequencerView (de.mossgrabers.framework.view.AbstractSequencerView)3 DrumView (de.mossgrabers.launchpad.view.DrumView)3