Search in sources :

Example 16 with MaschineControlSurface

use of de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface in project DrivenByMoss by git-moss.

the class MaschineControllerSetup method flush.

/**
 * {@inheritDoc}
 */
@Override
public void flush() {
    super.flush();
    final MaschineControlSurface surface = this.getSurface();
    final TouchstripCommand command = (TouchstripCommand) surface.getContinuous(ContinuousID.CROSSFADER).getCommand();
    if (command != null)
        command.updateValue();
    if (this.maschine == Maschine.STUDIO) {
        // Update main VU
        final IMidiOutput midiOutput = surface.getMidiOutput();
        final int value;
        if (this.encoderManager.isParameterMode()) {
            final EncoderMode activeEncoderMode = this.encoderManager.getActiveEncoderMode();
            switch(activeEncoderMode) {
                case MASTER_VOLUME:
                    value = this.valueChanger.toMidiValue(this.model.getMasterTrack().getVolume());
                    break;
                case MASTER_PANORAMA:
                    value = this.valueChanger.toMidiValue(this.model.getMasterTrack().getPan());
                    break;
                case SELECTED_TRACK_VOLUME:
                case SELECTED_TRACK_PANORAMA:
                    final ITrack track;
                    final Optional<ITrack> trackOptional = this.model.getTrackBank().getSelectedItem();
                    if (trackOptional.isPresent())
                        track = trackOptional.get();
                    else
                        track = EmptyTrack.INSTANCE;
                    value = this.valueChanger.toMidiValue(activeEncoderMode == EncoderMode.SELECTED_TRACK_VOLUME ? track.getVolume() : track.getPan());
                    break;
                case CUE_VOLUME:
                    value = this.valueChanger.toMidiValue(this.model.getProject().getCueVolume());
                    break;
                case CUE_MIX:
                    value = this.valueChanger.toMidiValue(this.model.getProject().getCueMix());
                    break;
                case METRONOME_VOLUME:
                    value = this.valueChanger.toMidiValue(this.model.getTransport().getMetronomeVolume());
                    break;
                default:
                    value = 0;
                    break;
            }
        } else {
            final ITrack track;
            if (this.encoderManager.isActiveEncoderMode(EncoderMode.SELECTED_TRACK_VOLUME)) {
                final Optional<ITrack> trackOptional = this.model.getTrackBank().getSelectedItem();
                if (trackOptional.isPresent())
                    track = trackOptional.get();
                else
                    track = EmptyTrack.INSTANCE;
            } else
                track = this.model.getMasterTrack();
            value = this.valueChanger.toMidiValue(track.getVu());
        }
        midiOutput.sendCC(MaschineControlSurface.MONITOR_ENCODER, value);
    }
}
Also used : EncoderMode(de.mossgrabers.controller.ni.maschine.core.command.trigger.EncoderMode) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) ITrack(de.mossgrabers.framework.daw.data.ITrack) MaschineControlSurface(de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface) TouchstripCommand(de.mossgrabers.controller.ni.maschine.mk3.command.continuous.TouchstripCommand)

Aggregations

MaschineControlSurface (de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface)14 StudioEncoderModeManager (de.mossgrabers.controller.ni.maschine.mk3.controller.StudioEncoderModeManager)4 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)4 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)4 IMidiOutput (de.mossgrabers.framework.daw.midi.IMidiOutput)3 TouchstripCommand (de.mossgrabers.controller.ni.maschine.mk3.command.continuous.TouchstripCommand)2 DrumView (de.mossgrabers.controller.ni.maschine.mk3.view.DrumView)2 ITrack (de.mossgrabers.framework.daw.data.ITrack)2 IMidiInput (de.mossgrabers.framework.daw.midi.IMidiInput)2 IMode (de.mossgrabers.framework.featuregroup.IMode)2 MCUDisplay (de.mossgrabers.controller.mackie.mcu.controller.MCUDisplay)1 EncoderMode (de.mossgrabers.controller.ni.maschine.core.command.trigger.EncoderMode)1 MaschineMonitorEncoderCommand (de.mossgrabers.controller.ni.maschine.core.command.trigger.MaschineMonitorEncoderCommand)1 MainKnobRowModeCommand (de.mossgrabers.controller.ni.maschine.mk3.command.continuous.MainKnobRowModeCommand)1 AddDeviceCommand (de.mossgrabers.controller.ni.maschine.mk3.command.trigger.AddDeviceCommand)1 KeyboardCommand (de.mossgrabers.controller.ni.maschine.mk3.command.trigger.KeyboardCommand)1 MaschineCursorCommand (de.mossgrabers.controller.ni.maschine.mk3.command.trigger.MaschineCursorCommand)1 MaschineSelectButtonCommand (de.mossgrabers.controller.ni.maschine.mk3.command.trigger.MaschineSelectButtonCommand)1 MaschineSendSelectCommand (de.mossgrabers.controller.ni.maschine.mk3.command.trigger.MaschineSendSelectCommand)1 MaschineStopCommand (de.mossgrabers.controller.ni.maschine.mk3.command.trigger.MaschineStopCommand)1