Default Audio Endpoint Selection in Windows 7 March 30, 2010


The Windows Vista Default Audio Endpoint Heuristic



Download 215.24 Kb.
Page4/4
Date23.04.2018
Size215.24 Kb.
#46196
1   2   3   4

The Windows Vista Default Audio Endpoint Heuristic


The system default audio endpoint heuristic algorithm is quite simple in Windows Vista. The only property that the audio subsystem uses is the endpoint’s form factor. The AudioEndpointBuilder service assigns each form factor type a relative priority value or rank value. The audio subsystem uses this rank value to prioritize the endpoints for the selection of the default audio endpoint. When there are multiple endpoints from which to select, the audio subsystem chooses the endpoint that has the best rank as the default device. There are two sets of rank settings: one for render endpoints and one for capture endpoints.

The priority order, from highest to lowest priority, for render endpoints is as follows:



  • Speakers

  • Sony/Phillips Digital InterFace (S/PDIF)

  • All other form factors (all are ranked equally)

For example, in a system that has a speakers endpoint and a S/PDIF endpoint, the system default audio endpoint heuristic algorithm selects the speakers endpoint as the default endpoint.

If there is more than one endpoint that has the same form factor, the audio subsystem selects the first one that it encounters.

The priority order, from highest to lowest priority, for capture endpoints is as follows:



  • Microphone

  • LineLevel

  • S/PDIF

  • Any other form factors (all are ranked equally)

Because most Windows Vista audio drivers use the SetupPreferredAudioDevices directive in their INF files, almost all endpoints have a timestamp property. For this reason, the Windows Vista system default audio endpoint heuristic algorithm is rarely used to determine the default audio endpoint.


The Windows 7 Default Audio Endpoint Heuristic


In Windows 7, a more flexible and sophisticated default device selection heuristic replaces the heuristic that is used in Windows Vista. This new heuristic uses more factors to select the default endpoint, which allows finer control on the relative priority order among endpoints that have various characteristics.

The following are some examples of how the enhanced default device selection heuristic works on Windows 7:



  • When the heuristic selects the default communications endpoint, it assigns higher priority to Bluetooth headphone endpoints than to onboard HD Audio headphones.

  • When it selects the default speaker endpoint, it assigns higher priority to speaker endpoints that have jack detection capability than to static speaker endpoints.

  • When it selects the default capture device, it assigns higher priority to front microphone endpoints than to microphones in the rear of a computer.

  • When it selects the default console render endpoint, it assigns higher priority to S/PDIF endpoints than to handset endpoints. When it selects the default communications render endpoint, it assigns higher priority to handset endpoints than to S/PDIF endpoints.

  • The heuristic can designate an endpoint that has specific characteristics to be the top priority or the lowest priority. For example, it can make a jack detection capable HD Audio headphone endpoint on the right of a computer be the highest priority default communication render device.

You can see from the preceding examples that the enhanced system default device heuristic algorithm in Windows 7 is flexible enough to have much more detailed control on the default device selection behavior. Heuristic details are provided in the next sections.


Windows 7 Heuristic Factors


The Windows 7 audio subsystem considers the following endpoint characteristics, or factors, to select the default audio endpoint:

  • Jack detection capability

  • Form factor

  • KSNodeType

  • Bus type

  • General location

  • Geometric location

Windows 7 defines a set of enum values for every supported endpoint factor and stores them in the registry. Detailed descriptions of these factors and their corresponding enumerant value sets follow.


Jack Detection Capability


An endpoint with this capability implies that audio drivers can notify the audio subsystem when the audio peripherial device that is connected to an endpoint is plugged in or unplugged. Audio endpoints that support jack detection capability are called dynamic endpoints, and those that do not provide this support are called static endpoints. To support jack detection capability, audio device drivers must support the KSPROPERTY_JACK_DESCRIPTION2 property. For more information about this property, see “KSPROPERTY_JACK_DESCRIPTION2” on the MSDN Web site.

Jack detection capability enum values

Supported

NotSupported

The Windows 7 default audio device heuristic treats all USB audio endpoints as jack detection capable.


Form Factor


An audio endpoint’s form factor indicates the physical attributes of the audio endpoint device with which the user interacts, such as headphones, speakers, or S/PDIF. To determine an endpoint’s form factor, the audio subsystem uses built-in fixed logic to map the kernel streaming (KS) pin’s category (KSNodeType), which is exposed by the audio driver, to a specific form factor. For more information, see “Pin Category Property” on the MSDN Web site.

Endpoint form factor enum values

