use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class SessionView method canScroll.
/**
* {@inheritDoc}
*/
@Override
public boolean canScroll(final Direction direction) {
final boolean flipSession = this.surface.getConfiguration().isFlipSession();
final ITrackBank trackBank = this.model.getCurrentTrackBank();
switch(direction) {
case LEFT:
case RIGHT:
if (flipSession)
return direction == Direction.LEFT ? trackBank.getSceneBank().canScrollPageBackwards() : trackBank.getSceneBank().canScrollPageForwards();
return direction == Direction.LEFT ? trackBank.canScrollPageBackwards() : trackBank.canScrollPageForwards();
case UP:
case DOWN:
if (flipSession)
return direction == Direction.UP ? trackBank.canScrollPageBackwards() : trackBank.canScrollPageForwards();
return direction == Direction.UP ? trackBank.getSceneBank().canScrollPageBackwards() : trackBank.getSceneBank().canScrollPageForwards();
}
return false;
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class OSCControllerSetup method createObservers.
/**
* {@inheritDoc}
*/
@Override
protected void createObservers() {
super.createObservers();
this.configuration.addSettingObserver(OSCConfiguration.RECEIVE_PORT, () -> {
try {
final int receivePort = this.configuration.getReceivePort();
if (receivePort == this.configuration.getSendPort()) {
final String message = "Could not start OSC server. OSC send and receive port must be different! Both are: " + receivePort;
this.host.showNotification(message);
this.host.println(message);
return;
}
this.oscServer.start(receivePort);
this.host.println("Started OSC server on port " + receivePort + ".");
} catch (final IOException ex) {
this.host.error("Could not start OSC server.", ex);
}
});
final ITrackBank tb = this.model.getTrackBank();
tb.addSelectionObserver((final int index, final boolean isSelected) -> this.keyManager.clearPressedKeys());
tb.addNoteObserver(this.keyManager);
this.configuration.registerDeactivatedItemsHandler(this.model);
this.configuration.addSettingObserver(OSCConfiguration.VALUE_RESOLUTION, () -> {
switch(this.configuration.getValueResolution()) {
case LOW:
this.valueChanger.setUpperBound(128);
this.valueChanger.setStepSize(1);
break;
case MEDIUM:
this.valueChanger.setUpperBound(1024);
this.valueChanger.setStepSize(8);
break;
case HIGH:
this.valueChanger.setUpperBound(16384);
this.valueChanger.setStepSize(128);
break;
}
});
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class AbstractTrackMode method onButton.
/**
* {@inheritDoc}
*/
@Override
public void onButton(final int row, final int index, final ButtonEvent event) {
if (event != ButtonEvent.UP || row != 0)
return;
// Combination with Shift
if (this.surface.isShiftPressed()) {
this.onButtonShifted(index);
return;
}
// Combination with Arrow Down
if (this.surface.isLongPressed(ButtonID.ARROW_DOWN)) {
this.surface.getModeManager().setActive(MODES[index]);
this.surface.setTriggerConsumed(ButtonID.ARROW_DOWN);
return;
}
final ITrackBank tb = this.model.getCurrentTrackBank();
final ITrack track = tb.getItem(index);
// Combination with Duplicate
if (this.surface.isPressed(ButtonID.DUPLICATE)) {
this.surface.setTriggerConsumed(ButtonID.DUPLICATE);
track.duplicate();
return;
}
// Combination with Delete
if (this.surface.isPressed(ButtonID.DELETE)) {
this.surface.setTriggerConsumed(ButtonID.DELETE);
track.remove();
return;
}
// Select track or expand group
track.selectOrExpandGroup();
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class SLMkIIIVolumeMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final SLMkIIIDisplay d = this.surface.getDisplay();
d.clear();
d.setCell(0, 8, "Volume");
final ITrackBank tb = this.model.getCurrentTrackBank();
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getItem(i);
if (t.doesExist())
d.setCell(0, i, "Volume").setCell(1, i, t.getVolumeStr(9));
this.setColumnColors(d, i, t, SLMkIIIColorManager.SLMKIII_BLUE);
}
final ITrack cursorTrack = this.model.getCursorTrack();
d.setCell(1, 8, cursorTrack.doesExist() ? StringUtils.fixASCII(cursorTrack.getName(9)) : "");
this.drawRow4();
this.setButtonInfo(d);
d.allDone();
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class AutoColorSetup method createObservers.
/**
* {@inheritDoc}
*/
@Override
protected void createObservers() {
super.createObservers();
// Update track colors if Auto Color is enabled in the settings
this.configuration.addSettingObserver(AutoColorConfiguration.ENABLE_AUTO_COLOR, () -> {
if (!this.configuration.isEnableAutoColor())
return;
final ITrackBank tb = this.model.getTrackBank();
for (int i = 0; i < tb.getPageSize(); i++) this.autoColor.matchTrackName(i, tb.getItem(i).getName());
});
// Monitor all color regular expression settings
final DAWColor[] colors = DAWColor.values();
for (int i = 0; i < colors.length; i++) {
final DAWColor color = colors[i];
this.configuration.addSettingObserver(Integer.valueOf(AutoColorConfiguration.COLOR_REGEX.intValue() + i), () -> this.autoColor.handleRegExChange(color, this.configuration.getColorRegExValue(color)));
}
// Add name observers to all tracks
final ITrackBank tb = this.model.getTrackBank();
for (int index = 0; index < tb.getPageSize(); index++) {
final int i = index;
final ITrack track = tb.getItem(index);
track.addNameObserver(name -> this.autoColor.matchTrackName(i, name));
track.addColorObserver(name -> this.autoColor.matchTrackName(i, track.getName()));
}
}
Aggregations