Search in sources :

Example 6 with IApplication

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

the class FrameMode method updateDisplay1.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay1(final ITextDisplay display) {
    final IApplication app = this.model.getApplication();
    final String[] rows34;
    if (app.isArrangeLayout())
        rows34 = FrameMode.ARRANGER_ROWS;
    else if (app.isMixerLayout())
        rows34 = FrameMode.MIXER_ROWS;
    else
        rows34 = FrameMode.EMPTY_ROWS;
    display.setRow(0, FrameMode.ROW0).setRow(1, FrameMode.ROW1).setRow(2, rows34[0]).setRow(3, rows34[1]);
}
Also used : IApplication(de.mossgrabers.framework.daw.IApplication)

Example 7 with IApplication

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

the class MasterMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    if (!this.surface.getConfiguration().hasDisplay1())
        return;
    this.drawDisplay2();
    final ITextDisplay d = this.surface.getTextDisplay().clear();
    final String projectName = StringUtils.fixASCII(this.model.getProject().getName());
    final IMasterTrack master = this.model.getMasterTrack();
    final IApplication application = this.model.getApplication();
    d.setCell(0, 0, "Volume").setCell(0, 1, "Pan").setBlock(0, 1, "Audio Engine:").setCell(0, 4, application.isEngineActive() ? " On" : " Off");
    d.setCell(0, 5, "Prjct:").setBlock(0, 3, projectName);
    d.setCell(1, 0, master.getVolumeStr(6)).setCell(1, 1, master.getPanStr(6)).setBlock(1, 1, application.isEngineActive() ? "  Turn off" : "  Turn on");
    d.setCell(1, 6, " <<").setCell(1, 7, " >>").allDone();
}
Also used : IApplication(de.mossgrabers.framework.daw.IApplication) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack)

Example 8 with IApplication

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

the class OSCParser method parseTrackCommands.

