Reputation: 16062
I am using nAudio on my WPF Application. I have followed their tutorial on How to play mp3 And everything works fine.
However, in their tutorial they mention :
3) In a method – that only needs to be called once, setup the waveOutDevice. In this example we will use WASPI – which is available on Vista and Windows 7. A more detailed discussion on which output device to chose and when, to come latter
waveOutDevice = new WasapiOut(AudioClientShareMode.Shared, 100);
And for some reason, they didn't discuss on how to do that. Anyone has a clue? And if you do know which output device i should use, do i need to check which OS the user has and set output device accordingly or the one for XP will work on
Upvotes: 2
Views: 958
Reputation: 1964
You basically have four options for playing audio with NAudio:
All of them implement IWavePlayer, so once instantiated, using them is pretty much the same for each class - just call Init() and pass in your IWaveProvider. All of them except WasapiOut can be constructed without paramaters, so all you need is:
waveOutDevice = new WaveOut();
Upvotes: 2