Search in sources :

Example 21 with IScene

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

the class SceneView method executeFunction.

/**
 * {@inheritDoc}
 */
@Override
protected void executeFunction(final int padIndex) {
    final IScene scene = this.model.getSceneBank().getItem(padIndex);
    if (this.isButtonCombination(ButtonID.DUPLICATE)) {
        scene.duplicate();
        return;
    }
    if (this.isButtonCombination(ButtonID.DELETE)) {
        scene.remove();
        return;
    }
    if (this.isButtonCombination(ButtonID.SELECT)) {
        scene.select();
        return;
    }
    if (this.surface.getConfiguration().isSelectClipOnLaunch())
        scene.select();
    scene.launch();
}
Also used : IScene(de.mossgrabers.framework.daw.data.IScene)

Example 22 with IScene

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

the class SceneBankImpl method enableObservers.

/**
 * {@inheritDoc}
 */
@Override
public void enableObservers(final boolean enable) {
    for (final IScene scene : this.scenes) scene.enableObservers(enable);
    this.sceneBank.scrollPosition().setIsSubscribed(enable);
    this.sceneBank.canScrollBackwards().setIsSubscribed(enable);
    this.sceneBank.canScrollForwards().setIsSubscribed(enable);
    this.sceneBank.itemCount().setIsSubscribed(enable);
}
Also used : IScene(de.mossgrabers.framework.daw.data.IScene)

Example 23 with IScene

use of de.mossgrabers.framework.daw.data.IScene 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 24 with IScene

use of de.mossgrabers.framework.daw.data.IScene 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 25 with IScene

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

Aggregations

IScene (de.mossgrabers.framework.daw.data.IScene)34 ISceneBank (de.mossgrabers.framework.daw.data.bank.ISceneBank)20 ColorManager (de.mossgrabers.framework.controller.color.ColorManager)2 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)2 ISceneBank (de.mossgrabers.framework.daw.ISceneBank)2 FlexiHandlerException (de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException)1 MaschineColorManager (de.mossgrabers.controller.ni.maschine.core.MaschineColorManager)1 LaunchkeyMiniMk3ColorManager (de.mossgrabers.controller.novation.launchkey.mini.controller.LaunchkeyMiniMk3ColorManager)1 SLMkIIIColorManager (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIColorManager)1 UnknownCommandException (de.mossgrabers.controller.osc.exception.UnknownCommandException)1 Display (de.mossgrabers.framework.controller.display.Display)1 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)1 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)1