Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
media
danimation.controls
danimation.programming
devices
drm
dshow.programming
dtransform
encoder
encoder.optimization
hometheaterpc
media
media.beta
media.beta.encoder
mediacenter
mediacenter.portable
mediaplayer
music.products
musicproducer
player
player.plugins
player.skins
player.solaris
player.visualizations
player.web
sdk
server
tools
  
 
date: Wed, 2 Apr 2008 21:17:59 +0200,    group: microsoft.public.windowsmedia.sdk        back       


WMP11 ActiveX - sound card selection   
Hello,

I'm looking for an idea how to change output sound card in WMP11 ActiveX
object, used in VC++ app. 
If it's not possible, are there any other (commercials or free) ActiveX
media players with feature described above, and with WMA web streams
support available on the market ?
Thanks.

-- 
Greg
date: Wed, 2 Apr 2008 21:17:59 +0200   author:   Grzegorz Podsiadlo

Re: WMP11 ActiveX - sound card selection   
From: "Grzegorz Podsiadlo"

> I'm looking for an idea how to change output sound card
> in WMP11 ActiveX object, used in VC++ app.

AFAIK there is no interface to do that.

However, WMP stores the GUID of the device in 
[HKCU\Software\Microsoft\MediaPlayer\Preferences]"DefaultAudioDevice".

To enumerate the available devices, enumerate the subkeys in 
[HKEY_CURRENT_USER\Software\Microsoft\ActiveMovie\devenum\{E0F158E1-CB04-11D0-BD4E-00A0C911CE86}] 
that have a "CLSID" value set to 
"{79376820-07D0-11CF-A24D-0020AFD79767}". The "DSGuid" value 
is what you need. Notice that the "FriendlyName" value will 
give the name to show to the user (you can remove the 
"DirectSound: " prefix if you want to).

You must change the "DefaultAudioDevice" before playing the 
media and you can put it back afterwards (notice that, by 
default, the value does not exist at all so putting it back 
may mean deleting it).

Changing that value affects all instances of WMP for the 
current user. Since there is no API (except a kernel-mode 
registry filter driver) to create a per-process or 
per-thread view of the registry, if you want the change to 
be local, you will have to hook RegQueryValueEx() to return 
the changed value instead of actually changing the value 
itself.


-- 
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
date: Wed, 2 Apr 2008 16:02:26 -0400   author:   Alessandro Angeli

Re: WMP11 ActiveX - sound card selection   
> [...] if you want the change to 
> be local, you will have to hook RegQueryValueEx() to return 
> the changed value instead of actually changing the value 
> itself.

thanks!!! 
One more question: do you know any good article/sample for local hooks
(without dll)? I can't find anything specific.

-- 
GP
date: Thu, 3 Apr 2008 21:35:06 +0200   author:   GP

Re: WMP11 ActiveX - sound card selection   
From: "GP"

> One more question: do you know any good article/sample
> for local hooks (without dll)? I can't find anything
> specific.

See my FAQ (link below). Read both the entries in API 
hooking and the ones on spying (since they use API hooking).


-- 
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
date: Thu, 3 Apr 2008 15:54:24 -0400   author:   Alessandro Angeli

Re: WMP11 ActiveX - sound card selection   
On Thu, 3 Apr 2008 15:54:24 -0400, Alessandro Angeli wrote:

>> One more question: do you know any good article/sample
>> for local hooks (without dll)? I can't find anything
>> specific.
> See my FAQ (link below). Read both the entries in API 
> hooking and the ones on spying (since they use API hooking).

I've got local hook working, thanks.
There was a small problem with your code from
http://groups.google.com/group/microsoft.public.win32.programmer.directx.audio/msg/71a4c49c2fbd714d

at the end, in line:  
MoveMemory(((LPBYTE)F)[1],&ul,sizeof(ul)); 
there is & missing, it's working correcly looking like that: 
MoveMemory(&((LPBYTE)F)[1],&ul,sizeof(ul));

One more problem: 
the list of sound cards in
[HKEY_CURRENT_USER\Software\Microsoft\ActiveMovie\devenum\{E0F158E1-CB04-11D0-BD4E-00A0C911CE86}] 
is not always up to date with list of cards in the system. If there is new
card added, it's not under this key in registry, until
options->devices->speakers dialog is displayed manually form windows media
player. Is there any way to update it automatically ? Or is there a method
to enumerate the cards from directshow and to 'guess' DSGuid?

One more time, thanks for all your help!

-- 
GP
date: Wed, 9 Apr 2008 00:26:17 +0200   author:   GP

Re: WMP11 ActiveX - sound card selection   
From: "GP"

> One more problem:
> the list of sound cards in
> [HKEY_CURRENT_USER\Software\Microsoft\ActiveMovie\devenum\{E0F158E1-CB04-11D0-BD4E-00A0C911CE86}]
> is not always up to date with list of cards in the
> system. If there is new card added, it's not under this
> key in registry, until options->devices->speakers dialog
> is displayed manually form windows media player. Is there
> any way to update it automatically ? Or is there a method
> to enumerate the cards from directshow and to 'guess'
> DSGuid?

I am not aware of any way to get the DSGuid from the 
SysDevDenum moniker. Have you tried creating an instance of 
the CLSID_AudioRendererCategory enumerator before listing 
the subkeys? On the other hand, DSGuid may just be the 
DirectSound device GUID, in which case you can enumerate 
those (see DirectSoundEnumerate()).


-- 
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
date: Tue, 8 Apr 2008 19:02:10 -0400   author:   Alessandro Angeli

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us