次の方法で共有


SetupPreferredAudioDevices

SetupPreferredAudioDevices キーワードは、優先オーディオ デバイスを表します。これは、システムに 1 つ以上のオーディオ デバイスが含まれている場合にオーディオ システムが既定で有効にするデバイスです。 このキーワードはメディア クラス固有であり、Microsoft Windows Millennium Edition/Windows 98、Microsoft Windows 2000、Windows XP、Windows Vista でサポートされています。 SetupPreferredAudioDevicesis は Windows 7 ではサポートされていません。

オーディオ デバイスを作成する場合、アプリケーション プログラムは、デバイスを明示的に指定する代わりに、既定の (または優先される) デバイスを使用するように選択できます。 (For example, see the descriptions of the waveOutOpen and DirectSoundCreate functions in the Microsoft Windows SDK documentation.)

オーディオ システムは、システム レジストリ内の現在の優先オーディオ デバイスを追跡します。 ユーザーが新しいオーディオ デバイスをインストールしてシステムをアップグレードすると、通常、デバイスをインストールする独自の INF ファイルによってレジストリが更新され、新しいデバイスが優先オーディオ デバイスとして指定されます。

The SetupPreferredAudioDevices keyword can appear within a registry-update directive in the add-registry-section (see INF AddReg Directive) of an INF file for an audio device. このディレクティブの形式は次のとおりです。

reg-rootkey, [reg-subkey]SetupPreferredAudioDevices [flags], [dword-value]

このディレクティブは、デバイスのオーディオ機能をサウンド再生、サウンド録音、MIDI 音楽再生の既定値として使用するようにオーディオ システムに指示します。 Following installation, these three defaults appear in the Sounds and Multimedia control panel under the Audio tab. The user can use Control Panel to change the default devices.

The directive's dword-value parameter specifies a DWORD value that should be nonzero in order to enable the directive. この値が 0 の場合、ディレクティブは無効になります。 Because Windows Me/98 do not support the REG_DWORD registry data type, however, dword-value is typically expressed as a 4-byte REG_BINARY type instead of as a DWORD (for example, as "01,00,00,00" instead of "0x00000001"). The dword-value parameter can be specified in raw binary format by setting the directive's flags parameter to "1" (FLG_ADDREG_BINVALUETYPE).

このディレクティブは、デバイスのドライバーがインストールされるときに有効になります。 新しいデバイスのインストール時に別のデバイスが優先デバイスの役割を占める場合、ディレクティブは新しいデバイスに優先デバイスの役割を引き受け、他のデバイスをこの役割から置き換えます。

既にインストールされているデバイスのドライバーをアップグレードまたは再インストールする場合は、サウンド再生、サウンド録音、MIDI 音楽再生のためにユーザーの現在の優先デバイス選択を変更しないようにすることができます。 If so, set the FLG_ADDREG_NOCLOBBER bit in the flags parameter, which causes the directive to take effect only if this is the device's initial installation.

の例

次の例は、SetupPreferredAudioDevices キーワードの使用方法を示す INF ファイルの一部です。

  AddReg = XYZ-Audio-Device.AddReg
  ...
  [XYZ-Audio-Device.AddReg]
  HKR,,SetupPreferredAudioDevices,3,01,00,00,00

この例の最後にあるディレクティブは、"XYZ-Audio-Device" という名前のデバイスが優先オーディオ デバイスになったことを指定します。 HKR は、レジストリ内のオーディオ デバイスのルート キーです。 The flags parameter is set to 3, which is the bitwise OR of FLG_ADDREG_BINVALUETYPE and FLG_ADDREG_NOCLOBBER. 後者は、デバイスが既にインストールされていて、そのドライバーがアップグレードされているだけの場合に、デバイスの既存の優先デバイス レジストリ エントリが上書きされないようにします。 ディレクティブの末尾にある 4 バイトは、ディレクティブを有効にするために必要な 0 以外の値を指定します。

With the current implementation of the SetupPreferredAudioDevices keyword in Windows Vista, any audio endpoint with its dword-value set to an odd number can be set as the default device. 適切なエンドポイントが既定のデバイスとして設定されていることを確認するには、関連するエンドポイントを含む KS フィルターが最後に公開されていることを確認します。 これは、AudioEndpointBuilder サービスがプロパティ ストアの設定と既定のデバイスの設定に使用するアルゴリズムが原因で行う必要があります。