private void parseTrackCommands(final LinkedList<String> oscParts, final Object value, final int numValue) {
    if (oscParts.isEmpty()) {
        this.host.errorln("Missing Track command.");
        return;
    }
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final String command = oscParts.removeFirst();
    switch(command) {
        case PART_INDICATE:
            {
                if (oscParts.isEmpty()) {
                    this.host.errorln("Missing Indicate subcommand.");
                    return;
                }
                final boolean isTrue = numValue > 0;
                final String subCommand = oscParts.removeFirst();
                switch(subCommand) {
                    case PART_VOLUME:
                        for (int i = 0; i < tb.getNumTracks(); i++) tb.getTrack(i).setVolumeIndication(isTrue);
                        break;
                    case "pan":
                        for (int i = 0; i < tb.getNumTracks(); i++) tb.getTrack(i).setPanIndication(isTrue);
                        break;
                    case "send":
                        if (tb instanceof ITrackBank) {
                            final int sendIndex = Integer.parseInt(oscParts.get(0));
                            for (int i = 0; i < tb.getNumTracks(); i++) tb.getTrack(i).getSend(sendIndex - 1).setIndication(isTrue);
                        }
                        break;
                    default:
                        this.host.errorln("Unknown Indicate subcommand: " + subCommand);
                        break;
                }
                break;
            }
        case "bank":
            if (oscParts.isEmpty()) {
                this.host.errorln("Missing Track Bank subcommand.");
                return;
            }
            final String subCommand = oscParts.removeFirst();
            switch(subCommand) {
                case "page":
                    if (oscParts.isEmpty()) {
                        this.host.errorln("Missing Track Bank Page subcommand.");
                        return;
                    }
                    if ("+".equals(oscParts.removeFirst())) {
                        if (!tb.canScrollTracksDown())
                            return;
                        tb.scrollTracksPageDown();
                        this.host.scheduleTask(() -> tb.getTrack(0).selectAndMakeVisible(), 75);
                    } else // "-"
                    {
                        if (!tb.canScrollTracksUp())
                            return;
                        tb.scrollTracksPageUp();
                        this.host.scheduleTask(() -> tb.getTrack(7).selectAndMakeVisible(), 75);
                    }
                    break;
                case "+":
                    tb.scrollTracksDown();
                    break;
                case "-":
                    tb.scrollTracksUp();
                    break;
                default:
                    this.host.errorln("Unknown Track Bank subcommand: " + subCommand);
                    break;
            }
            break;
        case "+":
            {
                final ITrack sel = tb.getSelectedTrack();
                final int index = sel == null ? 0 : sel.getIndex() + 1;
                if (index == tb.getNumTracks()) {
                    if (!tb.canScrollTracksDown())
                        return;
                    tb.scrollTracksPageDown();
                    this.host.scheduleTask(() -> tb.getTrack(0).selectAndMakeVisible(), 75);
                    return;
                }
                tb.getTrack(index).selectAndMakeVisible();
                break;
            }
        case "-":
            {
                final ITrack sel = tb.getSelectedTrack();
                final int index = sel == null ? 0 : sel.getIndex() - 1;
                if (index == -1) {
                    if (!tb.canScrollTracksUp())
                        return;
                    tb.scrollTracksPageUp();
                    this.host.scheduleTask(() -> tb.getTrack(7).selectAndMakeVisible(), 75);
                    return;
                }
                tb.getTrack(index).selectAndMakeVisible();
                break;
            }
        case "add":
            if (oscParts.isEmpty()) {
                this.host.errorln("Missing Add subcommand.");
                return;
            }
            final String subCommand2 = oscParts.removeFirst();
            final IApplication application = this.model.getApplication();
            switch(subCommand2) {
                case "audio":
                    application.addAudioTrack();
                    break;
                case "effect":
                    application.addEffectTrack();
                    break;
                case "instrument":
                    application.addInstrumentTrack();
                    break;
                default:
                    this.host.errorln("Unknown Add subcommand: " + subCommand2);
                    break;
            }
            break;
        case "stop":
            this.model.getCurrentTrackBank().stop();
            break;
        case "vu":
            this.configuration.setVUMetersEnabled(numValue > 0);
            break;
        case "toggleBank":
            {
                this.model.toggleCurrentTrackBank();
                final IChannelBank tbNew = this.model.getCurrentTrackBank();
                // Make sure a track is selected
                final IChannelBank tbOther = this.model.isEffectTrackBankActive() ? this.model.getTrackBank() : this.model.getEffectTrackBank();
                final ITrack selectedTrack = tbNew.getSelectedTrack();
                if (selectedTrack == null)
                    tbNew.getTrack(0).selectAndMakeVisible();
                // Move the indication to the other bank
                for (int i = 0; i < tbNew.getNumTracks(); i++) {
                    final ITrack otherTrack = tbOther.getTrack(i);
                    otherTrack.setVolumeIndication(false);
                    otherTrack.setPanIndication(false);
                    final ITrack track = tbNew.getTrack(i);
                    track.setVolumeIndication(true);
                    track.setPanIndication(true);
                }
                break;
            }
        case "parent":
            {
                if (tb instanceof ITrackBank)
                    ((ITrackBank) tb).selectParent();
                break;
            }
        case "selected":
            final ITrack selectedTrack = tb.getSelectedTrack();
            if (selectedTrack != null)
                this.parseTrackValue(selectedTrack, oscParts, value);
            break;
        default:
            this.host.println("Unknown Track Command: " + command);
            break;
    }
}
Also used : IApplication(de.mossgrabers.framework.daw.IApplication) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.ITrackBank) IChannelBank(de.mossgrabers.framework.daw.IChannelBank)

Example 9 with IApplication

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

the class OSCParser method parsePanelCommands.

