Sunday, January 24, 2010 4:46 PMWhile using managed DirectSound in C#, I came across an issue that I want to mention here.
Suppose you were to create a recording application, providing the user with the ability to select a sound card. You would enumerate the available devices by creating a CaptureDevicesCollection, as described here . Under Windows XP, this would simply list all audio devices capable of recording audio. In Windows 7 (and probably Vista), however, a device will not necessarily show up: it is ignored if all inputs are inactive. Since mono/stereo mixer recording is usually inactive or unavailable, this means that a device will only be detected if a microphone or line-in device is connected.
This is, in my opinion, incorrect behavior. All devices should be enumerated, whether a microphone is attached to them or not. A user could then start the application, select his soundcard, record nothing but noise, realize he forgot to connect his microphone, and get on with it. Right now, an application will in such case probably throw an error on startup, claiming no recording device was detected.
I hope this behavior will be improved, or at least mentioned in the DirectSound documentation.
Arno van den Brink
Monday, January 25, 2010 2:23 AMModeratorIt is painful when MSFT breaks application compatibility by introducing a change like this. OTOH, it works better for a lot of applications since only the valid input and output sources are listed. Since this is unlikely to change, my recommendation is to update your UI and messages to reflect the way it now works (example: if no input devices are found, explain that they will only show up when a device is plugged such as the mic or line in source).DSound has not been updated much in the last six years or so. I wouldn't expect any docs changes at this point.
Please use Vote As Helpful (green up arrow at top-left of posts) and Mark As Answer where appropriate.
My dshow site is http://tmhare.mvps.org.
- Marked As Answer by The March HareModerator Saturday, January 30, 2010 7:36 AM
Monday, January 25, 2010 10:28 AM
DSound has not been updated much in the last six years or so. I wouldn't expect any docs changes at this point.To add to this, DSound was not updated much on its own, but Vista brought WASAPI on the table as a primary audio API and since that time DirectSound has been a wrapper over WASAPI. This was an important change as compared to XP, and possibly OP has the changed behavior related right to this. I might be a behaviour by design that unconnected inputs are no longer exposed as available devices via DirectSound API...
Monday, January 25, 2010 3:08 PMAll the disconnected inputs are disabled for all the legacy API's and do not show up in enumeration. If you enumerate using the new WASAPI API's you can select whether or not to include disconnected inputs in your enumeration.