use of de.mossgrabers.framework.mode.Mode in project DrivenByMoss by git-moss.
the class MCUControllerSetup method createObservers.
/**
* {@inheritDoc}
*/
@Override
protected void createObservers() {
for (int index = 0; index < this.numMCUDevices; index++) {
final MCUControlSurface surface = this.getSurface(index);
surface.getModeManager().addModeListener((oldMode, newMode) -> {
for (int d = 0; d < this.numMCUDevices; d++) {
final MCUControlSurface s = this.getSurface(d);
if (!s.equals(surface))
s.getModeManager().setActiveMode(newMode);
}
this.updateMode(null);
this.updateMode(newMode);
});
}
this.configuration.addSettingObserver(AbstractConfiguration.ENABLE_VU_METERS, () -> {
for (int index = 0; index < this.numMCUDevices; index++) {
final MCUControlSurface surface = this.getSurface(index);
surface.switchVuMode(this.configuration.isEnableVUMeters() ? MCUControlSurface.VUMODE_LED_AND_LCD : MCUControlSurface.VUMODE_OFF);
final Mode activeMode = surface.getModeManager().getActiveMode();
if (activeMode != null)
activeMode.updateDisplay();
((MCUDisplay) surface.getDisplay()).forceFlush();
}
});
}
use of de.mossgrabers.framework.mode.Mode in project DrivenByMoss by git-moss.
the class AbstractView method updateControlSurface.
/**
* {@inheritDoc}
*/
@Override
public void updateControlSurface() {
final Mode m = this.surface.getModeManager().getActiveMode();
if (m != null) {
m.updateDisplay();
m.updateFirstRow();
m.updateSecondRow();
}
this.updateButtons();
this.updateArrows();
}
use of de.mossgrabers.framework.mode.Mode in project DrivenByMoss by git-moss.
the class SmallKnobTouchCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
final boolean isTouched = event == ButtonEvent.DOWN;
// Avoid accidentally leaving the browser
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_BROWSER))
return;
// Prevent flickering if a knob is touched accidentally while fiddling with other knobs
final Mode activeMode = modeManager.getActiveMode();
if (activeMode instanceof BaseMode && ((BaseMode) activeMode).isAKnobTouched())
return;
this.model.getTransport().setTempoIndication(isTouched);
if (isTouched)
modeManager.setActiveMode(Modes.MODE_TRANSPORT);
else
modeManager.restoreMode();
}
Aggregations