[wdmaudiodev] Re: newbie questions about filter drivers

  • From: Tim Roberts <timr@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Thu, 14 Oct 2004 09:04:13 -0700

dprado@xxxxxxxxxxxxxx wrote:

I have been trying for the last two weeks (without much success) to make some
sense out of the DDK documentation. I real Water Oney´s book understood some of
it :).


There are no books that cover streaming drivers.

The problem is, I want to write a driver that I believed was very
simple, but still haven´t figured out the best approach. Maybe someone can
enlighten me. Basically I have a USB audio adapter that is fulley compliant
with usbadudio.sys BUT, I would like to create two virtual devices ( called for
exemple LeftChannelUSB and RightChannelUSB ), and would like allow this devices
to behave as a "standard audio device". What I mean by this is that I would
like for example to be able to select LeftChannelUSB as a "Default Device" for
sound playback on CP Sound and Audio Devices Properties. When a user app writes
to one of these virtual audio devices ( for example LeftAudioUSB) , it should
mix Left and Right channels and write both of them on the Left Channel of
usbaudio.
Would it be possible to write a Virtual Device driver (like a filter driver) and
stack it on top of usbaudio using the LowerFilter reg key?


That's a rather strange request. If you're trying to do this to support an application, it would be better to do this kind of thing in user mode, either in the application code, or in a DShow filter graph.


To do this as you have described it, you need to have two audio devices created. You could conceivably write a lower filter to usbaudio.sys that creates two separate PDOs. As filter drivers go, a usbaudio.sys filter is one of the easier choices, but that all changes when you have to touch the streaming data. You will need to intercept both of the streaming endpoints and mix the two. This is going to be very complicated. How are you going to manage synchronization? You won't be getting the two streams at the same time, of course.

What's the real purpose here?

Would I be better off trying a rewrite of usbaudio.sys?



Good lord, no. There are 10 years of development and debugging in usbaudio.sys.


Is it easy or even possible to do
some minimal audio filtering using a filter ( in the sense of IRP filtering )
driver ( changing data before and then forwarding an IRP )?



Well, when you are a lower filter to usbaudio.sys, you're actually manipulating URBs, not IRPs. (OK, URBs are all contained in IRPs, but that's not the point). Yes, it is certainly possible to filter audio data that way. I've done three products where the hardware was not quite USB Audio-Class compliant, and in each case I was able to write a relatively simple lower filter to usbaudio.sys that manipulated the configuration descriptors and intercepted the control interface requests so that they looked compliant. Worked great, and even passed WHQL.


However, neither of those had to touch the streaming interface: I just passed them through (after changing the interface number). What you're talking about is not "minimal audio filtering". You're talking about buffering, synchronizing, and mixing. That's a whole lot of work.

As you can see I am totally lost, any info in this subject will be greatly
appreciated.



As always here, what you should do is tell us what you actually want to do, NOT how you think you need to do it. Give us the real use case, and we can probably offer some do-able suggestions.


--
- 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

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.de/

Other related posts: