I know this might sound like a subjective question, but I need some well-founded opinions on this topic:
In a C#/WPF GUI I need to playback short wave files as a response to user interaction.
The specs are as follows:
Until now I got along quite well with DirectSound (using the Microsoft DirectX SDK), it fits all of the requirements mentioned above. Since Visual Studio 2010 (.Net 4.0), Managed DirectX (MDX) is not supported anymore, and it also disappeared from the latest DirectX SDK.
What are my options now?
I'm really puzzled about which one I should use for a new project. I don't want to dig into a whole new framework just to find out that its limitations prevent me from using it.
Thanks in advance!
Sounds like quite a few of the options will do what you need, but I'll respond to your requirements for NAudio
low latency (immediate start of playback)
No audio library will start "immediately". NAudio can easily work at latencies of around 50ms with the WaveOut APIs. Possibly quicker if you use WASAPI
code should be native C# (.Net 4.0)
NAudio code is native C# & contains wrappers for Windows APIs
must get along with WPF
NAudio works fine with WPF
multiple simultaneous playbacks
Multiple playbacks are supported. You can optionally create a mixer, to have one playback and mix different inputs in and out.
no restrictions on sound buffer manipulation
This is a big advantage of NAudio over some of the other options you mentioned. You have full access to the sample data and can manipulate in any way you like.
guaranteed future (I want to use something that will still have support in a few years.)
There are no guarantees with open source software. But since its open source, there is nothing stopping you fixing bugs yourself. NAudio has been around for 10 years now.
sound player module should be a simple class (= C# code), not an encapsulated dll
Well you could copy the code into your own project, but there are quite a lot of helper classes so you might actually find it easier just to use the DLL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With