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