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);
}
}
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;
}
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();
}
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;
}
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;
}
}
Aggregations