PDA

View Full Version : Can't get mixer.SetDefaultWaveOutDeviceName() to work



avid
March 21st, 2010, 09:18 PM
When my 6-year-old HTPC finally died, I have had to replace my very stable G4 GML on XP with new G5 GML on Windows 7. The first thing I tried to get working was the dynamic switching of audio betwen the TV and the HiFi speakers - this has always been achieved with mixer.SetDefaultWaveOutDeviceName().

Now, on Windows 7 with G5, I have some simple logging LUA:
for devId = 0, mixer.GetNumberWaveOutDevices()-1, 1 do
gir.LogMessage("Audio", "Dev ("..devId..") : "..mixer.GetWaveOutDeviceName(devId), a)
endwhich logs (e.g.) :
Time Date Source Details Payloads
04:52:26:215 3/23/2010 Audio Dev (3) : S/PDIF (M-Audio Delta Audiophil
04:52:26:215 3/23/2010 Audio Dev (2) : Realtek Digital Output (Realtek
04:52:26:215 3/23/2010 Audio Dev (1) : Speakers (Realtek High Definiti
04:52:26:215 3/23/2010 Audio Dev (0) : Line 1/2 (M-Audio Delta Audioph
If I manually change the default playback device (via the control panel or volume control taskbar icon), the log output correctly re-orders to (e.g.) :
Time Date Source Details Payloads
04:52:49:874 3/23/2010 Audio Dev (3) : S/PDIF (M-Audio Delta Audiophil
04:52:49:865 3/23/2010 Audio Dev (2) : Realtek Digital Output (Realtek
04:52:49:865 3/23/2010 Audio Dev (1) : Line 1/2 (M-Audio Delta Audioph
04:52:49:865 3/23/2010 Audio Dev (0) : Speakers (Realtek High Definiti
But I can't get mixer.SetDefaultWaveOutDeviceName() to work. And mixer.SetDefaultWaveOutDevice(1) doesn't work either. In all cases, the default output device remains unchanged, both in the Windows 7 UI and with my logging. And of course the sound continues to play from the old device. I have tried calling SetDefaultWaveOutDeviceName() with the truncated name that GetWaveOutDeviceName() returns and with the full name that the Windows UI displays - neither work.

Any ideas anyone?

Brian

Rob H
March 22nd, 2010, 07:09 AM
This is one for Ron I'm afraid.

Ron
March 22nd, 2010, 07:45 AM
I'll have to look into this the Audio stack was rewritten completely in Vista.

avid
June 15th, 2010, 10:30 AM
I'll have to look into this the Audio stack was rewritten completely in Vista.
Hi Ron

Did you ever get a chance to look at this?

Thanks

Brian

Ron
June 15th, 2010, 10:32 AM
Sorry I have not looked at this yet. If you find an api and can point me in a direction that might speed things up :)

avid
June 15th, 2010, 11:04 AM
Sorry I have not looked at this yet. If you find an api and can point me in a direction that might speed things up :)
Some quick research and the implication is that it can't be done!! There is no API available for this. :-(

> This is By Design. Default Audio device is a system/user setting. Keep in
> mind that if every app did this there would be a war for the default device
> so you should NEVER do this in an app. Enumerate the connected and active
> devices and pick the one you think is most appropriate for your app and then
> stream to that BUT if you do that you loose Win7 features associated with the
> Default Device and the Default Communication Device such as stream routing.
>
> Bottom line: Don't muck with the users/system default device assignment
> because your actions would affect all other app experiences on the system,
> not only yours.
>
> Sincerely,
>
> Hakon Strande | Software PM | Microsoft Hardware | (p) 425.705.0637
>
>

Brian

Ron
June 15th, 2010, 11:07 AM
I was afraid of that :(

Mike C
June 15th, 2010, 06:25 PM
look here

http://www.autohotkey.com/forum/topic2436-30.html

avid
June 16th, 2010, 12:27 AM
Thanks Mike,

A registry setting might work. I'll look later to see if it's present on my HTPC, though I'm concerned that it is not on my W7 laptop.

Failing that, I will simply send Girder keypresses to mmsys.cpl. Untidy, but (I hope) effective.

Brian