New Page 1
{ Not invented here }
Unless I scribble this down somewhere,
I will forget. So let me dump my memory . .
Kernel Streaming is a fairly
complicated topic. And to study this, the available resources are the DDK
help documentation and the samples. AFAIK, there are no books written on this
topic. And what is present online is also meager.
The Streaming Devices (Video &
Audio) subsection of the DDK help, has everything documented.
Now, in order to emulate a
virtual audio hardware, we have to write an Audio Miniport Adapter driver. The
MSAVD sample source code can be used for this purpose.
WHDC
Audio Device Technologies for Windows [http://www.microsoft.com/whdc/device/audio/default.mspx]
Getting Started with WDM Audio Drivers
[http://www.microsoft.com/whdc/device/audio/wdmaud-drv.mspx]
This is how the audio device stack will
look like.
System
Audio Device (SysAudio.sys) |
Kernel
Mixer (Kmix.sys) |
Streaming
Class Driver (stream.sys) |
Port
Class Driver (PortCls.sys) |
USB
Audio (USBAudio.sys) |
USB
Device |
Adapter
Driver |
USB
Controller |
Audio
Device |
The Adapter Driver is what we write and
for a virtual audio device it will be a modified MSAVD driver.
Modifying the MSAVD Driver to make
your own virtual audio device.
In Kernel Streaming, every component is
a Filter. Filters have input (sink) and output (source) pins. Data enters a
filter through its input pin and leaves through the output pin. Every filter has
a purpose : to process the data flowing through them.
As an audio device (virtual or real),
your hardware will have a range of audio data parameters which can be accepted.
Or in other words, only data complying to a specific format and parameter range
can be accepted by the input pins. This is called the property of the pin.
Specify those ranges in the PinDataRangesStream
static variable of the MSAVD source code.
Now, in the WaveCyclic miniport
there are two methods named CopyTo and CopyFrom for copying audio
data to and from the audio device's memory (DMA). Add code to those
function to implement a virtual write and read and the minimal audio driver code
is complete.