I've tried it as follows: [ComImport] [Guid("E79C6349-5997-4CE4-917C-22A3391EC564")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal interface IWMPAudioRenderConfig { int get_audioOutputDevice([MarshalAs(UnmanagedType.LPWStr)] out string pbstrOutputDevice); int put_audioOutputDevice(string bstrOutputDevice); }; Accessing it as follows: private AxWMPLib.AxWindowsMediaPlayer Player = new AxWMPLib.AxWindowsMediaPlayer(); IWMPAudioRenderConfig ac = Player.GetOcx() as IWMPAudioRenderConfig; if (ac==null) { Console.WriteLine("Error accessing IWMPAudioRenderConfig."); } else { string x; ac.get_audioOutputDevice(out x); Console.WriteLine(x); } The problem is that the getter always returns null. Anyone have any ideas what I'm doing wrong? Thank you, John Rennemeyer From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of John Rennemeyer Sent: Sunday, February 01, 2009 2:31 PM To: wdmaudiodev@xxxxxxxxxxxxx Subject: [wdmaudiodev] Re: Stream Switching in Windows 7 breaks applications that output audio to multiple soundcards using the Windows Media Player SDK. Okay, thanks. I'm not too familiar with using pinvoke against an interface. With the pinvoke method, would I create an instance of it by casting the Player (Activex wmp c# object) into the IWMPAudioRenderConfig interface? Do you know of any documentation or online resources that could assist me in this effort so that I can set the audiodevice used by the WMP object in a C# application? Any help in getting this to work in a C# application would be greatly appreciated. --interface from wmprealestate.h- /* interface IWMPAudioRenderConfig */ /* [oleautomation][unique][helpstring][uuid][object] */ EXTERN_C const IID IID_IWMPAudioRenderConfig; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("e79c6349-5997-4ce4-917c-22a3391ec564") IWMPAudioRenderConfig : public IUnknown { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_audioOutputDevice( /* [retval][out] */ BSTR *pbstrOutputDevice) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_audioOutputDevice( /* [unique][in] */ BSTR bstrOutputDevice) = 0; }; #else /* C style interface */ typedef struct IWMPAudioRenderConfigVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IWMPAudioRenderConfig * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ __RPC__deref_out void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( IWMPAudioRenderConfig * This); ULONG ( STDMETHODCALLTYPE *Release )( IWMPAudioRenderConfig * This); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_audioOutputDevice )( IWMPAudioRenderConfig * This, /* [retval][out] */ BSTR *pbstrOutputDevice); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_audioOutputDevice )( IWMPAudioRenderConfig * This, /* [unique][in] */ BSTR bstrOutputDevice); END_INTERFACE } IWMPAudioRenderConfigVtbl; interface IWMPAudioRenderConfig { CONST_VTBL struct IWMPAudioRenderConfigVtbl *lpVtbl; }; #ifdef COBJMACROS #define IWMPAudioRenderConfig_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IWMPAudioRenderConfig_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IWMPAudioRenderConfig_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IWMPAudioRenderConfig_get_audioOutputDevice(This,pbstrOutputDevice) \ ( (This)->lpVtbl -> get_audioOutputDevice(This,pbstrOutputDevice) ) #define IWMPAudioRenderConfig_put_audioOutputDevice(This,bstrOutputDevice) \ ( (This)->lpVtbl -> put_audioOutputDevice(This,bstrOutputDevice) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IWMPAudioRenderConfig_INTERFACE_DEFINED__ */ --end interface in wmprealestate.h-- Thank you, John From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Larry Osterman Sent: Sunday, February 01, 2009 12:34 AM To: wdmaudiodev@xxxxxxxxxxxxx Subject: [wdmaudiodev] Re: Stream Switching in Windows 7 breaks applications that output audio to multiple soundcards using the Windows Media Player SDK. The idl might not be published, but the interface in question shouldbe in the wmprealestate.h file. From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of John Rennemeyer Sent: Friday, January 30, 2009 9:24 PM To: wdmaudiodev@xxxxxxxxxxxxx Subject: [wdmaudiodev] Re: Stream Switching in Windows 7 breaks applications that output audio to multiple soundcards using the Windows Media Player SDK. I found the wmprealestate.h file in "C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\wmprealestate.h" but I did not see a wmprealestate.idl file. Is there any chance that I can get a reference/sample on the pinvoke signature and sample calling of the function? Also, will using pinvoke still reference the instance of the axwmpplayer object in the application that the function is called in? Thank you, John From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Larry Osterman Sent: Friday, January 30, 2009 8:46 PM To: wdmaudiodev@xxxxxxxxxxxxx Subject: [wdmaudiodev] Re: Stream Switching in Windows 7 breaks applications that output audio to multiple soundcards using the Windows Media Player SDK. The interface should be defined in wmprealestate.idl/wmprealestate.h, you'll need to use P/Invoke to call into it because it is not a part of the scriptable interface to WMP. I've not checked the Windows 7 SDK but it should be there. I'll check with the documentation folks to see what's up with the documentation. From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of John Rennemeyer Sent: Friday, January 30, 2009 2:45 PM To: wdmaudiodev@xxxxxxxxxxxxx Subject: [wdmaudiodev] Re: Stream Switching in Windows 7 breaks applications that output audio to multiple soundcards using the Windows Media Player SDK. Larry, This is great news! I downloaded and installed the Windows 7 SDK (on Vista) and am unable to find any reference to that library/function (I did a doc search for it without results). Any ideas where it is? Our program is written in C#. I also tried checking intellisense in one of the C++ WmpML and wmphost sample apps and it doesn't exist (IWMPCdrom is the first shown). I assume the intellisense part is because this machine is running Vista and I need to reference the WMP 12 dll, not the WMP 11 dll. I'm going to be installing VS 2008 and the SDK on one of our machines that has Windows 7 and go from there. Any further tips for doing this in C# .NET would be appreciated. Thank you, John From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Larry Osterman Sent: Thursday, January 29, 2009 3:20 PM To: wdmaudiodev@xxxxxxxxxxxxx Subject: [wdmaudiodev] Re: Stream Switching in Windows 7 breaks applications that output audio to multiple soundcards using the Windows Media Player SDK. Btw, this was a feature that was generated by feedback from forums like this one and the MSDN forums - when we asked people why they needed to modify the default output device, changing the output device for the WMP control was very high on their list, so we made sure that it was possible in Windows 7. Larry From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Larry Osterman Sent: Thursday, January 29, 2009 2:08 PM To: wdmaudiodev@xxxxxxxxxxxxx Subject: [wdmaudiodev] Re: Stream Switching in Windows 7 breaks applications that output audio to multiple soundcards using the Windows Media Player SDK. Why don't you use the new mechanism added in Windows 7 to allow an application to chose which audio output device is used by the WMP control? We added this functionality explicitly to support applications like yours that need the ability to change the output device for the windows media player application. That should allow you to finally remove all those hacks once and for all. Look for the IWMPAudioRenderConfig::put_audioOutputDevice in the Windows 7 SDK for more information. From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of John Rennemeyer Sent: Tuesday, January 27, 2009 10:47 AM To: wdmaudiodev@xxxxxxxxxxxxx Subject: [wdmaudiodev] Stream Switching in Windows 7 breaks applications that output audio to multiple soundcards using the Windows Media Player SDK. Stream Switching in Windows 7 breaks applications that output audio to multiple soundcards using the Windows Media Player SDK. Because of Stream Switching, a new feature in Windows 7, developers that use the Windows Media Player SDK on Windows 7 and output audio to multiple soundcards need support from the WMP SDK to explicitly set the output device for each instance of the SDK otherwise a lot of applications that use the WMP SDK will break. I'm posting this here to make sure it gets seen by the right people before it is too late and Windows 7 makes to RTM with this issue still intact. Pulled from: https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=399755&S iteID=647 Sample application can be found at above address. ------------------------ "Description Setting of the default playback device forces all audio from all Windows Media Player SDK instances to play audio out the newly selected default device other than the device that was originally set when playback was started. We have developed a software application for computers that contain multiple soundcards that allows the computers to output different audio tracks to the different soundcards where the speakers attached to each soundcard are located in different locations or are combined in a single room to create a unique experience (other offices, meeting rooms, etc.). In Windows XP, we were able to use the Windows Media Player 9-11 SDK to play the sound and whatever soundcard device was set as the default playback device (through a registry key) when the application was loaded was the audio device that the sound came out of. In this case, we had a master application where the users would set the files to be played on each soundcard and then it would change the audio device, open a child application, change the audio device to the next in the list, open another child window, etc., until all child applications were each tied to specific soundcards and then playback for all applications would begin. In Windows Vista, the registry key method to set the default audio device was removed. We developed a new method that would set the default audio device before a file was played in the Windows Media Player 11 SDK instance. This would force this audio file to play on the device that was set as the default when it started playing even if the audio device was changed later. We could then change the default audio device whenever a new track on a different soundcard and different WMP 11 SDK instance was set to play. Changing the default audio device would never reroute the currently playing tracks on other audio devices to that newly set default audio device. They stayed playing on the soundcard on which they initially played on. In Windows 7 Beta, the Windows Vista method no longer works. We can still set the default audio device but all the currently playing audio from all of the Windows Media Player SDK instances are forced to the last set default audio device even though they were playing on other audio devices (soundcards). This means our program(s) no longer function. Our requirement is to be able to use a single computer to output multiple audio tracks through multiple soundcards to multiple speaker setups. We were expecting to have all audio files being played on different souncards, to stay on their respective soundcard even when the default audio device is changed. Since our program is deeply integrated with the use of the Windows Media Player SDK, we currently see two possible solutions: 1. Revert back to the old method used by Windows Vista/Windows Media Player 11, where audio on other playback devices is not rerouted to the currently selected default device but instead, stays on the audio device it was initiated to play on. 2. Give us the ability in the Windows Media Player SDK to specify the output device for the currently playing Windows Media Player instance. This way we could specify each WMP SDK instance to output to a different audio device, we wouldn't have to mess with setting the audio device using our old cumbersome method, and our program would work with minimal modification. -------------------- For solution #1, we found the Channel 9 video with Larry Osterman (http://channel9.msdn.com/posts/Charles/Inside-Windows-7-Larry-Osterman-on-n ew-audio-capabilities/) describing a new feature called "StreamSwitching". We assume this is what is forcing the audio from all soundcards to be played out of the last set default audio device. If this is the case, our assumption is that it will break a lot of software that depends on being able to set the audio device in the way that we do. He mentions in the video that they won't switch the audio from the current audio device if the "player" specifies a specific audio device. This brings us to Solution #2 which would be the ultimate solution. We could set each instance to the specified device the user wants it to play to and the "StreamSwitching" would still work in other cases where the audio device is not specified. From http://msdn.microsoft.com/en-us/library/aa385268(VS.85).aspx, it states the following about the Windows Media Player ActiveX control on Windows Vista: "By default, the Player control uses the audio device designated as eMultimedia. The audio output device cannot be changed programmatically." Our desperate need is for it to say: "By default, the Player control uses the audio device designated as eMultimedia. The audio output device can be changed programmatically to the required audio device." Comments 1 comment | post a comment to Microsoft I noticed the status was changed to "Resolved (External)". I'm unclear of what this means. Does this mean that this has been passed to the appropriate team (WMP or Audio or some other team) and that it will still be looked into? Any additional information about how I can track the status of this issue would be appreciated. Thank you, John Posted by johnren on 1/18/2009 at 9:27 AM Repro Steps We were running our custom software application for a large number of clients that was developed using the Windows Media Player SDK. It outputs multiple audio files to specified soundcards when the users systems have more than once soundcard (haunted houses are one of the major users). It works on Windows Vista but on Windows 7, when changing the audio device to force the audio file to play to (setting the device before actually playing the audio file forces the audio to stay on that audio device even if the default audio device is changed while it an audio file was playing on a different soundcard), it outputs all audio for all Windows Media Player SDK instances to the last set default audio device. This makes our program unusable on Windows 7. We have created a simple sample application that shows this issue which we will be attaching to our feedback report. To reproduce the issue with the attached MultipleAudioDevicesSample.zip file, please do the following on both Windows Vista and Windows 7. You will need at least 2 soundcards and 2 speaker setups to be able to reproduce this. 1. Extract the zip file to a temporary folder. 2. Run the MultipleAudioDeviceSample.exe file in the extracted folder. 3. There will be two instance of the Windows Media Player in this sample application. 4. Click "Choose Audio File" on each instance and choose a different audio file for each. 5. Select a different soundcard for each instance. 6. Hit Play/Pause on the first instance. Once you see it start playing, Hit Play/Pause on the second instance. 7. On Vista, each soundcard should output the different track to the audio device/speakers you selected for each instance. 8. On Windows 7, only the speaker/audio device selected in the last instance will have audio playing and it will be the audio of both files played by both instances of the WMP SDK." ------------------------ Any help on getting this resolved either through the WDM Audio team or the Windows Media Player SDK team would be appreciated. Thank you, John _____ HotmailR goes where you go. On a PC, on the Web, on your phone. See how. <http://www.windowslive-hotmail.com/learnmore/versatility.aspx#mobile?ocid=T XT_TAGHM_WL_HM_versatility_121208>