In Windows 7 we published a white paper which shows how Windows chooses which audio device should be the default. This remains true for Windows 8 and Windows 8.1.
The six factors that are considered for each device are:
- Jack detection capability
- Whether KSJACK_DESCRIPTION2.JackCapabilities has the JACKDESC2_PRESENCE_DETECT_CAPABILITY flag set
- USB audio devices have jack detection capability grandfathered in
- Form factor: PKEY_AudioEndpoint_FormFactor
- Kernel Streaming node type: PKEY_AudioEndpoint_JackSubType (this comes from KSPIN_DESCRIPTOR.Category field set by the driver)
- Bus type: HD Audio, Bluetooth, USB, etc.
- General location: IKsJackDescription's KSJACK_DESCRIPTION.GenLocation
- Geometric location: IKsJackDescrption's KSJACK_DESCRIPTION.GeoLocation
Each factor has an associated preference list and a weight. Generally speaking, items that appear higher in the list above have priority over items that appear lower.
I wrote a tool that uses public APIs to query each of these six factors for all devices on the system. Source and binaries are attached.
Here's what it outputs on my system that has a built-in HD Audio device and an external USB device plugged in:
>defaultaudiodevice.exe
Render devices: 4
Speakers (High Definition Audio Device)
Id: {0.0.0.00000000}.{2089b0a1-893b-45fa-b6e8-ec84ee827c06}
KSJACK_DESCRIPTION2.JackCapabilities: presence detection not supported
PKEY_AudioEndpoint_FormFactor: 1 (Speakers)
PKEY_AudioEndpoint_JackSubType: {DFF21CE1-F70F-11D0-B917-00A0C9223196} (KSNODETYPE_SPEAKER)
PKEY_Device_EnumeratorName: HDAUDIO
KSJACK_DESCRIPTION.GenLocation: 0 (eGenLocPrimaryBox)
KSJACK_DESCRIPTION.GeoLocation: 13 (eGeoLocATAPI)
Speakers (USB Audio)
Id: {0.0.0.00000000}.{4bf6c88a-9b54-46cc-9eb0-91c5fa468ed6}
IKsJackDescription2 not supported
PKEY_AudioEndpoint_FormFactor: 1 (Speakers)
PKEY_AudioEndpoint_JackSubType: {DFF21CE1-F70F-11D0-B917-00A0C9223196} (KSNODETYPE_SPEAKER)
PKEY_Device_EnumeratorName: USB
IKsJackDescription not supported
Speakers (High Definition Audio Device)
Id: {0.0.0.00000000}.{89482885-856d-4b7b-88ed-3ffa4944f14b}
KSJACK_DESCRIPTION2.JackCapabilities: presence detection supported
PKEY_AudioEndpoint_FormFactor: 1 (Speakers)
PKEY_AudioEndpoint_JackSubType: {DFF21CE1-F70F-11D0-B917-00A0C9223196} (KSNODETYPE_SPEAKER)
PKEY_Device_EnumeratorName: HDAUDIO
KSJACK_DESCRIPTION.GenLocation: 0 (eGenLocPrimaryBox)
KSJACK_DESCRIPTION.GeoLocation: 1 (eGeoLocRear)
SPDIF Interface (USB Audio)
Id: {0.0.0.00000000}.{c2c47ae1-abe1-43fa-825a-871bab831cf4}
IKsJackDescription2 not supported
PKEY_AudioEndpoint_FormFactor: 8 (SPDIF)
PKEY_AudioEndpoint_JackSubType: {DFF21FE5-F70F-11D0-B917-00A0C9223196} (KSNODETYPE_SPDIF_INTERFACE)
PKEY_Device_EnumeratorName: USB
IKsJackDescription not supported
Capture devices: 3
Microphone (USB Audio)
Id: {0.0.1.00000000}.{139b7b57-28d2-46de-9fce-702c0944c03f}
IKsJackDescription2 not supported
PKEY_AudioEndpoint_FormFactor: 4 (Microphone)
PKEY_AudioEndpoint_JackSubType: {DFF21BE1-F70F-11D0-B917-00A0C9223196} (KSNODETYPE_MICROPHONE)
PKEY_Device_EnumeratorName: USB
IKsJackDescription not supported
Line (USB Audio)
Id: {0.0.1.00000000}.{67982570-bdea-4524-82ac-3d15d2b5ae89}
IKsJackDescription2 not supported
PKEY_AudioEndpoint_FormFactor: 2 (LineLevel)
PKEY_AudioEndpoint_JackSubType: {DFF21FE3-F70F-11D0-B917-00A0C9223196} (KSNODETYPE_LINE_CONNECTOR)
PKEY_Device_EnumeratorName: USB
IKsJackDescription not supported
SPDIF Interface (USB Audio)
Id: {0.0.1.00000000}.{72b7efb6-c21a-4415-84e5-292d8a5b2b11}
IKsJackDescription2 not supported
PKEY_AudioEndpoint_FormFactor: 8 (SPDIF)
PKEY_AudioEndpoint_JackSubType: {DFF21FE5-F70F-11D0-B917-00A0C9223196} (KSNODETYPE_SPDIF_INTERFACE)
PKEY_Device_EnumeratorName: USB
IKsJackDescription not supported
Jack Detection Capability
The first render device does not have jack presence detection, and the other three do. (Note the USB audio devices have grandfathered-in jack presence detection, even though the USB audio class driver does not support IKsJackDescription2.) This puts the first render device out of the running.
Form Factor
The fourth render device has form factor SPDIF, and the second and third have form factor Speakers. This puts the fourth render device out of the running, since the heuristics consider Speakers more attractive than SPDIF.
Kernel Streaming node type
The two remaining render devices both have form factor KSNODETYPE_SPEAKER, so they are tied.
Bus type
The second render device has bus type USB, and the third render device has bus type HD Audio. The default device heuristics prefer USB to HD Audio, so the second render device becomes the default audio render device.