Search in sources :

Example 6 with ISlot

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

the class ControlMode method sendClipData.

/**
 * Send clip data.
 *
 * @param d The display
 * @param isMPC Is it MPC or Force?
 * @param trackIndex The index of the track to which the clips belong
 * @param slotBank The bank containing the clips
 */
private void sendClipData(final ACVSDisplay d, final boolean isMPC, final int trackIndex, final ISlotBank slotBank) {
    // Clips on the screen
    for (int clipIndex = 0; clipIndex < 8; clipIndex++) {
        final ISlot slot = slotBank.getItem(clipIndex);
        final int position = clipIndex * 8 + trackIndex;
        final int slotState = convertSlotState(slot);
        d.setRow(ACVSDisplay.ITEM_ID_CLIPS_FIRST + position, slot.getName());
        d.setScreenItem(ScreenItem.get(ScreenItem.CLIP1_STATE, position), slotState);
        // Clip colors can alternatively set with CC from the color palette:
        // <pre>d.setScreenItem (ScreenItem.get (ScreenItem.CLIP1_COLOR, position),
        // slotColor);</pre>
        d.setColor(ACVSDisplay.ITEM_ID_CLIPS_FIRST + position, slot.getColor());
    }
    // Progress currently not supported in the API
    d.setScreenItem(ScreenItem.get(ScreenItem.TRACK1_CLIP_PROGRESS, trackIndex), 0);
    // Set pad colors and state representing clips
    if (!this.surface.getConfiguration().isLaunchClips())
        return;
    for (int clipIndex = 0; clipIndex < 8; clipIndex++) {
        final ISlot slot = slotBank.getItem(clipIndex);
        final int position = clipIndex * 8 + trackIndex;
        final int slotState = convertSlotState(slot);
        final int slotColor = this.convertSlotStateToColor(slot);
        if (isMPC) {
            d.setScreenItem(ScreenItem.get(ScreenItem.MPC_PAD1_STATE, position), slotState);
            d.setScreenItem(ScreenItem.get(ScreenItem.MPC_PAD1_COLOR, position), slotColor);
        } else {
            d.setScreenItem(ScreenItem.get(ScreenItem.FORCE_PAD1_STATE, position), slotState);
            d.setScreenItem(ScreenItem.get(ScreenItem.FORCE_PAD1_COLOR, position), slotColor);
        }
    }
}
Also used : ISlot(de.mossgrabers.framework.daw.data.ISlot)

Example 7 with ISlot

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

