Search in sources :

Example 21 with ISceneBank

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

the class ControlMode method sendSceneData.

/**
 * Set pad colors and state representing scenes.
 *
 * @param d The display
 * @param isMPC Is it MPC or Force?
 */
private void sendSceneData(final ACVSDisplay d, final boolean isMPC) {
    final ISceneBank sceneBank = this.model.getSceneBank();
    for (int sceneIndex = 0; sceneIndex < 8; sceneIndex++) {
        // Scenes on the screen
        final IScene scene = sceneBank.getItem(sceneIndex);
        d.setRow(ACVSDisplay.ITEM_ID_SCENES_FIRST + sceneIndex, scene.getName());
        d.setColor(ACVSDisplay.ITEM_ID_SCENES_FIRST + sceneIndex, scene.getColor());
        d.setScreenItem(ScreenItem.get(ScreenItem.SCENE1_SELECT, sceneIndex), scene.isSelected() ? 127 : 0);
    }
    if (isMPC) {
        // Scene on pads
        if (this.surface.getConfiguration().isLaunchClips())
            return;
        for (int sceneIndex = 0; sceneIndex < 8; sceneIndex++) {
            final IScene scene = sceneBank.getItem(sceneIndex);
            final int sceneColor = scene.doesExist() ? this.colorManager.getColorIndex(DAWColor.getColorIndex(scene.getColor())) : ACVSColorManager.COLOR_BLACK;
            final int offset = sceneIndex < 4 ? 0 : 4;
            d.setScreenItem(ScreenItem.get(ScreenItem.MPC_PAD1_STATE, offset + sceneIndex), 2);
            d.setScreenItem(ScreenItem.get(ScreenItem.MPC_PAD1_COLOR, offset + sceneIndex), sceneColor);
        }
        for (int padIndex = 0; padIndex < 4; padIndex++) {
            d.setScreenItem(ScreenItem.get(ScreenItem.MPC_PAD1_STATE, 16 + padIndex), 0);
            d.setScreenItem(ScreenItem.get(ScreenItem.MPC_PAD1_COLOR, 16 + padIndex), ACVSColorManager.COLOR_BLACK);
            d.setScreenItem(ScreenItem.get(ScreenItem.MPC_PAD1_STATE, 24 + padIndex), 0);
            d.setScreenItem(ScreenItem.get(ScreenItem.MPC_PAD1_COLOR, 24 + padIndex), ACVSColorManager.COLOR_BLACK);
        }
        return;
    }
    for (int sceneIndex = 0; sceneIndex < 8; sceneIndex++) {
        final IScene scene = sceneBank.getItem(sceneIndex);
        int color = 0;
        if (scene.doesExist())
            color = scene.isSelected() ? 1 : 2;
        d.setScreenItem(ScreenItem.get(ScreenItem.FORCE_SCENE1, sceneIndex), color);
    }
}
Also used : ISceneBank(de.mossgrabers.framework.daw.data.bank.ISceneBank) IScene(de.mossgrabers.framework.daw.data.IScene)

Example 22 with ISceneBank

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

the class SessionView method getButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getButtonColor(final ButtonID buttonID) {
    final int scene = buttonID.ordinal() - ButtonID.SCENE1.ordinal();
    if (scene < 0 || scene >= 4)
        return 0;
    final ISceneBank sceneBank = this.model.getSceneBank();
    final IScene s = sceneBank.getItem(scene);
    if (!s.doesExist())
        return 0;
    return this.surface.isPressed(buttonID) ? 2 : 1;
}
Also used : ISceneBank(de.mossgrabers.framework.daw.data.bank.ISceneBank) IScene(de.mossgrabers.framework.daw.data.IScene)

Example 23 with ISceneBank

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

the class SessionView method onSelectKnobValue.

/**
 * {@inheritDoc}
 */
