0

After choosing a waveout device I want to listen to it every second in order to monitor its volume. How do I go about doing this? I have not found any example regarding listening to a playback device output.

int waveOutDevices = WaveOut.DeviceCount;
for (int i = 0; i < waveOutDevices; i++)
{
    WaveOutCapabilities deviceInfo = WaveOut.GetCapabilities(i);
    Console.WriteLine("Device {0}: {1}, {2} channels", i, deviceInfo.ProductName, deviceInfo.Channels);
}
lbrahim
  • 3,710
  • 12
  • 57
  • 95
  • It's not clear what you are trying to do. Normally one would listen to a wave out device by hooking up speakers or headphones. – jaket Nov 08 '15 at 16:37
  • @jaket Basically trying to do something like [this](http://www.codeproject.com/Articles/15003/VolumeMeter-Managed-DirectX) but with NAudio. – lbrahim Nov 08 '15 at 18:18
  • Possible duplicate of [How to capture PCM data from Wave Out](http://stackoverflow.com/questions/111603/how-to-capture-pcm-data-from-wave-out) – Hans Passant Nov 08 '15 at 18:47

1 Answers1

1

This isn't something supported by the WaveOut APIs. If you are on Vista or above you can use WasapiLoopbackCapture to intercept the audio from any render device, and WASAPI also supports signing up for volume notifications which would be ideal for our scenario.

Mark Heath
  • 48,273
  • 29
  • 137
  • 194
  • Excellent! If its not any trouble could you also tell me whether its possible that by intercepting the audio whether I can monitor decibel of that audio per sec? – lbrahim Nov 09 '15 at 15:05
  • 1
    sure, you could do a calculation to turn values of the samples into dB – Mark Heath Nov 09 '15 at 16:06