Search in sources :

Example 1 with ISlot

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

the class ModelImpl method canConvertClip.

/**
 * {@inheritDoc}
 */
@Override
public boolean canConvertClip() {
    final IChannelBank tb = this.getCurrentTrackBank();
    final ITrack selectedTrack = tb.getSelectedTrack();
    if (selectedTrack == null)
        return false;
    final ISlot[] slots = selectedTrack.getSelectedSlots();
    if (slots.length == 0)
        return false;
    for (final ISlot slot : slots) {
        if (slot.hasContent())
            return true;
    }
    return false;
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ISlot(de.mossgrabers.framework.daw.data.ISlot)

Example 2 with ISlot

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

the class DuplicateCommand method executeNormal.

/**
 * {@inheritDoc}
 */
@Override
public void executeNormal(final ButtonEvent event) {
    if (event != ButtonEvent.UP)
        return;
    // Is there a selected track?
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack track = tb.getSelectedTrack();
    if (track == null || !track.doesExist())
        return;
    // Is there a selected slot?
    final ISlot slot = track.getSelectedSlot();
    if (slot == null)
        return;
    final boolean isPlaying = slot.isPlaying();
    // Duplicate the clip in the selected slot
    slot.duplicate();
    if (!isPlaying)
        return;
    // Need to wait a bit with starting the duplicated clip until it is selected
    this.model.getHost().scheduleTask(() -> {
        final ISlot slotNew = track.getSelectedSlot();
        if (slotNew != null) {
            slotNew.launch();
            return;
        }
        // Try to find the clip in the next page...
        track.scrollClipPageForwards();
        this.model.getHost().scheduleTask(() -> {
            final ISlot slotNew2 = track.getSelectedSlot();
            if (slotNew2 != null)
                slotNew2.launch();
        }, 200);
    }, 200);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ISlot(de.mossgrabers.framework.daw.data.ISlot)

Example 3 with ISlot

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

the class FootswitchCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event) {
    switch(this.getSetting()) {
        case AbstractConfiguration.FOOTSWITCH_2_TOGGLE_PLAY:
            this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_PLAY, event);
            break;
        case AbstractConfiguration.FOOTSWITCH_2_TOGGLE_RECORD:
            this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_RECORD, event);
            break;
        case AbstractConfiguration.FOOTSWITCH_2_STOP_ALL_CLIPS:
            if (event == ButtonEvent.DOWN)
                this.model.getCurrentTrackBank().stop();
            break;
        case AbstractConfiguration.FOOTSWITCH_2_TOGGLE_CLIP_OVERDUB:
            if (event == ButtonEvent.DOWN)
                this.model.getTransport().toggleLauncherOverdub();
            break;
        case AbstractConfiguration.FOOTSWITCH_2_UNDO:
            this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_UNDO, event);
            break;
        case AbstractConfiguration.FOOTSWITCH_2_TAP_TEMPO:
            this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_TAP_TEMPO, event);
            break;
        case AbstractConfiguration.FOOTSWITCH_2_NEW_BUTTON:
            this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_NEW, event);
            break;
        case AbstractConfiguration.FOOTSWITCH_2_CLIP_BASED_LOOPER:
            final IChannelBank tb = this.model.getCurrentTrackBank();
            final ITrack track = tb.getSelectedTrack();
            if (track == null) {
                this.surface.getDisplay().notify("Please select an Instrument track first.", true, true);
                return;
            }
            final ISlot selectedSlot = track.getSelectedSlot();
            final ISlot slot = selectedSlot == null ? track.getSlot(0) : selectedSlot;
            if (event == ButtonEvent.DOWN) {
                if (slot.hasContent()) {
                    // If there is a clip in the selected slot, enable (not toggle)
                    // LauncherOverdub.
                    this.model.getTransport().setLauncherOverdub(true);
                } else {
                    // If there is no clip in the selected slot, create a clip and begin record
                    // mode. Releasing it ends record mode.
                    this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_NEW, event);
                    slot.select();
                    this.model.getTransport().setLauncherOverdub(true);
                }
            } else {
                // Releasing it would turn off LauncherOverdub.
                this.model.getTransport().setLauncherOverdub(false);
            }
            // Start transport if not already playing
            slot.launch();
            break;
        case AbstractConfiguration.FOOTSWITCH_2_PANEL_LAYOUT_ARRANGE:
            if (event == ButtonEvent.DOWN)
                this.model.getApplication().setPanelLayout(IApplication.PANEL_LAYOUT_ARRANGE);
            break;
        case AbstractConfiguration.FOOTSWITCH_2_PANEL_LAYOUT_MIX:
            if (event == ButtonEvent.DOWN)
                this.model.getApplication().setPanelLayout(IApplication.PANEL_LAYOUT_MIX);
            break;
        case AbstractConfiguration.FOOTSWITCH_2_PANEL_LAYOUT_EDIT:
            if (event == ButtonEvent.DOWN)
                this.model.getApplication().setPanelLayout(IApplication.PANEL_LAYOUT_EDIT);
            break;
        case AbstractConfiguration.FOOTSWITCH_2_ADD_INSTRUMENT_TRACK:
            if (event == ButtonEvent.DOWN)
                this.model.getApplication().addInstrumentTrack();
            break;
        case AbstractConfiguration.FOOTSWITCH_2_ADD_AUDIO_TRACK:
            if (event == ButtonEvent.DOWN)
                this.model.getApplication().addAudioTrack();
            break;
        case AbstractConfiguration.FOOTSWITCH_2_ADD_EFFECT_TRACK:
            if (event == ButtonEvent.DOWN)
                this.model.getApplication().addEffectTrack();
            break;
        case AbstractConfiguration.FOOTSWITCH_2_QUANTIZE:
            if (event == ButtonEvent.DOWN)
                this.model.getCursorClip().quantize(this.surface.getConfiguration().getQuantizeAmount() / 100.0);
            break;
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ISlot(de.mossgrabers.framework.daw.data.ISlot)

