[wdmaudiodev] Re: Multi-channel audio USB driver development

  • From: Tim Roberts <timr@xxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Wed, 30 Jun 2010 09:50:03 -0700

The obvious answer is to architect your hardware so that it meets the
USB Audio Class Spec.  That way, you don't have to write a driver at
all.  Your device will plug and play on every modern operating system.

> As there seem to be many audio driver models and APIs, my head is
> spinning a little.
> This is what I have learned from my research so far - please correct
> me if I am wrong!
> WDM is a standard format for writing drivers. So audio drivers written
> in this format may access audio
> APIs such as DirectSound or MME. Later versions of DS support
> multi-channel audio.
> WDM-KS means that no APIs such as these are used, the application can
> stream straight to the drivers kernel.

No, that's not really the case.  Audio drivers happen to be WDM, as are
virtually all drivers in Windows today, but that's irrelevant.  The
streaming frameworks build on top of WDM.

Audio drivers use kernel streaming.  There are a two versions of kernel
streaming (KS 2 is AVStream), although they have a great deal in
common.  An audio driver is usually either "port class" or "stream
class", where the "class" defines the port/miniport model you will use. 
Usbaudio.sys is an AVStream driver.

> ASIO also operates like this for low-latency, does this mean that ASIO
> is essentially an audio driver that follows the WDM-KS format?

Well, not really.  ASIO is mostly a user-mode framework.  It allows
applications to bypass the intermediate layers and talk directly to the
manufacturer's audio driver, much like DirectKS.  An ASIO "driver" is a
(thin) user-mode wrapper around an existing kernel-mode driver.  It
would be possible, I suppose, to create a separate kernel-mode driver
that pairs directly with an ASIO driver, but to my knowledge no one does

> DirectKS is an API that can be used to write kernel streaming drivers,
> with similarly low latency to ASIO.

No.  DirectKS is a user-mode API that allows applications to access
kernel streaming drivers.  It is not used to WRITE kernel streaming drivers.

> WDM is an older format, and so the WDF model should be followed for OS
> that support it (Vista, 7).

Yes and no.  ;)  WDF is a great technology, and is supported back to
Windows 2000.  However, WDF is not used for streaming drivers.  All of
the benefits provided by WDF are already being provided by the kernel
streaming frameworks.  The two frameworks collide with each other.

> For a USB audio driver, the AVStream class should be used. Portcls.sys
> and the newer WaveRT are for PCI devices only.

I would call that a reasonable assessment, although like many statements
in this area, there are those who would disagree.

>>> The ASIO driver talks to the kernel driver just like any other application. 
>>> In the case of usbaudio.sys, it uses the kernel streaming API
> If it need to build a kernel driver ? > If it needed not , the ASIO
> communicate to who ? The Usbaudio.sys ? or the USB bus driver?

For a USB Audio Class Device, ASIO talks to usbaudio.sys.

>> You shouldn't need to develop anything. There is already an ASIO driver for 
>> USB audio devices.
> So for example, if I want to develop an ASIO spec driver (ie that will
> be loaded from the hardware upon plugging it into the USB port, and
> enable
> multi-channel low latency streaming), but  "there is already an ASIO
> driver for USB audio devices", then what do I need to write?

Nothing.  If your device meets USB Audio Class, you don't write
anything.  Microsoft provides usbaudio.sys, and ASIO4ALL provides the
ASIO layer for ASIO applications.

> What type of driver do other manufacturers of hardware interfaces
> typically implement?

USB audio device manufacturers don't write drivers.

> Do they need to pay licenses to Steinberg for using ASIO?

You have to register, but there is no license fee.  However, the
ASIO4ALL driver already handles any WDM audio device.  There's no need
to develop anything at all.  ASIO applications will provide what they need.

> Sorry for the long post and so many questions, essentially it comes
> down to this - what is the simplest approach for developing my driver,
> so it can work at low latency across multiple versions of Windows?

Up to this point, you have not defined what "low latency" means to you.

Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.


WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx


Other related posts: