Search in sources :

Example 1 with ISlotBank

use of de.mossgrabers.framework.daw.data.bank.ISlotBank 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 2 with ISlotBank

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

the class MixerMode method getKnobValue.

/**
 * {@inheritDoc}
 */
@Override
public int getKnobValue(final int index) {
    // Note: Since we need multiple value (more than 8), index is the MIDI CC of the knob
    final IValueChanger valueChanger = this.model.getValueChanger();
    if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME && index < KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME + 8) {
        final ITrack track = this.bank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME);
        return valueChanger.toMidiValue(track.getVolume());
    }
    if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_PAN && index < KontrolProtocolControlSurface.KONTROL_TRACK_PAN + 8) {
        final ITrack track = this.bank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_PAN);
        return valueChanger.toMidiValue(track.getPan());
    }
    final Optional<ITrack> selectedTrack = this.bank.getSelectedItem();
    final int scrollTracksState = (this.bank.canScrollBackwards() ? 1 : 0) + (this.bank.canScrollForwards() ? 2 : 0);
    int scrollClipsState = 0;
    if (selectedTrack.isPresent()) {
        final ISlotBank slotBank = selectedTrack.get().getSlotBank();
        scrollClipsState = (slotBank.canScrollBackwards() ? 1 : 0) + (slotBank.canScrollForwards() ? 2 : 0);
    }
    final ISceneBank sceneBank = this.model.getSceneBank();
    final int scrollScenesState = (sceneBank.canScrollBackwards() ? 1 : 0) + (sceneBank.canScrollForwards() ? 2 : 0);
    final KontrolProtocolConfiguration configuration = this.surface.getConfiguration();
    switch(index) {
        case KontrolProtocolControlSurface.KONTROL_NAVIGATE_BANKS:
            return (this.bank.canScrollPageBackwards() ? 1 : 0) + (this.bank.canScrollPageForwards() ? 2 : 0);
        case KontrolProtocolControlSurface.KONTROL_NAVIGATE_TRACKS:
            if (configuration.isFlipTrackClipNavigation())
                return configuration.isFlipClipSceneNavigation() ? scrollScenesState : scrollClipsState;
            return scrollTracksState;
        case KontrolProtocolControlSurface.KONTROL_NAVIGATE_CLIPS:
            if (configuration.isFlipTrackClipNavigation())
                return scrollTracksState;
            return configuration.isFlipClipSceneNavigation() ? scrollScenesState : scrollClipsState;
        default:
            return 0;
    }
}
Also used : ISlotBank(de.mossgrabers.framework.daw.data.bank.ISlotBank) ISceneBank(de.mossgrabers.framework.daw.data.bank.ISceneBank) ITrack(de.mossgrabers.framework.daw.data.ITrack) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) KontrolProtocolConfiguration(de.mossgrabers.controller.ni.kontrol.mkii.KontrolProtocolConfiguration)

Example 3 with ISlotBank

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

Example 4 with ISlotBank

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

the class PageCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (event != ButtonEvent.DOWN)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    final Modes mode = modeManager.getActiveID();
    switch(mode) {
        case DEVICE_PARAMS:
            final ICursorDevice cursorDevice = this.model.getCursorDevice();
            if (this.direction == Direction.LEFT)
                cursorDevice.selectPrevious();
            else
                cursorDevice.selectNext();
            this.mvHelper.notifySelectedDevice();
            break;
        case USER:
            final IParameterBank userBank = this.model.getUserParameterBank();
            if (this.direction == Direction.LEFT)
                userBank.selectPreviousPage();
            else
                userBank.selectNextPage();
            this.mvHelper.notifySelectedUserPage();
            break;
        case BROWSER:
            if (this.direction == Direction.LEFT)
                this.model.getBrowser().previousContentType();
            else
                this.model.getBrowser().nextContentType();
            break;
        default:
            final ITrack cursorTrack = this.model.getCursorTrack();
            if (!cursorTrack.doesExist())
                return;
            final ISlotBank slotBank = cursorTrack.getSlotBank();
            if (this.direction == Direction.LEFT) {
                if (this.surface.isShiftPressed()) {
                    this.surface.setStopConsumed();
                    slotBank.selectPreviousPage();
                } else
                    slotBank.selectPreviousItem();
            } else {
                if (this.surface.isShiftPressed()) {
                    this.surface.setStopConsumed();
                    slotBank.selectNextPage();
                } else
                    slotBank.selectNextItem();
            }
            break;
    }
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ISlotBank(de.mossgrabers.framework.daw.data.bank.ISlotBank) ITrack(de.mossgrabers.framework.daw.data.ITrack) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 5 with ISlotBank

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

the class SessionView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final ITrackBank tb = this.model.getCurrentTrackBank();
    for (int x = 0; x < 8; x++) {
        final ITrack t = tb.getItem(x);
        final ISlotBank slotBank = t.getSlotBank();
        for (int y = 0; y < 8; y++) this.drawPad(slotBank.getItem(y), x, y, t.isRecArm());
    }
}
Also used : ISlotBank(de.mossgrabers.framework.daw.data.bank.ISlotBank) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank)

Aggregations

ISlotBank (de.mossgrabers.framework.daw.data.bank.ISlotBank)10 ITrack (de.mossgrabers.framework.daw.data.ITrack)9 ISlot (de.mossgrabers.framework.daw.data.ISlot)5 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)2 KontrolProtocolConfiguration (de.mossgrabers.controller.ni.kontrol.mkii.KontrolProtocolConfiguration)1 UnknownCommandException (de.mossgrabers.controller.osc.exception.UnknownCommandException)1 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)1 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)1 INoteClip (de.mossgrabers.framework.daw.INoteClip)1 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)1 ICursorTrack (de.mossgrabers.framework.daw.data.ICursorTrack)1 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)1 ISceneBank (de.mossgrabers.framework.daw.data.bank.ISceneBank)1 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)1 Modes (de.mossgrabers.framework.mode.Modes)1 FrameworkException (de.mossgrabers.framework.utils.FrameworkException)1