Sample Code
Windows Driver Samples/ Microsoft slate system virtual audio device driver sample/ C++/ SlateAudioSample/ micarraywavtable.h/
/*++ Copyright (c) Microsoft Corporation All Rights Reserved Module Name: micarraywavtable.h Abstract: Declaration of wave miniport tables for the mic array. --*/ #ifndef _SYSVAD_MICARRAYWAVTABLE_H_ #define _SYSVAD_MICARRAYWAVTABLE_H_ // // Mic array range. // #define MICARRAY_RAW_CHANNELS 2 // Channels for raw mode #define MICARRAY_PROCESSED_CHANNELS 1 // Channels for default mode #define MICARRAY_DEVICE_MAX_CHANNELS 2 // Max channels overall #define MICARRAY_MIN_BITS_PER_SAMPLE_PCM 16 // Min Bits Per Sample #define MICARRAY_MAX_BITS_PER_SAMPLE_PCM 16 // Max Bits Per Sample #define MICARRAY_RAW_SAMPLE_RATE 16000 // Raw sample rate #define MICARRAY_PROCESSED_MIN_SAMPLE_RATE 8000 // Min Sample Rate #define MICARRAY_PROCESSED_MAX_SAMPLE_RATE 16000 // Max Sample Rate // // Max # of pin instances. // #define MICARRAY_MAX_INPUT_STREAMS 2 // Raw + Default streams //============================================================================= static KSDATAFORMAT_WAVEFORMATEXTENSIBLE MicArrayPinSupportedDeviceFormats[] = { // 0 - Note the ENDPOINT_MINIPAIR structures for the mic arrays use this first element as the proposed DEFAULT format // 16 KHz 16-bit mono { { sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), 0, 0, 0, STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) }, { { WAVE_FORMAT_EXTENSIBLE, 1, 16000, 32000, 2, 16, sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) }, 16, KSAUDIO_SPEAKER_MONO, STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) } }, // 1 // 11.025 KHz 16-bit mono { { sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), 0, 0, 0, STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) }, { { WAVE_FORMAT_EXTENSIBLE, 1, 11025, 22050, 2, 16, sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) }, 16, KSAUDIO_SPEAKER_MONO, STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) } }, // 2 // 8 KHz 16-bit mono { { sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), 0, 0, 0, STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) }, { { WAVE_FORMAT_EXTENSIBLE, 1, 8000, 16000, 2, 16, sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) }, 16, KSAUDIO_SPEAKER_MONO, STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) } }, // 3 - Note the ENDPOINT_MINIPAIR structures for the mic arrays use this last element as the proposed RAW format // 16 KHz 16-bit 2 channels { { sizeof(KSDATAFORMAT_WAVEFORMATEXTENSIBLE), 0, 0, 0, STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) }, { { WAVE_FORMAT_EXTENSIBLE, 2, 16000, 64000, 4, 16, sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) }, 16, 0, // No channel configuration for unprocessed mic array STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) } }, }; // // Supported modes (only on streaming pins). // static MODE_AND_DEFAULT_FORMAT MicArrayPinSupportedDeviceModes[] = { { STATIC_AUDIO_SIGNALPROCESSINGMODE_RAW, &MicArrayPinSupportedDeviceFormats[SIZEOF_ARRAY(MicArrayPinSupportedDeviceFormats)-1].DataFormat }, { STATIC_AUDIO_SIGNALPROCESSINGMODE_DEFAULT, &MicArrayPinSupportedDeviceFormats[0].DataFormat } }; // // Index [0] - Pin 1 - KSPIN_WAVEIN_HOST // static PIN_DEVICE_FORMATS_AND_MODES MicArrayPinDeviceFormatsAndModes[] = { { MicArrayPinSupportedDeviceFormats, SIZEOF_ARRAY(MicArrayPinSupportedDeviceFormats), MicArrayPinSupportedDeviceModes, SIZEOF_ARRAY(MicArrayPinSupportedDeviceModes) } }; //============================================================================= // Data ranges // // See CMiniportWaveRT::DataRangeIntersection. // // Both mono and two-channel formats are supported for the mic arrays. The // design of this sample driver's data range intersection handler requires a // separate data for each supported channel count. // static KSDATARANGE_AUDIO MicArrayPinDataRangesRawStream[] = { { { sizeof(KSDATARANGE_AUDIO), KSDATARANGE_ATTRIBUTES, // An attributes list follows this data range 0, 0, STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) }, MICARRAY_RAW_CHANNELS, MICARRAY_MIN_BITS_PER_SAMPLE_PCM, MICARRAY_MAX_BITS_PER_SAMPLE_PCM, MICARRAY_RAW_SAMPLE_RATE, MICARRAY_RAW_SAMPLE_RATE }, }; static KSDATARANGE_AUDIO MicArrayPinDataRangesProcessedStream[] = { { { sizeof(KSDATARANGE_AUDIO), KSDATARANGE_ATTRIBUTES, // An attributes list follows this data range 0, 0, STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM), STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) }, MICARRAY_PROCESSED_CHANNELS, MICARRAY_MIN_BITS_PER_SAMPLE_PCM, MICARRAY_MAX_BITS_PER_SAMPLE_PCM, MICARRAY_PROCESSED_MIN_SAMPLE_RATE, MICARRAY_PROCESSED_MAX_SAMPLE_RATE }, }; static PKSDATARANGE MicArrayPinDataRangePointersStream[] = { PKSDATARANGE(&MicArrayPinDataRangesProcessedStream[0]), PKSDATARANGE(&PinDataRangeAttributeList), PKSDATARANGE(&MicArrayPinDataRangesRawStream[0]), PKSDATARANGE(&PinDataRangeAttributeList), }; //============================================================================= static KSDATARANGE MicArrayPinDataRangesBridge[] = { { sizeof(KSDATARANGE), 0, 0, 0, STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO), STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG), STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) } }; static PKSDATARANGE MicArrayPinDataRangePointersBridge[] = { &MicArrayPinDataRangesBridge[0] }; //============================================================================= static PCPIN_DESCRIPTOR MicArrayWaveMiniportPins[] = { // Wave In Bridge Pin (Capture - From Topology) KSPIN_WAVE_BRIDGE { 0, 0, 0, NULL, { 0, NULL, 0, NULL, SIZEOF_ARRAY(MicArrayPinDataRangePointersBridge), MicArrayPinDataRangePointersBridge, KSPIN_DATAFLOW_IN, KSPIN_COMMUNICATION_NONE, &KSCATEGORY_AUDIO, NULL, 0 } }, // Wave In Streaming Pin (Capture) KSPIN_WAVE_HOST { MICARRAY_MAX_INPUT_STREAMS, MICARRAY_MAX_INPUT_STREAMS, 0, NULL, { 0, NULL, 0, NULL, SIZEOF_ARRAY(MicArrayPinDataRangePointersStream), MicArrayPinDataRangePointersStream, KSPIN_DATAFLOW_OUT, KSPIN_COMMUNICATION_SINK, &KSCATEGORY_AUDIO, &KSAUDFNAME_RECORDING_CONTROL, 0 } } }; //============================================================================= static PCNODE_DESCRIPTOR MicArrayWaveMiniportNodes[] = { // KSNODE_WAVE_ADC { 0, // Flags NULL, // AutomationTable &KSNODETYPE_ADC, // Type NULL // Name } }; //============================================================================= static PCCONNECTION_DESCRIPTOR MicArrayWaveMiniportConnections[] = { { PCFILTER_NODE, KSPIN_WAVE_BRIDGE, KSNODE_WAVE_ADC, 1 }, { KSNODE_WAVE_ADC, 0, PCFILTER_NODE, KSPIN_WAVEIN_HOST } }; //============================================================================= static PCPROPERTY_ITEM PropertiesMicArrayWaveFilter[] = { { &KSPROPSETID_General, KSPROPERTY_GENERAL_COMPONENTID, KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, PropertyHandler_WaveFilter }, { &KSPROPSETID_Pin, KSPROPERTY_PIN_PROPOSEDATAFORMAT, KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_BASICSUPPORT, PropertyHandler_WaveFilter }, { &KSPROPSETID_Pin, KSPROPERTY_PIN_PROPOSEDATAFORMAT2, KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT, PropertyHandler_WaveFilter }, }; DEFINE_PCAUTOMATION_TABLE_PROP(AutomationMicArrayWaveFilter, PropertiesMicArrayWaveFilter); //============================================================================= static PCFILTER_DESCRIPTOR MicArrayWaveMiniportFilterDescriptor = { 0, // Version &AutomationMicArrayWaveFilter, // AutomationTable sizeof(PCPIN_DESCRIPTOR), // PinSize SIZEOF_ARRAY(MicArrayWaveMiniportPins), // PinCount MicArrayWaveMiniportPins, // Pins sizeof(PCNODE_DESCRIPTOR), // NodeSize SIZEOF_ARRAY(MicArrayWaveMiniportNodes), // NodeCount MicArrayWaveMiniportNodes, // Nodes SIZEOF_ARRAY(MicArrayWaveMiniportConnections), // ConnectionCount MicArrayWaveMiniportConnections, // Connections 0, // CategoryCount NULL // Categories - use defaults (audio, render, capture) }; #endif // _SYSVAD_MICARRAYWAVTABLE_H_
Our Services
-
What our customers say about us?
Read our customer testimonials to find out why our clients keep returning for their projects.
View Testimonials