示例#1
0
        public NAudioMediaPlayer(ILoggingService log, IMessenger messenger, AudioDevices audioDevices, IWavePlayerFactory factory)
            : base(messenger, audioDevices)
        {
            _settings = new MediaFoundationReader.MediaFoundationReaderSettings
            {
                RepositionInRead   = true,
                SingleReaderObject = false,
                RequestFloatOutput = false,
            };

            _player = factory.GetPlayer(log);
            _player.PlaybackStopped += PlaybackStopped;

            _messenger.Subscribe <PlayingMediaItemMessage>(OnPlaybackStarted);

            OnPropertyChanged(nameof(VolumeMin));
            OnPropertyChanged(nameof(VolumeMax));
        }
示例#2
0
        public NAudioMediaPlayer(IMapleLog log) : base()
        {
            _log      = log;
            _settings = new MediaFoundationReader.MediaFoundationReaderSettings
            {
                RepositionInRead   = true,
                SingleReaderObject = false,
                RequestFloatOutput = false,
            };

            AudioDeviceChanging += OnAudioDeviceChanging;
            AudioDeviceChanged  += OnAudioDeviceChanged;

            _player = WavePlayerFactory.GetPlayer();
            _player.PlaybackStopped += PlaybackStopped;

            PlayingMediaItem += OnPlaybackStarted;

            OnPropertyChanged(nameof(VolumeMin));
            OnPropertyChanged(nameof(VolumeMax));
        }