Opting Out of Volume Level Persistence

In Windows Vista and later versions of the Windows operating system, the default setting for the master volume level of an audio device is six decibels of attenuation. This level is set at the time of installation and it corresponds to the half-way position on the volume slider.

This default master volume level setting, or any other level that you choose after installation, is maintained no matter how often you restart your computer. If you do not want your master volume level to be maintained by the system after a computer restart, you can use an INF file at the time of installation of the audio adapter, to opt out of this default system behavior. The default system behavior is referred to as volume persistence.

To opt out of volume persistence using an INF file, use the AddProperty registry directive to set the value of the PKEY_AudioDevice_DontPersistControls registry key to "0". The default value is "1".

The following INF file fragment shows how to opt out of volume persistence:


 
;; INF file fragment to show how to use AddProperty
;; to opt out of volume persistence
;;
[Version]
Signature = "$CHICAGO$"
Class = MEDIA
ClassGUID = {...}
...
[Manufacturer]
%MfgName% = CompanyName
...
[CompanyName]
%DeviceDescription% = HdAudModel, hw-id
;; ... other device models listed here

[HdAudModel]
Include=ks.inf, wdmaudio.inf
Needs=KS.Registration, WDMAUDIO.Registration
CopyFiles = HdAudModel.CopyList, HdAudProp.CopyList, HdAudShortCut.CopyList
AddReg = HdAudModel.AddReg, HdAudProp.AddReg, HdAudShortCut.AddReg, HdAudBranding.AddReg
AddProperty = HdAudModel.AddProperty
...
[HdAudModel.AddProperty]
;; {F3E80BEF-1723-4FF2-BCC4-7F83DC5E46D4},2,7,,1
{F3E80BEF-1723-4FF2-BCC4-7F83DC5E46D4},2,7,,0
...
[Strings]
MfgName = "My Company Name Inc"
DeviceDescription = "My WDM device driver"

Note  The preceding INF file fragment, only shows the Version section and the sections relevant to the AddProperty directive.

The %MfgName% = CompanyName line entry in the Manufacturer section references the CompanyName section where the model and hardware ID (hw-id) of the audio adapter are provided. This section in an INF file, where model and hw-id information is provided, is called the models section. The actual title of the section is user-defined and in the preceding example it is CompanyName. For more information about the models section of an INF file, see INF Models Section.

The models section, in turn, references the device driver install (DDInstall) section, where information is provided about other INF files that the setup program must copy. The actual title of this section is user-defined and in the preceding example it is HdAudModel. The Needs=KS.Registration... line entry provides information about the specific sections within the INF files, from which the setup program must retrieve data for installation

The HdAudModel section also contains references to the AddReg and AddProperty sections. The setup program retrieves data from AddReg and AddProperty to set registry keys and device properties respectively. The AddProperty section referenced here is HdAudModel.AddProperty and it uses the following format to provide information about the device property:

{property-category-guid}, property-pid, type, [flags], value

The HdAudModel section shows two line entries with the first one commented out. The line entry that is commented out sets the value of the device property to "1." The line entry that is not commented out is the one that the setup program reads. This line entry causes the value of the device property to be set to "0." When this device property is set to "0," the audio device opts out of volume persistence.

For more information about the AddProperty directive, see INF AddProperty Directive.

The property name that corresponds to the property category GUID and property ID in the preceding INF file fragment is PKEY_AudioDevice_DontPersistControls.

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft