Search in sources :

Example 1 with MCUDisplay

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);
    }
}
Also used : IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) MCUDisplay(de.mossgrabers.mcu.controller.MCUDisplay) MCUSegmentDisplay(de.mossgrabers.mcu.controller.MCUSegmentDisplay) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) MCUControlSurface(de.mossgrabers.mcu.controller.MCUControlSurface)

Example 2 with MCUDisplay

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();
        }
    });
}
Also used : MCUDisplay(de.mossgrabers.mcu.controller.MCUDisplay) TrackMode(de.mossgrabers.mcu.mode.track.TrackMode) VolumeMode(de.mossgrabers.mcu.mode.track.VolumeMode) PanMode(de.mossgrabers.mcu.mode.track.PanMode) Mode(de.mossgrabers.framework.mode.Mode) DeviceParamsMode(de.mossgrabers.mcu.mode.device.DeviceParamsMode) DeviceBrowserMode(de.mossgrabers.mcu.mode.device.DeviceBrowserMode) SendMode(de.mossgrabers.mcu.mode.track.SendMode) MasterMode(de.mossgrabers.mcu.mode.track.MasterMode) MCUControlSurface(de.mossgrabers.mcu.controller.MCUControlSurface)

Aggregations

MCUControlSurface (de.mossgrabers.mcu.controller.MCUControlSurface)2 MCUDisplay (de.mossgrabers.mcu.controller.MCUDisplay)2 IMidiAccess (de.mossgrabers.framework.daw.midi.IMidiAccess)1 IMidiInput (de.mossgrabers.framework.daw.midi.IMidiInput)1 IMidiOutput (de.mossgrabers.framework.daw.midi.IMidiOutput)1 Mode (de.mossgrabers.framework.mode.Mode)1 MCUSegmentDisplay (de.mossgrabers.mcu.controller.MCUSegmentDisplay)1 DeviceBrowserMode (de.mossgrabers.mcu.mode.device.DeviceBrowserMode)1 DeviceParamsMode (de.mossgrabers.mcu.mode.device.DeviceParamsMode)1 MasterMode (de.mossgrabers.mcu.mode.track.MasterMode)1 PanMode (de.mossgrabers.mcu.mode.track.PanMode)1 SendMode (de.mossgrabers.mcu.mode.track.SendMode)1 TrackMode (de.mossgrabers.mcu.mode.track.TrackMode)1 VolumeMode (de.mossgrabers.mcu.mode.track.VolumeMode)1