Muokkaa

Jaa


Multiple Audio Subdevices

A multifunction device can contain two or more audio subdevices. For example, an adapter driver might allow an eight-channel audio device to be exposed to the system as four stereo channels. When writing an adapter driver to expose multiple subdevices in this way, you should incorporate information about the subdevices into your driver's startup sequence and INF file.

First, your adapter driver should expose each stereo subdevice as a separate instance of a port/miniport driver pair during the startup sequence. Several of the sample adapters in the Microsoft Windows Driver Kit (WDK) implement an InstallSubdevice function that creates and registers a subdevice consisting of a system port driver, a miniport driver, and a set of resources that are to be bound to this pair. During startup, your driver should call its InstallSubdevice function once for each stereo subdevice and specify a unique name for each port/miniport driver pair.

In addition, the unique name you assign to this pair must match the KSNAME string that you specify in your driver's INF file. For example, your driver might assign the names "Wave1" and "Wave2" to two subdevices during startup, as shown below:

  InstallSubdevice(..., "Wave1",...);
  InstallSubdevice(..., "Wave2",...);

In this case, the same names should appear in the INF file:

  KSNAME_Wave1="Wave1"
  KSNAME_Wave2="Wave2"

Your INF file should add interfaces that contain these names:

  AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Wave1%,Test.Interface.Wave1
  AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Wave2%,Test.Interface.Wave2

The INF file should create AddReg sections (see INF AddReg Directive) in order to add information about these interfaces to the registry:

  [Test.Interface.Wave1]
  AddReg=Test.I.Wave1.AddReg

  [Test.Interface.Wave2]
  AddReg=Test.I.Wave2.AddReg

The AddReg sections should also specify the registry entries for each subdevice:

  [Test.I.Wave1.AddReg]
  HKR,,CLSID,,%Proxy.CLSID%
  HKR,,FriendlyName,,%Test.Wave1.szName%

  [Test.I.Wave2.AddReg]
  HKR,,CLSID,,%Proxy.CLSID%
  HKR,,FriendlyName,,%Test.Wave2.szName%

Finally, the INF file should define the friendly names for these subdevices:

  Test.Wave1.szName="Punch"
  Test.Wave2.szName="Judy"

The friendly names show up in the audio control panel to identify the subdevices.