/// <summary> /// Plays the sound. /// </summary> /// <param name="source">The WaveSource.</param> private void Play(IWaveSource source) { Stop(); var panSource = new PanSource(source); _panSource = panSource; _directSoundOut.Initialize(panSource.ToWaveSource()); _directSoundOut.Play(); }
/// <summary> /// Plays the wave source. /// </summary> /// <param name="waveSource">The WaveSource.</param> internal void Play(IWaveSource waveSource) { var panSource = new PanSource(waveSource); _panSource = panSource; _currentWaveSource = panSource.ToWaveSource(); _sourceVoice = StreamingSourceVoice.Create(_xaudio2, _currentWaveSource); StreamingSourceVoiceListener.Default.Add(_sourceVoice); _playbackState = PlaybackState.Playing; IsPlaying = true; if (PlaybackChanged != null) PlaybackChanged(this, EventArgs.Empty); }