public PlaybackViewModel(AudioOutput.IPlaybackDevice playback, MidiInput.IMidiInput midiIn) { StartCommand = ReactiveCommand.Create(() => { playback.Start(midiIn.MidiData); midiIn.Start(); }, playback.PlayState.Select(x => x != AudioOutput.PlayState.Playing)); StopCommand = ReactiveCommand.Create(() => { playback.Stop(); midiIn.Stop(); }, playback.PlayState.Select(x => x == AudioOutput.PlayState.Playing)); playback.Stop(); }
public AudioSetupViewModel(AudioOutput.IAudioDevices devices, AudioOutput.IPlaybackDevice device) { this.devices = devices; isEnabled = device.PlayState.Select(x => x != AudioOutput.PlayState.Playing).ToProperty(this, x => x.IsEnabled); }