Example 4 with ISlot

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

the class TrackImpl method enableObservers.

/**
 * {@inheritDoc}
 */
@Override
public void enableObservers(final boolean enable) {
    super.enableObservers(enable);
    this.track.trackType().setIsSubscribed(enable);
    this.track.position().setIsSubscribed(enable);
    this.track.isGroup().setIsSubscribed(enable);
    this.track.arm().setIsSubscribed(enable);
    this.track.monitor().setIsSubscribed(enable);
    this.track.autoMonitor().setIsSubscribed(enable);
    this.track.crossFadeMode().setIsSubscribed(enable);
    this.track.canHoldNoteData().setIsSubscribed(enable);
    this.track.canHoldAudioData().setIsSubscribed(enable);
    this.track.isStopped().setIsSubscribed(enable);
    for (final ISlot slot : this.slots) slot.enableObservers(enable);
}
Also used : ISlot(de.mossgrabers.framework.daw.data.ISlot)

Example 5 with ISlot

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

the class OSCWriter method flushTrack.

private void flushTrack(final String trackAddress, final ITrack track, final boolean dump) {
    this.sendOSC(trackAddress + "exists", track.doesExist(), dump);
    final ChannelType type = track.getType();
    this.sendOSC(trackAddress + "type", type == null ? null : type.name().toLowerCase(), dump);
    this.sendOSC(trackAddress + "activated", track.isActivated(), dump);
    this.sendOSC(trackAddress + "selected", track.isSelected(), dump);
    this.sendOSC(trackAddress + "isGroup", track.isGroup(), dump);
    this.sendOSC(trackAddress + "name", track.getName(), dump);
    this.sendOSC(trackAddress + "volumeStr", track.getVolumeStr(), dump);
    this.sendOSC(trackAddress + "volume", track.getVolume(), dump);
    this.sendOSC(trackAddress + "panStr", track.getPanStr(), dump);
    this.sendOSC(trackAddress + "pan", track.getPan(), dump);
    this.sendOSC(trackAddress + "mute", track.isMute(), dump);
    this.sendOSC(trackAddress + "solo", track.isSolo(), dump);
    this.sendOSC(trackAddress + "recarm", track.isRecArm(), dump);
    this.sendOSC(trackAddress + "monitor", track.isMonitor(), dump);
    this.sendOSC(trackAddress + "autoMonitor", track.isAutoMonitor(), dump);
    this.sendOSC(trackAddress + "canHoldNotes", track.canHoldNotes(), dump);
    this.sendOSC(trackAddress + "canHoldAudioData", track.canHoldAudioData(), dump);
    this.sendOSC(trackAddress + "position", track.getPosition(), dump);
    for (int i = 0; i < track.getNumSends(); i++) this.flushParameterData(trackAddress + "send/" + (i + 1) + "/", track.getSend(i), dump);
    for (int i = 0; i < track.getNumSlots(); i++) {
        final ISlot slot = track.getSlot(i);
        final String clipAddress = trackAddress + "clip/" + (i + 1) + "/";
        this.sendOSC(clipAddress + "name", slot.getName(), dump);
        this.sendOSC(clipAddress + "isSelected", slot.isSelected(), dump);
        this.sendOSC(clipAddress + "hasContent", slot.hasContent(), dump);
        this.sendOSC(clipAddress + "isPlaying", slot.isPlaying(), dump);
        this.sendOSC(clipAddress + "isRecording", slot.isRecording(), dump);
        this.sendOSC(clipAddress + "isPlayingQueued", slot.isPlayingQueued(), dump);
        this.sendOSC(clipAddress + "isRecordingQueued", slot.isRecordingQueued(), dump);
        this.sendOSC(clipAddress + "isStopQueued", slot.isStopQueued(), dump);
        final double[] color = slot.getColor();
        this.sendOSCColor(clipAddress + "color", color[0], color[1], color[2], dump);
    }
    final double[] color = track.getColor();
    this.sendOSCColor(trackAddress + "color", color[0], color[1], color[2], dump);
    final String crossfadeMode = track.getCrossfadeMode();
    this.sendOSC(trackAddress + "crossfadeMode/A", "A".equals(crossfadeMode), dump);
    this.sendOSC(trackAddress + "crossfadeMode/B", "B".equals(crossfadeMode), dump);
    this.sendOSC(trackAddress + "crossfadeMode/AB", "AB".equals(crossfadeMode), dump);
    this.sendOSC(trackAddress + "vu", this.configuration.isEnableVUMeters() ? track.getVu() : 0, dump);
}
Also used : ISlot(de.mossgrabers.framework.daw.data.ISlot) ChannelType(de.mossgrabers.framework.daw.resource.ChannelType)

Aggregations

ISlot (de.mossgrabers.framework.daw.data.ISlot)25 ITrack (de.mossgrabers.framework.daw.data.ITrack)19 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)7 ISlotBank (de.mossgrabers.framework.daw.data.bank.ISlotBank)5 AbstractConfiguration (de.mossgrabers.framework.configuration.AbstractConfiguration)2 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)2 MaschineConfiguration (de.mossgrabers.controller.ni.maschine.mk3.MaschineConfiguration)1 UnknownCommandException (de.mossgrabers.controller.osc.exception.UnknownCommandException)1 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)1 INoteClip (de.mossgrabers.framework.daw.INoteClip)1 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)1 ICursorTrack (de.mossgrabers.framework.daw.data.ICursorTrack)1 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)1 ChannelType (de.mossgrabers.framework.daw.resource.ChannelType)1 IGraphicsConfiguration (de.mossgrabers.framework.graphics.IGraphicsConfiguration)1 IGraphicsContext (de.mossgrabers.framework.graphics.IGraphicsContext)1 IGraphicsDimensions (de.mossgrabers.framework.graphics.IGraphicsDimensions)1 ModeManager (de.mossgrabers.framework.mode.ModeManager)1 Matcher (java.util.regex.Matcher)1