Search in sources :

Example 1 with Mode

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

Example 2 with Mode

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();
}
Also used : Mode(de.mossgrabers.framework.mode.Mode)

Example 3 with Mode

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();
}
Also used : BaseMode(de.mossgrabers.push.mode.BaseMode) Mode(de.mossgrabers.framework.mode.Mode) ModeManager(de.mossgrabers.framework.mode.ModeManager) BaseMode(de.mossgrabers.push.mode.BaseMode)

Aggregations

Mode (de.mossgrabers.framework.mode.Mode)3 ModeManager (de.mossgrabers.framework.mode.ModeManager)1 MCUControlSurface (de.mossgrabers.mcu.controller.MCUControlSurface)1 MCUDisplay (de.mossgrabers.mcu.controller.MCUDisplay)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 BaseMode (de.mossgrabers.push.mode.BaseMode)1