[wdmaudiodev] Re: USB2.0 High speed audio device for windows XP

  • From: <carsten_30_@xxxxxx>
  • To: <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Wed, 20 Feb 2008 16:40:01 +0100

Hi Devendra

I do not know if I can post attachments, so I put the code in here, wich means 
loss of formattig (sorry). I don't no if my code really helps. I'll be lucky, 
if some can send me a modified version of avssamp/awshws (from the dkk) with a 
modified inf, where the audio pin is accessible as a system audio device.

FILTER:

/**************************************************************************

    DESCRIPTOR AND DISPATCH LAYOUT

**************************************************************************/

GUID g_PINNAME_AUDIO_CAPTURE = {0x12345678, 0x0000, 0x0000, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00}; 

const GUID VolumeNodeType = {STATICGUIDOF(KSNODETYPE_SRC)};

const KSNODE_DESCRIPTOR KsNodeDescriptors[] = {DEFINE_NODE_DESCRIPTOR( NULL, 
&VolumeNodeType, NULL ) };

//    -------------
//  1-| 0 Node0 1 |-  Audio
//    -------------
const
KSTOPOLOGY_CONNECTION
KsConnections[] =
{
    { KSFILTER_NODE, 1, 0, 0 },
    { 0, 1, KSFILTER_NODE, 0 },
};

//
// CaptureFilterCategories:
//
// The list of category GUIDs for the capture filter.
//
const GUID CaptureFilterCategories [CAPTURE_FILTER_CATEGORIES_COUNT] = 
{
    STATICGUIDOF (KSCATEGORY_AUDIO),
    STATICGUIDOF (KSCATEGORY_CAPTURE)
};

//=============================================================================
static KSDATARANGE PinDataRangesBridge[] = {
{
    sizeof(KSDATARANGE),
    0,
    0,
    0,
    STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),
    STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG),
    STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE)
}
};

const KSDATARANGE_AUDIO PCM_Capture = 
{
    //
    // KSDATARANGE
    //
    {   
        sizeof (KSDATARANGE_AUDIO),                 // FormatSize
        0,                                          // Flags
        0,                                          // SampleSize ignored?
        0,                                          // Reserved

        STATICGUIDOF (KSDATAFORMAT_TYPE_AUDIO),     // aka. MEDIATYPE_AUDIO
        STATICGUIDOF (KSDATAFORMAT_SUBTYPE_PCM),    // aka. 
        STATICGUIDOF (KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) // 
    },

    2,    // MaximumChannels;
    16,    // MinimumBitsPerSample;
    16,    // MaximumBitsPerSample;
    32000, // MinimumSampleFrequency;
    48000, //  MaximumSampleFrequency;
};
  
//
// CapturePinDataRanges:
//
// This is the list of data ranges supported on the capture pin. 
//
const PKSDATARANGE CapturePinDataRanges [CAPTURE_PIN_DATA_RANGE_COUNT] = 
{
    (PKSDATARANGE) &PCM_Capture,
};

//=============================================================================
static
PKSDATARANGE PinDataRangePointersBridge[] = {&PinDataRangesBridge[0]};


//
// CaptureFilterPinDescriptors:
//
// The list of pin descriptors on the capture filter.  
//
const KSPIN_DESCRIPTOR_EX CaptureFilterPinDescriptors 
[CAPTURE_FILTER_PIN_COUNT] = 
{
    //
    // Capture Pin
    //
    {
        &CapturePinDispatch,
        NULL,             
        // KSPIN_DESCRIPTOR
        {
            NULL, 0,                          // Interfaces (NULL, 0 == default)
            NULL, 0,                          // Mediums (NULL, 0 == default)
            SIZEOF_ARRAY (CapturePinDataRanges), // Range Count
            CapturePinDataRanges,           // Ranges
            KSPIN_DATAFLOW_OUT,             // Dataflow
            KSPIN_COMMUNICATION_SINK,       // Communication
            &KSCATEGORY_CAPTURE, // &KSCATEGORY_AUDIO,              // Category
            &KSAUDFNAME_RECORDING_CONTROL,  // Name
            0                               // Reserved
        },
        
        //KSPIN_FLAG_GENERATE_MAPPINGS |      // Pin Flags
            KSPIN_FLAG_DISPATCH_LEVEL_PROCESSING |
            KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY,
        1,                                  // Instances Possible
        1,                                  // Instances Necessary
        &CapturePinAllocatorFraming,        // Allocator Framing
        reinterpret_cast <PFNKSINTERSECTHANDLEREX> 
            (CCapturePin::IntersectHandler)
    },

    // bridge pin
    {   
        NULL,
        NULL,
        {
            0, NULL, // SIZEOF_ARRAY(PinInterfaces), PinInterfaces,
            0, NULL, // SIZEOF_ARRAY(PinMediums),    PinMediums,
            SIZEOF_ARRAY(PinDataRangePointersBridge), 
            PinDataRangePointersBridge, //Ranges..
            KSPIN_DATAFLOW_IN,
            KSPIN_COMMUNICATION_NONE,
            &KSNODETYPE_SPDIF_INTERFACE,     // Category
            &KSNODETYPE_SPDIF_INTERFACE,     // Name
            0
        },
        KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY | // Flags
          KSPIN_FLAG_FIXED_FORMAT,
        1, //InstancesPossible
        0, //InstancesNecessary
        NULL,
        NULL
    }
};