RemoteNetworkDevice

Handset

Speakers

UnknownDigitalPassthrough

LineLevel

SPDIF

Headphones

UnknownFormFactor

Microphone

Headset

DigitalAudioDisplayDevice (defined to be same as HDMI)

KSNodeType


The audio driver selects the KSNodeType for a KS pin on an endpoint because the driver has detailed knowledge about the audio device that might be connected to an audio jack. Therefore, KsNodeType reveals more specific knowledge on the endpoint than its form factor does.

KSNodeType enum values

KSNODETYPE_SPEAKER

KSNODETYPE_MICROPHONE_ARRAY

KSNODETYPE_HEADPHONES

For more detailed information about KsNodeType, see “Pin Category Property” on the MSDN Web site.


Bus Type


This factor represents the bus type from which the audio device that exposed the audio endpoints was enumerated.

Bus type enum values

BTHENUM

BTHHFENUM

USB

HDAUDIO

PCI

Unknown



The audio subsystem favors endpoints on a certain bus type over other bus types when all other endpoint characteristics are identical. For example, the system gives Bluetooth headphones priority over on-board HD Audio headphones to provide a better communications experience for the user; that is, when an end-user introduces a Bluetooth headphone device to this PC, the system makes it the default device.


General Location


General location indicates the physical gross location of the jack or device to which the audio endpoint is connected.

General location enum values

PrimaryBox (on the primary system chassis, accessible to the user)

Internal (on the motherboard, not accessible without opening the box)

Separate (such as a mobile box)

Other

Geometric Location


Geometric location indicates the geometric location of the jack or device to which the audio endpoint is connected.

Geometric location enum values

eGeoLocRear

eGeoLocFront

eGeoLocLeft

eGeoLocRight

eGeoLocTop

eGeoLocBottom

eGeoLocRearOPanel

eGeoLocRiser

Windows 7 Heuristic Details


The Windows 7 default audio endpoint heuristic weights each endpoint factor. The higher a factor’s priority is, the greater its weight. This paper uses WeightFactor_Xxx to identify a factor’s priority.

In addition, the Windows 7 heuristic assigns a rank value (nRankXxx in this paper) to each enum value within a factor category. This rank value establishes the relative importance among all enum values under the same factor.

These WeightFactor_Xxx and nRankXxx values are stored in the registry during operating system installation. Registry storage makes it easier for OEMs to customize the default audio endpoint’s selection process. The set of parameters for the heuristic’s rank calculation depends on the endpoint’s characteristics. The following table shows an example set of parameters.

Weight of endpoint factor

Rank value of endpoint factor

WeightFactor_JackDet

nRankJackDet

WeightFactor_SubType

nRankSubType

WeightFactor_FormFactor

nRankFormFactor

WeightFactor_BusType

nRankBusType

WeightFactor_GenLoc

nRankGenLoc

WeightFactor_GeoLoc

nRankGeoLoc






The audio subsystem calculates an endpoint’s weighted rank across all its factors, as follows:



WeightedRankValue =

WeightFactor_JackDet * nRankJackDet +

WeightFactor_SubType * nRankSubType +

WeightFactor_FormFactor * nRankFormFactor +

WeightFactor_BusType * nRankBusType +

WeightFactor_GenLoc * nRankGenLoc +

WeightFactor_GeoLoc * nRankGeoLoc;
The audio subsystem calculates the weighted rank value for all active endpoints and selects the endpoint that has the highest rank as the default audio endpoint.

The Windows 7 default audio endpoint selection heuristic mechanism also supports an exception feature. This feature allows the system or an OEM to cause the audio subsystem to designate an endpoint that matches a specific set of characteristics with very high or very low weighted rank values. Such designations make the system’s heuristic more flexible when it deals with unexpected scenarios.

The heuristics for the console device role and the communication device role are completely separate, but the mechanism is precisely the same, with different order for the factors based on roles.

Windows 7 Inbox Heuristic Settings


Windows 7 ships with settings that are based on the heuristic details in this paper. The default console audio endpoint and default communications audio endpoint have different settings. This section describes the settings for both types of endpoints.

Inbox Heuristic Settings for the Default Console Audio Endpoint


This section describes the default heuristic settings for each factor for a console audio endpoint. The factors are listed in priority order; that is, Windows 7 gives highest priority to the first factor in the following list when the audio subsystem determines the default console endpoint.

Jack Detection Capability


Endpoints with jack detection capability provide the most up-to-date information to the system on whether an audio peripheral device is physically attached to the system and when it is plugged in or unplugged. This information helps create a better end-user experience, so Windows 7 sets this factor as the highest priority factor. An endpoint with jack detection capability has a higher priority than endpoints without this capability, no matter how other factors compare.

Form Factor


Windows 7 uses a different form factor priority order than Windows Vista does. In addition, Windows 7 uses different priority lists for render console default devices and capture console default devices. This is primarily because some form factors (such as LineLevel and S/PDIF) can be used to represent both render and capture endpoints.

Windows 7 sets form factor priority for render console endpoints in the following priority order:



  • Headphones

  • Speakers

  • LineLevel

  • DigitalAudioDisplayDevice

  • S/PDIF

  • Anything else (treated with the same lowest priority; that is, withnRankFormFactor equal to zero)

Windows 7 sets form factor priority for capture console endpoints in the following priority order:



  • Headset

  • Microphone

  • LineLevel

  • Anything else (treated with the same lowest priority; that is, with nRankFormFactor equal to zero)

For example, consider a system with three audio console render endpoints:



  • An HD audio static headphone endpoint (a headphone without jack detection capability).

  • A static S/PDIF Out endpoint.

  • A dynamic speakers endpoint (speakers with jack detection support).

The audio subsystem uses the Windows 7 system heuristic and chooses the dynamic speakers endpoint as the default console render audio endpoint, even though the speakers’ form factor is prioritized below the headphone’s form factor. The speakers endpoint is chosen because it is jack detection capable, which has a higher priority over form factor, whereas the headphones do not have this capability.

If a dynamic USB headphones endpoint is introduced into the above example, the Windows 7 audio subsystem chooses this endpoint as the default console render endpoint. This choice is because the headphones form factor has higher priority than the speakers form factor when both devices support jack detection.

KSNodeType


As mentioned earlier, KSNodeType provides more detailed information than that indicated by form factor for an audio device that is connected to an endpoint. Windows 7 defines three microphone-related KSNodeTypes to further prioritize endpoints with the microphone form factor but different KSNodeType. They are ranked in priority order as follows:

  • KSNODETYPE_PROCESSING_MICROPHONE_ARRAY

  • KSNODETYPE_MICROPHONE_ARRAY

  • KSNODETYPE_OMNI_DIRECTIONAL_MICROPHONE

  • Anything else (treated with the same lowest priority; that is, with nRankSubType equal to zero)

For example, consider a system with two audio capture endpoints:



  • A built-in static microphone array endpoint with KSNODETYPE_MICROPHONE_ARRAY.

  • A static microphone endpoint with KSNODETYPE_MICROPHONE.

When the audio subsystem uses the system heuristic to choose the default console capture audio endpoint, it selects the microphone array endpoint. The microphone array is selected because, although both endpoints have the same jack detection capability and form factor, the microphone array’s KsNodeType is prioritized higher than that of the microphone. That is, KSNODETYPE_MICROPHONE_ARRAY is prioritized higher than KSNODETYPE_MICROPHONE, which is not listed and falls into the “anything else” category.


Bus Type


Windows 7 ranks the enum values for endpoint bus types in the following priority order, from highest to lowest priority:

  • BTHENUM

  • BTHHFENUM

  • USB

  • HDAUDIO

  • PCI

  • Others (treated with the same lowest priority; that is, with nRankBusType equal to zero)

General Location


Windows 7 ranks the enum values for general location in the following priority order, from highest to lowest priority:

  • PrimaryBox

  • Internal

  • Separate

  • Others (treated with the same lowest priority; that is, nRankGenLoc is equal to zero)

Audio drivers report the general location infomation of their endpoints through the KSPROPERTY_JACK_DESCRIPTION property. For details, see “Jack Description Property on the MSDN Web site.


Geometric Location


Windows 7 ranks the enum values for geometric location in the following priority order, from highest to lowest priority:

  • Rear

  • Front

  • Left

  • Right

  • Top

  • Bottom

  • RealPanel

  • Others (treated with the same lowest priority; that is, with nRankGeoLoc equal to zero)

Audio drivers report the geometric location infomation of their endpoints through the KSPROPERTY_JACK_DESCRIPTION property. For details, see “Jack Description Property” on the MSDN Web site.


Exception


