There is very simple way to set default format in Vista: - set value PKEY_AudioEngine_DeviceFormat - set value PKEY_AudioEngine_MixFormat Both values are type VT_BLOB, value WAVEFORMATEXTENSIBLE. Mixer in Vista is 32 bit - you should set properly nAvgBytesPerSec,nBlockAlign,wBitsPerSample,Samples. Use GetValue function and cast pBlobData for WAVEFORMATEXTENSIBLE to look how system do it. Chris W. PS. Setting default device is even simpler. -----Original Message----- From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Hakon Strande Sent: Sunday, October 28, 2007 4:13 AM To: wdmaudiodev@xxxxxxxxxxxxx Subject: [wdmaudiodev] Re: setting sample rate in the control panel in Vista There is no supported/documented way to set the default device format programmatically/dynamically from the device on Vista. This is a user only setting on this OS version. There have been many requests for this design to change and we are looking into this for the next version of Windows (no - the next version of Windows does not mean Service Pack 1) especially since it will be required to properly support HDMI Audio sinks. HakonS, Windows Sound Team PM -----Original Message----- From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Eugene Gavrilov Sent: Saturday, October 27, 2007 6:09 PM To: wdmaudiodev@xxxxxxxxxxxxx Subject: [wdmaudiodev] setting sample rate in the control panel in Vista Hi, This question was being discussed some time ago, but I still was unable to find acceptable solution for the problem. I'm writing a driver (AVStream-based) for Windows Vista that supports: (1) dynamic sample rate change based on a switch located on the device (2) external clock source, such as an external SPDIF-in connector (3) sample rate change by using our vendor-provided control panel All the events are processed by the driver successfully and it updates the hardware parameters accordingly. It also sets KSDATARANGE for the current sample rate in the KSFILTERFACTORY structure. This works fine in Windows XP - as soon as new sample rate is detected and an audio application is restarted, or as soon as it re-opens the audio device (re-instantiates audio filter and/or pin), everything is OK. In Windows Vista this requires manual change of the preferred audio format in the 'Sounds and audio' control panel. I found no way to avoid this. I already tried the following: 1. The PKEY_AudioEngine_DeviceFormat property cannot be set without administrative rights from a user-level control panel, moreover, this does not always work. 2. PKEY_AudioEngine_OEMFormat is not documented, although it seems to be required as well. 3. I cannot create a set of 'virtual subdevices' for each possible sample rate, because this can only be done at install time in an INF file, but we are using the same INF file for a wide range of our devices, and the list of sample rates is quite large. And this would require significant development effort. 4. Restarting the device does not work either: if the device gets sample rate change request, sets new sample rate, and then I go to the Device Manager, disable the device and re-enable it, all the KS structures and data ranges are set properly by our driver (with a single sample rate that is currently selected), but Windows Vista still remembers previous setting and refuses to playback/record audio. In the 'Sounds and audio' control panel Vista shows two sample rates, old and new, old is selected. As soon as I select new sample rate and close the control panel, everything's ok, and after that the old sample rate disappears from the list. 5. I guess using IUregisterSubdevice is not applicable for AVStream drivers. > You should use IUnregisterSubdevice and IUnregisterPhysicalConnection for this > (see portcls.h) and you should unregister/register subdevices and physical > connections in the following order 6. I tried KsFilterFactorySetDeviceClassesState, too - it returns STATUS_SUCCESS, all WinMM/DSound clients are reset and new topology is successfully created, but the control panel still displays old sample rate and audio playback/recording fail. After I choose correct sample rate manually, playback/recording are OK. 7. I tried KsFilterFactoryUpdateCacheData. No success. (I'm not sure if this function is related to the problem). Any hints or advice, please? I wonder why even after driver is unloaded and re-loaded, and a new KS topology with new data ranges is built, the Control Panel is still using cached values for the current audio format, and this cannot be avoided. By the way, I noticed at least one more strange thing: when the 'advanced' tab is opened, the control panel enumerates all the formats (driver's intersection handler is called), however, it does only enumerate 8, 16 and 24-bit formats, but not 32. Our hardware is using 32 bit (24-bit data in 32-bit containers). Regards, Eugene Gavrilov Senior Software Engineer, CEntrance, Inc. ****************** WDMAUDIODEV addresses: Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe Unsubscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to WDMAUDIODEV page: http://www.wdmaudiodev.com/ ****************** WDMAUDIODEV addresses: Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe Unsubscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to WDMAUDIODEV page: http://www.wdmaudiodev.com/ No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.15.12/1095 - Release Date: 26-10-07 7:54 PM No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.15.12/1096 - Release Date: 27-10-07 11:02 AM ****************** WDMAUDIODEV addresses: Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe Unsubscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to WDMAUDIODEV page: http://www.wdmaudiodev.com/