@Override
public void onSelectKnobValue(final int value) {
    final ISceneBank sceneBank = this.model.getSceneBank();
    if (this.model.getValueChanger().isIncrease(value)) {
        if (this.surface.isPressed(ButtonID.SELECT)) {
            if (sceneBank.canScrollPageForwards()) {
                sceneBank.selectNextPage();
                return;
            }
            final int positionOfLastItem = sceneBank.getPositionOfLastItem();
            if (positionOfLastItem >= 0) {
                final int index = positionOfLastItem % sceneBank.getPageSize();
                final IScene lastItem = sceneBank.getItem(index);
                if (!lastItem.isSelected())
                    lastItem.select();
            }
            return;
        }
        sceneBank.scrollForwards();
        this.model.getHost().scheduleTask(() -> {
            this.surface.println("Pos: " + sceneBank.getScrollPosition());
            this.surface.println("Track 1 Pos: " + this.model.getTrackBank().getItem(0).getSlotBank().getScrollPosition());
            this.surface.println("CurTrack Pos: " + this.model.getCursorTrack().getSlotBank().getScrollPosition());
        }, 100);
        return;
    }
    if (this.surface.isPressed(ButtonID.SELECT)) {
        if (sceneBank.canScrollPageBackwards()) {
            sceneBank.selectPreviousPage();
            return;
        }
        final IScene firstItem = sceneBank.getItem(0);
        if (!firstItem.isSelected())
            firstItem.select();
        return;
    }
    sceneBank.scrollBackwards();
}
Also used : ISceneBank(de.mossgrabers.framework.daw.data.bank.ISceneBank) IScene(de.mossgrabers.framework.daw.data.IScene)

Example 24 with ISceneBank

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

the class SessionView method getSoloButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getSoloButtonColor(final int index) {
    final ISceneBank sceneBank = this.model.getSceneBank();
    final IScene s = sceneBank.getItem(index);
    return s.doesExist() && s.isSelected() ? 4 : 0;
}
Also used : ISceneBank(de.mossgrabers.framework.daw.data.bank.ISceneBank) IScene(de.mossgrabers.framework.daw.data.IScene)

Example 25 with ISceneBank

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

the class SceneModule method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final String command, final LinkedList<String> path, final Object value) throws IllegalParameterException, UnknownCommandException, MissingCommandException {
    if (!"scene".equals(command))
        throw new UnknownCommandException(command);
    final String sceneCommand = getSubCommand(path);
    final ISceneBank sceneBank = this.model.getCurrentTrackBank().getSceneBank();
    switch(sceneCommand) {
        case "bank":
            final String subCommand2 = getSubCommand(path);
            switch(subCommand2) {
                case "+":
                    if (isTrigger(value))
                        sceneBank.selectNextPage();
                    break;
                case "-":
                    if (isTrigger(value))
                        sceneBank.selectPreviousPage();
                    break;
                default:
                    throw new UnknownCommandException(subCommand2);
            }
            break;
        case "+":
            if (isTrigger(value))
                sceneBank.scrollForwards();
            break;
        case "-":
            if (isTrigger(value))
                sceneBank.scrollBackwards();
            break;
        case "create":
            if (isTrigger(value))
                this.model.getProject().createSceneFromPlayingLauncherClips();
            break;
        case "add":
            if (isTrigger(value))
                this.model.getProject().createScene();
            break;
        default:
            final int sceneIndex = Integer.parseInt(sceneCommand);
            final IScene scene = sceneBank.getItem(sceneIndex - 1);
            final String sceneCommand2 = getSubCommand(path);
            switch(sceneCommand2) {
                case "launch":
                    scene.launch();
                    break;
                case TAG_DUPLICATE:
                    scene.duplicate();
                    break;
                case TAG_REMOVE:
                    scene.remove();
                    break;
                default:
                    throw new UnknownCommandException(sceneCommand2);
            }
            break;
    }
}
Also used : ISceneBank(de.mossgrabers.framework.daw.data.bank.ISceneBank) IScene(de.mossgrabers.framework.daw.data.IScene) UnknownCommandException(de.mossgrabers.controller.osc.exception.UnknownCommandException)

Aggregations

ISceneBank (de.mossgrabers.framework.daw.data.bank.ISceneBank)28 IScene (de.mossgrabers.framework.daw.data.IScene)20 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)5 ColorManager (de.mossgrabers.framework.controller.color.ColorManager)2 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)2 ITrack (de.mossgrabers.framework.daw.data.ITrack)2 KontrolProtocolConfiguration (de.mossgrabers.controller.ni.kontrol.mkii.KontrolProtocolConfiguration)1 LaunchkeyMk3ColorManager (de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3ColorManager)1 LaunchkeyMiniMk3ColorManager (de.mossgrabers.controller.novation.launchkey.mini.controller.LaunchkeyMiniMk3ColorManager)1 UnknownCommandException (de.mossgrabers.controller.osc.exception.UnknownCommandException)1 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)1 LightInfo (de.mossgrabers.framework.controller.grid.LightInfo)1 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)1 ISlotBank (de.mossgrabers.framework.daw.data.bank.ISlotBank)1 IMode (de.mossgrabers.framework.featuregroup.IMode)1 Modes (de.mossgrabers.framework.mode.Modes)1