In addition to the preceding heuristic factors, Windows 7 has an exception for the default console device heuristic. This exception prevents the obvious communication-oriented endpoints—such as Handset and Speakerphone—from being chosen as the default console endpoint. Specifically, the audio subsystem downgrades the WeightedRankValue result for endpoints that have one of the following KSNodeType values:

  • KSNODETYPE_PERSONAL_MICROPHONE

  • KSNODETYPE_HEADSET

  • KSNODETYPE_PHONE_LINE

  • KSNODETYPE_DOWN_LINE_PHONE

  • KSNODETYPE_COMMUNICATION_SPEAKER

  • KSNODETYPE_HANDSET

  • KSNODETYPE_TELEPHONE

  • KSNODETYPE_SPEAKERPHONE_NO_ECHO_REDUCTION

  • KSNODETYPE_ECHO_SUPPRESSING_SPEAKERPHONE

  • KSNODETYPE_ECHO_CANCELING_SPEAKERPHONE

Inbox Heuristic Settings for the Default Communication Audio Endpoint


This section describes the default heuristic settings of each factor for a communication audio endpoint. The factors are listed in priority order; that is, Windows 7 gives highest priority to the first factor in the following list when it calculates the default communications endpoint. The only difference between the heuristics of console default endpoints and communications default endpoints is in the form factor settings and the exception rule.

Jack Detection Capability


The jack detection capability heuristic settings are the same for both default communication audio endpoints and default console audio endpoints.

Form Factor


Different priority lists are created for render communications default devices and capture communications default devices.

The form factor priority for communications default endpoints in priority order (from highest priority to lowest) is as follows:



  • Headset

  • Handset

  • Headphones

  • Speakers

  • LineLevel

  • DigitalAudioDisplayDevice (HDMI or DisplayPort)

  • S/PDIF

  • Anything else (treated with the same lowest priority; that is, with nRankFormFactor equal to zero)

For example, consider a system with the following three audio render endpoints:


When the audio subsystem uses the system heuristic to choose the default console render audio endpoint, it selects the dynamic speakers endpoint even though its speakers’ form factor is prioritized below the headphones form factor of the first endpoint. This is because the dynamic speakers endpoint has jack detection capability, which has a higher priority over form factor, whereas the headphone endpoint does not.

If a dynamic USB headphones endpoint is introduced into the preceding example, the Windows 7 audio subsystem chooses this endpoint as the default console render endpoint because it supports jack detection and its headphones form factor has higher priority than that of the speakers form factor.

KSNodeType


The KsNodeType heuristic settings are the same for both default communication audio endpoints and default console audio endpoints.

Bus Type


The bus type heuristic settings are the same for both default communication audio endpoints and default console audio endpoints.

General Location


The general location heuristic settings are the same for both default communication audio endpoints and default console audio endpoints.

Geometric Location


The geometric location heuristic settings are the same for both default communication audio endpoints and default console audio endpoints.

Exceptions


In addition to the preceding heuristic factors, Windows 7 has an exception for the default console device heuristic. This exception prevents the obvious communication-oriented endpoints—such as Handset and Speakerphone—from being chosen as the default console endpoint. Specifically, the audio subsystem upgrades the WeightedRankValue result for endpoints with a KSNodeType that matches any of the following values:

  • KSNODETYPE_PERSONAL_MICROPHONE

  • KSNODETYPE_HEADSET

  • KSNODETYPE_PHONE_LINE

  • KSNODETYPE_DOWN_LINE_PHONE

  • KSNODETYPE_COMMUNICATION_SPEAKER

  • KSNODETYPE_HANDSET

  • KSNODETYPE_TELEPHONE

  • KSNODETYPE_SPEAKERPHONE_NO_ECHO_REDUCTION

  • KSNODETYPE_ECHO_SUPPRESSING_SPEAKERPHONE

  • KSNODETYPE_ECHO_CANCELING_SPEAKERPHONE

Windows 7 OEM Heuristics Customization


All heuristic settings are controlled through registry settings. Windows 7 is shipped with the inbox default audio endpoint selection behavior. You can customize your systems to meet specific market needs. If you have such a need, send an e-mail to us at uaa@microsoft.com for assistance.

Resources

Microsoft Developer Network (MSDN)


Jack Description Property

http://msdn.microsoft.com/en-us/library/dd419775.aspx



KSPROPERTY_JACK_DESCRIPTION2

http://msdn.microsoft.com/en-us/library/dd573917.aspx



Pin Category Property

http://msdn.microsoft.com/en-us/library/ms790325.aspx



SetupPreferredAudioDevices

http://msdn.microsoft.com/en-us/library/bb981547.aspx





Download 215.24 Kb.

Share with your friends:
1   2   3   4




The database is protected by copyright ©ininet.org 2024
send message

    Main page