//
// CaptureFilterDispatch:
//
// This is the dispatch table for the capture filter.  It provides notification
// of creation, closure, processing (for filter-centrics, not for the capture
// filter), and resets (for filter-centrics, not for the capture filter).
//
const KSFILTER_DISPATCH CaptureFilterDispatch = 
{
    CCaptureFilter::DispatchCreate,         // Filter Create
    NULL,                                   // Filter Close
    NULL,                                   // Filter Process
    NULL                                    // Filter Reset
};

//
// CaptureFilterDescription:
//
// The descriptor for the capture filter.  We don't specify any topology
// since there's only one pin on the filter.  Realistically, there would
// be some topological relationships here because there would be input 
// pins from crossbars and the like.
//
const KSFILTER_DESCRIPTOR CaptureFilterDescriptor = 
{
    &CaptureFilterDispatch,                 // Dispatch Table
    NULL,                                   // Automation Table
    KSFILTER_DESCRIPTOR_VERSION,            // Version
    0,                                      // Flags
    &KSNAME_Filter,                         // Reference GUID
    DEFINE_KSFILTER_PIN_DESCRIPTORS (CaptureFilterPinDescriptors),
    DEFINE_KSFILTER_CATEGORIES (CaptureFilterCategories),
    DEFINE_KSFILTER_NODE_DESCRIPTORS(KsNodeDescriptors),
    DEFINE_KSFILTER_CONNECTIONS(KsConnections),
    NULL                                    // Component ID
};


One possible inf (I tried lots of infs so far)

;-------------------------------------------------------------------------------
; general sections :
;-------------------------------------------------------------------------------
[Version]
Signature="$CHICAGO$"
Class=MEDIA
ClassGUID ={4d36e96c-e325-11ce-bfc1-08002be10318}
provider=%Company%
LayoutFile=layout.inf
DriverVer=08/15/2005,2.6.0

[ControlFlags]
; All PnP devices should be excluded from manual AddDevice Applet list
ExcludeFromSelect=*

[DestinationDirs]
SPDIFDriver.CopyFiles=10,system32\drivers

[PreCopySection]
HKR,,NoSetupUI,,1

; ================= Device section=====================
[Manufacturer]
%Company%=Company

[Company]
%USB\VID_1218&PID_0030.DeviceDesc%=DrvInstall,USB\VID_1218&PID_0030

;-------------------------------------------------------------------------------
; platform install sections
;-------------------------------------------------------------------------------
[DrvInstall]
Include=ks.inf, kscaptur.inf, dshowext.inf       
AlsoInstall=KS.Registration,KSCAPTUR.Registration, DSHOWEXT.Registration 
CopyFiles=SPDIFDriver.CopyFiles
AddReg=DrvInstall.AddReg,DrvInstall.PinNames

[DrvInstall.NT]
Include=ks.inf,kscaptur.inf,dshowext.inf       
Needs=KS.Registration,KSCAPTUR.Registration.NT, DSHOWEXT.Registration
CopyFiles=SPDIFDriver.CopyFiles
AddReg=DrvInstall.AddReg,DrvInstall.PinNames
          

[DrvInstall.AddReg]
HKR,,DevLoader,,*NTKERN
HKR,,NTMPDriver,,SPDIF_USB_AudioDriver.sys

[SPDIFDriver.CopyFiles]
SPDIF_USB_AudioDriver.sys

;-------------------------------------------------------------------------------
; services sections
;-------------------------------------------------------------------------------
[DrvInstall.NT.Services]
Addservice = SPDIF_AUDIO, 0x00000002, DrvInstall.ServiceInstall

[DrvInstall.ServiceInstall]
DisplayName=%SPDIFDRV.SvcDesc%
ServiceType=%SERVICE_KERNEL_DRIVER%
StartType=%SERVICE_DEMAND_START%
ErrorControl=%SERVICE_ERROR_NORMAL%
ServiceBinary=%10%\system32\drivers\SPDIF_USB_AudioDriver.sys
LoadOrderGroup=ExtendedBase