the class AbstractSessionView method onGridNote.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNote(final int note, final int velocity) {
    // Trigger on pad release to intercept long presses
    if (velocity != 0)
        return;
    final Pair<Integer, Integer> padPos = this.getPad(note);
    final ITrack track = this.model.getCurrentTrackBank().getItem(padPos.getKey().intValue());
    final ISlot slot = track.getSlotBank().getItem(padPos.getValue().intValue());
    if (this.handleButtonCombinations(track, slot))
        return;
    if (this.surface.isSelectPressed()) {
        slot.select();
        if (slot.hasContent()) {
            final String slotName = slot.getName();
            if (!slotName.isBlank())
                this.surface.getDisplay().notify(slotName);
        }
        return;
    }
    if (this.doSelectClipOnLaunch())
        slot.select();
    if (!track.isRecArm() || slot.hasContent()) {
        slot.launch();
        return;
    }
    final C configuration = this.surface.getConfiguration();
    switch(configuration.getActionForRecArmedPad()) {
        case 0:
            this.model.recordNoteClip(track, slot);
            break;
        case 1:
            final int lengthInBeats = configuration.getNewClipLenghthInBeats(this.model.getTransport().getQuartersPerMeasure());
            this.model.createNoteClip(track, slot, lengthInBeats, true);
            break;
        case 2:
        default:
            // Do nothing
            break;
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ISlot(de.mossgrabers.framework.daw.data.ISlot)

Example 8 with ISlot

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

the class FootswitchCommand method handleLooper.

/**
 * Handle clip looper.
 *
 * @param event The button event
 */
private void handleLooper(final ButtonEvent event) {
    if (event == ButtonEvent.LONG)
        return;
    final ITrack cursorTrack = this.model.getCursorTrack();
    if (!cursorTrack.doesExist()) {
        this.surface.getDisplay().notify("Please select an Instrument track first.");
        return;
    }
    final ISlotBank slotBank = cursorTrack.getSlotBank();
    final Optional<ISlot> selectedSlot = slotBank.getSelectedItem();
    final ISlot slot = selectedSlot.isEmpty() ? slotBank.getItem(0) : selectedSlot.get();
    final boolean isDown = event == ButtonEvent.DOWN;
    if (isDown && !slot.hasContent()) {
        // If there is no clip in the selected slot, create a clip and begin record
        // mode. Releasing it ends record mode.
        this.newCommand.execute();
        slot.select();
    }
    this.model.getTransport().setLauncherOverdub(isDown);
    // Start transport if not already playing
    slot.launch();
}
Also used : ISlotBank(de.mossgrabers.framework.daw.data.bank.ISlotBank) ITrack(de.mossgrabers.framework.daw.data.ITrack) ISlot(de.mossgrabers.framework.daw.data.ISlot)

Example 9 with ISlot

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

the class ConfiguredRecordCommand method isLit.

/**
 * Returns true if the record button should be lit depending on the selected function.
 *
 * @return True if lit
 */
public boolean isLit() {
    final C configuration = this.surface.getConfiguration();
    final AbstractConfiguration.RecordFunction recordMode = this.isShifted() ? configuration.getShiftedRecordButtonFunction() : configuration.getRecordButtonFunction();
    switch(recordMode) {
        case RECORD_ARRANGER:
            return this.model.getTransport().isRecording();
        case NEW_CLIP:
        case RECORD_CLIP:
            final Optional<ISlot> slot = this.model.getSelectedSlot();
            if (slot.isEmpty())
                return false;
            final ISlot s = slot.get();
            return s.isRecording();
        case TOGGLE_ARRANGER_OVERDUB:
            return this.model.getTransport().isArrangerOverdub();
        case TOGGLE_CLIP_OVERDUB:
            return this.model.getTransport().isLauncherOverdub();
        case TOGGLE_REC_ARM:
            final Optional<ITrack> selectedTrack = this.model.getCurrentTrackBank().getSelectedItem();
            return selectedTrack.isPresent() && selectedTrack.get().isRecArm();
        default:
            return false;
    }
}
Also used : AbstractConfiguration(de.mossgrabers.framework.configuration.AbstractConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) ISlot(de.mossgrabers.framework.daw.data.ISlot)

Example 10 with ISlot

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

the class ClipView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final IPadGrid padGrid = this.surface.getPadGrid();
    final Optional<ITrack> selectedTrack = this.model.getCurrentTrackBank().getSelectedItem();
    if (selectedTrack.isEmpty())
        return;
    final ISlotBank slotBank = selectedTrack.get().getSlotBank();
    for (int i = 0; i < 16; i++) {
        final ISlot item = slotBank.getItem(i);
        final int x = i % 4;
        final int y = 3 - i / 4;
        if (item.doesExist()) {
            if (item.isRecordingQueued())
                padGrid.lightEx(x, y, MaschineColorManager.COLOR_RED_LO);
            else if (item.isRecording())
                padGrid.lightEx(x, y, MaschineColorManager.COLOR_RED);
            else if (item.isPlayingQueued())
                padGrid.lightEx(x, y, MaschineColorManager.COLOR_GREEN_LO);
            else if (item.isPlaying())
                padGrid.lightEx(x, y, MaschineColorManager.COLOR_GREEN);
            else if (item.isStopQueued())
                padGrid.lightEx(x, y, MaschineColorManager.COLOR_GREEN_LO);
            else
                padGrid.lightEx(x, y, DAWColor.getColorIndex(item.getColor()));
        } else
            padGrid.lightEx(x, y, AbstractFeatureGroup.BUTTON_COLOR_OFF);
    }
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) ISlotBank(de.mossgrabers.framework.daw.data.bank.ISlotBank) ITrack(de.mossgrabers.framework.daw.data.ITrack) ISlot(de.mossgrabers.framework.daw.data.ISlot)

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