private boolean parsePanelCommands(final String command, final LinkedList<String> oscParts, final String value) {
    switch(command) {
        case "layout":
            if (value != null)
                this.model.getApplication().setPanelLayout(value.toUpperCase());
            return true;
        case "panel":
            if (oscParts.isEmpty()) {
                this.host.errorln("Missing Panel subcommand.");
                return true;
            }
            final IApplication app = this.model.getApplication();
            final String subCommand = oscParts.get(0);
            switch(subCommand) {
                case "noteEditor":
                    app.toggleNoteEditor();
                    break;
                case "automationEditor":
                    app.toggleAutomationEditor();
                    break;
                case "devices":
                    app.toggleDevices();
                    break;
                case "mixer":
                    app.toggleMixer();
                    break;
                case "fullscreen":
                    app.toggleFullScreen();
                    break;
                default:
                    this.host.errorln("Unknown Panel subcommand: " + subCommand);
            }
            return true;
        case "arranger":
            if (oscParts.isEmpty()) {
                this.host.errorln("Missing Arranger subcommand.");
                return true;
            }
            final IArranger arrange = this.model.getArranger();
            final String subCommand2 = oscParts.get(0);
            switch(subCommand2) {
                case "cueMarkerVisibility":
                    arrange.toggleCueMarkerVisibility();
                    break;
                case "playbackFollow":
                    arrange.togglePlaybackFollow();
                    break;
                case "trackRowHeight":
                    arrange.toggleTrackRowHeight();
                    break;
                case "clipLauncherSectionVisibility":
                    arrange.toggleClipLauncher();
                    break;
                case "timeLineVisibility":
                    arrange.toggleTimeLine();
                    break;
                case "ioSectionVisibility":
                    arrange.toggleIoSection();
                    break;
                case "effectTracksVisibility":
                    arrange.toggleEffectTracks();
                    break;
                default:
                    this.host.errorln("Unknown Arranger subcommand: " + subCommand2);
            }
            return true;
        case "mixer":
            if (oscParts.isEmpty()) {
                this.host.errorln("Missing Mixer subcommand.");
                return true;
            }
            final IMixer mix = this.model.getMixer();
            final String subCommand3 = oscParts.get(0);
            switch(subCommand3) {
                case "clipLauncherSectionVisibility":
                    mix.toggleClipLauncherSectionVisibility();
                    break;
                case "crossFadeSectionVisibility":
                    mix.toggleCrossFadeSectionVisibility();
                    break;
                case "deviceSectionVisibility":
                    mix.toggleDeviceSectionVisibility();
                    break;
                case "sendsSectionVisibility":
                    mix.toggleSendsSectionVisibility();
                    break;
                case "ioSectionVisibility":
                    mix.toggleIoSectionVisibility();
                    break;
                case "meterSectionVisibility":
                    mix.toggleMeterSectionVisibility();
                    break;
                default:
                    this.host.errorln("Unknown Mixer subcommand: " + subCommand3);
                    break;
            }
            return true;
        default:
            return false;
    }
}
Also used : IMixer(de.mossgrabers.framework.daw.IMixer) IApplication(de.mossgrabers.framework.daw.IApplication) IArranger(de.mossgrabers.framework.daw.IArranger)

Example 10 with IApplication

use of de.mossgrabers.framework.daw.IApplication 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)

Aggregations

IApplication (de.mossgrabers.framework.daw.IApplication)15 IArranger (de.mossgrabers.framework.daw.IArranger)5 IMixer (de.mossgrabers.framework.daw.IMixer)4 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)3 Display (de.mossgrabers.framework.controller.display.Display)2 ITransport (de.mossgrabers.framework.daw.ITransport)2 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)2 ITrack (de.mossgrabers.framework.daw.data.ITrack)2 PushDisplay (de.mossgrabers.push.controller.PushDisplay)2 MaschineJamConfiguration (de.mossgrabers.controller.ni.maschine.jam.MaschineJamConfiguration)1 SessionView (de.mossgrabers.controller.ni.maschine.jam.view.SessionView)1 UnknownCommandException (de.mossgrabers.controller.osc.exception.UnknownCommandException)1 Configuration (de.mossgrabers.framework.configuration.Configuration)1 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)1 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)1 ISceneBank (de.mossgrabers.framework.daw.ISceneBank)1 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)1 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)1 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)1 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)1