WaveIn.Device not giving proper result if audio service is stopped

Jan 29 at 2:39 PM
Edited Jan 31 at 3:46 AM
Respected Sir,

I am using waveIn to list down audio devices.

but if we stop audio service then waveIn.DeviceCount not giving proper count of audio devices.


also if we run application and audio service was stopped then we are not getting any audio device list using waveIn and if we start it again then also we are not able to get audio device count.

sir why this behave like this ?
Coordinator
Jan 31 at 6:42 AM
waveIn device count just returns the number of devices that Windows reports (using the waveInGetNumDevs function).
Feb 1 at 11:52 AM
Edited Feb 1 at 11:53 AM
Thanks for your valuable reply,

Yes sir,
i checked code and i found that WaveIn internally using waveInGetNumDevs function to retrieve audio device count.

but sir do we have any other way to get proper count and device list even if audio service stopped or running ?

Thanks.
Coordinator
Feb 4 at 10:15 AM
No other way that I know of I'm afraid, unless you want to try using the MMDeviceEnum (part of CoreAudio API for Windows Vista and above)
Feb 5 at 5:34 AM
Edited Feb 5 at 5:49 AM
Sir You wrote:
waveIn device count just returns the number of devices that Windows reports (using the waveInGetNumDevs function).
Sir,
But how Windows showing audio device properly in audio settings dialog. why we are not able to enumerate it. is windows using any other library for it.

Sir,
if we use separate application domain only to load and unload NAudio Library and if we found that audio service is stopped then we can show an dialog to user to start audio service and according user action we can load NAidio Library in corresponding application domain [NAudio Domain ] and other domain will communicate with NAudio Domain to enumerate audio device, also capture audio from device..

is it possible..??

Thanks.
Coordinator
Feb 15 at 10:22 AM
I'm not quite sure what you are asking, but the important thing to realise is that NAudio is simply calling Windows APIs when you ask it what devices there are. It doesn't change anything that Windows reports. Maybe there is another API, or a flag we can use in an existing API, but you would need to search MSDN for that answer.