The Windows Vista and Windows 7 audio subsystems use a similar algorithm to determine the default audio endpoint. The algorithm operates as follows:
Loops through all ACTIVE endpoints to find the endpoint with the most recent timestamp property. This property indicates the last time an endpoint was set as the default audio endpoint. The timestamp property is discussed in more detail in the next section of this paper.
If a time-stamped audio endpoint is found, returns it as the default audio endpoint.
If a time-stamped audio endpoint is not found, uses the default audio endpoint heuristic algorithm to determine the default audio endpoint. The heuristics for both Windows 7 and Windows Vista are discussed in detail later in this paper.
There are four endpoint states: ACTIVE, UNPLUGGED, DISABLED, and NOT PRESENT. The audio subsystem considers only ACTIVE endpoints (in the present and enabled state) when it determines the default audio endpoint. Any events that cause an endpoint’s state to change from or to the ACTIVE state can potentially affect the current default audio endpoint. Such events include inserting an audio device, unplugging a device, and installing a new audio device. In response to such operations, the Windows audio subsystem runs the default audio endpoint heuristic algorithm to determine the new default audio endpoint.
An audio endpoint is created without a timestamp property. The Windows audio subsystem assigns a timestamp to the endpoint only when it is set as the default audio endpoint. An endpoint that is never set as the default endpoint does not have a timestamp property.
Endpoint Timestamp Property Creation and Update in Windows Vista
In Windows Vista, an endpoint’s timestamp property is created or updated only when it is specifically set as the default audio endpoint through one of the following methods:
End-user selection through the Control Panel Sound application.
An end user can designate an endpoint to be the default audio endpoint by right-clicking the target endpoint and then selecting Set as Default Device, as shown in the following screen shot.
In response to this user action, the audio subsystem gets the current timestamp and creates a timestamp property if it does not exist or updates the existing timestamp property.
Audio driver installation.
In Windows Vista, an audio driver package can use the SetupPreferredAudioDevices INF directive to establish its installed audio endpoints as the new default audio endpoints. All endpoints that are created from the section that contains this INF directive have their default endpoint timestamp property updated with the installation time.
For details, see “SetupPreferredAudioDevices” on the MSDN Web site.
Share with your friends: