use of de.mossgrabers.mcu.controller.MCUDisplay in project DrivenByMoss by git-moss.
the class MCUControllerSetup method createSurface.
/**
* {@inheritDoc}
*/
@Override
protected void createSurface() {
final IMidiAccess midiAccess = this.factory.createMidiAccess();
for (int i = 0; i < this.numMCUDevices; i++) {
final IMidiOutput output = midiAccess.createOutput(i);
final IMidiInput input = midiAccess.createInput(i, null);
final MCUControlSurface surface = new MCUControlSurface(this.surfaces, this.model.getHost(), this.colorManager, this.configuration, output, input, 8 * (this.numMCUDevices - i - 1), i == 0);
this.surfaces.add(surface);
surface.setDisplay(new MCUDisplay(this.model.getHost(), output, true, false));
surface.setSecondDisplay(new MCUDisplay(this.model.getHost(), output, false, i == 0));
surface.setSegmentDisplay(new MCUSegmentDisplay(output));
surface.getModeManager().setDefaultMode(Modes.MODE_VOLUME);
}
}
use of de.mossgrabers.mcu.controller.MCUDisplay 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();
}
});
}
Aggregations