IWavePlayer Volume property alternative?

Jun 18, 2011 at 10:29 AM

Volume property of IWavePlayer is marked obsolete. There is Volume property in WaveOut class though.
I was using WaveOut via the interface until I wanted to adjust the volume; after which I had to switch to concrete reference instead of interface.
What is the new way of adjusting volume while still using IWavePlayer abstraction? And why was it marked obsolete?

Jun 19, 2011 at 7:04 AM

It's because not all implementers of IWavePlayer can or will be able to support volume changes. If you are happy just using WaveOut then ignore the IWavePlayer interface and use Volume on WaveOut. Just include an IWaveProvider/ISampleProvider/WaveStream in your audio pipeline that supports modifying the volume. This gives you the added flexibility of boosting the volume beyond 100% if you need to (although remember to clip before sending to the soundcard).