I'm currently working on porting an app to run on windows 7 from previous generations of windows. Mostly this is straight forward but I've found one road block. Audio. The audio changes introduced in Vista are so radically different from the old mixer API that I'm not sure if what we need to do is even possible. Having said that it should be possible since I can do it from the Sound control panel.
What I need to application to be able to do is to mute the output of the mic/line so that the audio is still coming in to be recorded but won't be audible while the application is in playback mode since then it would sound awful and defeat the purpose playing altogether. If I go to the Sound control panel and then open the properties of the speakers there's a tab that has all the levels and mutes that I need to set, but i can't for the life of me work out how to get at them. I can get/set the overall output volume and the input record volumes but if I can't port the muting of the inputs live volume then i can't port the app to Win7.
For reference purposes the sound card in questions is a Realtek High Definition Audio onboard card.
There are a couple of different levels and mutes that apply to microphones... let's make sure we're talking about the same ones.
First, mics and line ins have their own volume and mute settings. These affect audio that goes to apps which record from the mic or line in. You can see these settings by going to the Recording tab of the Sound control panel, then double-clicking on the Microphone or Line In device, then going to the Levels tab. These are configurable by various volume APIs - most apps should use ISimpleAudioVolume. All well and good.
But, reading your post, I believe those are NOT the volume and mute settings you're interested in.
Second, some audio devices (but not all) expose an "analog mixer". This allows you to feed audio that's coming in via the mic or line in directly through to the speaker or line out, without going through the application at all. As you've noticed, you can see these settings by going to the Playback tab of the Sound control panel, then double-clicking on the Speaker or Headphone or Line Out device, then going to the Levels tab. The main volume slider and mute controls the output of the playback device; if there are subsidiary volume sliders and mutes below the main one, they control analog mixer paths. There's also a way to control these programmatically... but first I should note:
Windows 7 has a "Listen" feature that does much the same thing as the analog mixer but in software rather than hardware; users can turn this on or off by going to the Recording tab, double-clicking on the Microphone or Line In device, and choosing the "Listen" tab. Turning both the analog mixer and the "Listen" feature on at the same time sounds really strange and is not recommended.
The way to control analog mixer paths programmatically in Windows Vista and up is to use the IDeviceTopology API. See the WalkTreeBackwardsFromPart function in this post:
Matthew van Eerde
- Proposed as answer by Zaxxonal Friday, September 02, 2011 2:56 PM