;-------------------------------------------------------------------------------
; interfaces sections
;-------------------------------------------------------------------------------
[DrvInstall.Interfaces]
AddInterface=%KSCATEGORY_CAPTURE%,%KSSTRING_FILTER%,DrvInstall.C.Interface
AddInterface=%KSCATEGORY_AUDIO%,%KSSTRING_FILTER%,DrvInstall.A.Interface

AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Wave%,UsbAudio.I.Wave
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Topology%,UsbAudio.I.Topo


[DrvInstall.NT.Interfaces]
AddInterface=%KSCATEGORY_CAPTURE%,%KSSTRING_FILTER%,DrvInstall.C.Interface
AddInterface=%KSCATEGORY_AUDIO%,%KSSTRING_FILTER%,DrvInstall.A.Interface

AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Wave%,DrvInstall.W.Interface
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Topology%,DrvInstall.T.Interface

[DrvInstall.C.Interface]
AddReg=DrvInstall.C.Interface.AddReg

[DrvInstall.C.Interface.AddReg]
HKR,,CLSID,,%ProxyVCap.CLSID%
HKR,,FriendlyName,,%USB\VID_1218&PID_0030.DeviceDesc.CInterface%

[DrvInstall.A.Interface]
AddReg=DrvInstall.A.Interface.AddReg

[DrvInstall.A.Interface.AddReg]
HKR,,CLSID,,%ProxyVCap.CLSID%
HKR,,FriendlyName,,%USB\VID_1218&PID_0030.DeviceDesc.AInterface%

[DrvInstall.W.Interface]
AddReg=DrvInstall.W.Interface.AddReg

[DrvInstall.W.Interface.AddReg]
HKR,,CLSID,,%ProxyVCap.CLSID%
HKR,,FriendlyName,,%USB\VID_1218&PID_0030.DeviceDesc.WInterface%

[DrvInstall.T.Interface]
AddReg=DrvInstall.T.Interface.AddReg

[DrvInstall.T.Interface.AddReg]
HKR,,CLSID,,%ProxyVCap.CLSID%
HKR,,FriendlyName,,%USB\VID_1218&PID_0030.DeviceDesc.TInterface%

;-------------------------------------------------------------------------------
; pinnames
;-------------------------------------------------------------------------------
[DrvInstall.PinNames]
;Audio capture pin name
HKLM,SYSTEM\CurrentControlSet\Control\MediaCategories\{12345678-0000-0000-00000000000000000},Name,0,%AudioCapturePinName%
HKLM,SYSTEM\CurrentControlSet\Control\MediaCategories\{12345678-0000-0000-00000000000000000},Display,1,00,00,00,00


;-------------------------------------------------------------------------------
; string sections
;-------------------------------------------------------------------------------

[Strings]

;----------------
; Non-Localizable
;----------------

; note: only register value is case sensitive, key is not.
KSSTRING_Filter="{9B365890-165F-11D0-A195-0020AFD156E4}"

ProxyVCap.CLSID="{17CCA71B-ECD7-11D0-B908-00A0C9223196}"
KSCATEGORY_AUDIO="{6994AD04-93EF-11D0-A3CC-00A0C9223196}" 
KSCATEGORY_RENDER="{65E8773E-8F56-11D0-A3B9-00A0C9223196}" 
KSCATEGORY_CAPTURE="{65E8773D-8F56-11D0-A3B9-00A0C9223196}"
KSCATEGORY_VIDEO="{6994AD05-93EF-11D0-A3CC-00A0C9223196}"
KSCATEGORY_CROSSBAR="{a799a801-a46d-11d0-a18c-00a02401dcd4}"
KSCATEGORY_TVTUNER="{a799a800-a46d-11d0-a18c-00a02401dcd4}"
KSCATEGORY_TVAUDIO="{a799a802-a46d-11d0-a18c-00a02401dcd4}"

SERVICE_KERNEL_DRIVER=1
SERVICE_DEMAND_START=3
SERVICE_ERROR_NORMAL=1
 
KSNAME_Wave="Wave"
KSNAME_Topology="Topology"

;----------------
; Localizable
;----------------

Company="Company"
USB\VID_1218&PID_0030.DeviceDesc="USB Audio Driver"
SPDIFDRV.SvcDesc="USB Audio Driver(SPDIF_USB_AudioDriver.sys)"
USB\VID_1218&PID_0030.DeviceDesc.CInterface="USB Audio Driver CInterface"
USB\VID_1218&PID_0030.DeviceDesc.AInterface="USB Audio Driver AInterface"
USB\VID_1218&PID_0030.DeviceDesc.WInterface="USB Audio Driver WInterface"
USB\VID_1218&PID_0030.DeviceDesc.TInterface="USB Audio Driver TInterface"
AudioCapturePinName="SPDIF Audio Capture Pin Name"

Other related posts: