Virtual miniport audio driver to another sound card?

Hello everyone,

May I ask for tips / advice if it is possible and what to google to get my company’s wave cyclic virtual miniport audio driver to be able to render directly to the current/other audio driver without going to usermode if possible?

I’ve try using a DirectKS example off the net which uses a kernel streaming but that doesn’t work in Vista as I always get overlapped I/O error when trying to connect. Does the Vista’s WASAPI lock the default sound card? Is there a way of outputting audio directly from one driver to another audio driver? What do I need to look into to get this to work?

Thank you for any help / tips you can provide.

Cheers
Obble.

xxxxx@nchsoftware.com wrote:

May I ask for tips / advice if it is possible and what to google to get my company’s wave cyclic virtual miniport audio driver to be able to render directly to the current/other audio driver without going to usermode if possible?

I’ve try using a DirectKS example off the net which uses a kernel streaming but that doesn’t work in Vista as I always get overlapped I/O error when trying to connect. Does the Vista’s WASAPI lock the default sound card? Is there a way of outputting audio directly from one driver to another audio driver? What do I need to look into to get this to work?

If your audio render device is an HDAudio device, as most motherboard
devices are, then there’s no way to do this. WaveRT drivers do not
accept audio streams directly. The audio is copied into the device’s
circular buffer by the protected audio process in user mode.

Are you trying to solve some specific problem, or just experimenting?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

On 6/10/2009 11:26 AM, Tim Roberts wrote:

xxxxx@nchsoftware.com wrote:

> May I ask for tips / advice if it is possible and what to google to get my company’s wave cyclic virtual miniport audio driver to be able to render directly to the current/other audio driver without going to usermode if possible?
>
> I’ve try using a DirectKS example off the net which uses a kernel streaming but that doesn’t work in Vista as I always get overlapped I/O error when trying to connect. Does the Vista’s WASAPI lock the default sound card? Is there a way of outputting audio directly from one driver to another audio driver? What do I need to look into to get this to work?
>
>
If your audio render device is an HDAudio device, as most motherboard
devices are, then there’s no way to do this. WaveRT drivers do not
accept audio streams directly. The audio is copied into the device’s
circular buffer by the protected audio process in user mode.

Are you trying to solve some specific problem, or just experimenting?

Hello Tim,

I am trying to solve a problem of rendering audio from my company’s
driver without lag. I thought it would be possible to keep the audio in
the kernel space then lag would be reduce. Currently my virtual audio
card renders to a listening client through a pipe and that output audio
back through to the right audio driver, but going thru that way would
mean going through WinMM / DirectX then through WASAPI (on vista/win7)
and then the kmixer which I heard adds 20ms lag alone, then thru
Portcrl->audio driver. So I am trying to see if theres a way to output
audio directly to PortCrl or the right audio driver since I am already
in the kernel mode.

Thanks for your above reply.

Hello All,

I’ve heard that Kernel Streaming is a way of creating a Direct Show
filter in kernel mode.
May I enquirer if anyone knows that :

* Is this is different than an application called “DirectKS” from MS
which I’ve read is the same thing but I don’t believe it. This Dks
seems to be opening an audio driver from user mode.
* Is creating a KS filter allows for lag free (almost) output of
audio to another speaker?
* Is this the best way to go to output audio from an virtual audio
driver?

Tips / Suggestions would be greatly appreciated.

Cheers
Obble.

>>I’ve try using a DirectKS example off the net which uses a kernel
streaming but that doesn’t work in Vista as I always get >>overlapped I/O
error when trying to connect.

why cant you try out WASAPI in exclusive mode, this will surely reduce the
latency, some examples should be out their in the net…

On Tue, Oct 6, 2009 at 9:10 AM, Obble Smith NCHSoftware <
xxxxx@nchsoftware.com> wrote:

Hello All,

I’ve heard that Kernel Streaming is a way of creating a Direct Show filter
in kernel mode.
May I enquirer if anyone knows that :

  • Is this is different than an application called “DirectKS” from MS
    which I’ve read is the same thing but I don’t believe it. This Dks seems to
    be opening an audio driver from user mode.
  • Is creating a KS filter allows for lag free (almost) output of audio
    to another speaker?
  • Is this the best way to go to output audio from an virtual audio
    driver?

Tips / Suggestions would be greatly appreciated.

Cheers
Obble.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Hello Dennis,

I was hoping for an approach that will work on 2K & xp as well. I read
that WASAPI was introduced in Vista.

Cheers
Obble

Yes, WASAPI is VISTA onwards…

On Tue, Oct 6, 2009 at 10:09 AM, Obble Smith NCHSoftware <
xxxxx@nchsoftware.com> wrote:

Hello Dennis,

I was hoping for an approach that will work on 2K & xp as well. I read
that WASAPI was introduced in Vista.

Cheers
Obble


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> and then the kmixer

No kmixer in Vista/Win7


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Obble Smith NCHSoftware wrote:

I’ve heard that Kernel Streaming is a way of creating a Direct Show
filter in kernel mode.

Well, sort of. Kernel Streaming is the generic name for all of the
streaming driver models (basically, all audio and video drivers).
Stream class, port class, AVStream and BDA are all kernel streaming drivers.

There happens to be a generic DirectShow filter (ksproxy) that allows
any kernel streaming driver to participate in a DirectShow graph.

May I enquirer if anyone knows that :

* Is this is different than an application called “DirectKS” from
MS which I’ve read is the same thing but I don’t believe it.
This Dks seems to be opening an audio driver from user mode.

DirectKS is a user-mode library that allows an application to talk
directly to a kernel streaming driver, without going through DirectShow
or ksproxy. You submit the KS ioctls yourself. It is commonly used for
audio apps, although it can do video as well.

* Is creating a KS filter allows for lag free (almost) output of
audio to another speaker?

The question isn’t meaningful. Your real audio driver and your virtual
audio driver are both kernel streaming filters already.

* Is this the best way to go to output audio from an virtual audio
driver?

What is your virtual audio driver actually doing? Tell us more detail
about the product – otherwise we can’t offer you any meaningful advice.

There is no “best way” to get audio output from a virtual audio driver.
Generally, a virtual audio driver is virtual – no connection to
hardware. If you need to filter the output stream, then you should be
using a filter driver (pre-Vista) or a GFX APO (Vista and beyond)


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Obble Smith NCHSoftware wrote:

I am trying to solve a problem of rendering audio from my company’s
driver without lag. I thought it would be possible to keep the audio
in the kernel space then lag would be reduce. Currently my virtual
audio card renders to a listening client through a pipe and that
output audio back through to the right audio driver, but going thru
that way would mean going through WinMM / DirectX then through WASAPI
(on vista/win7) and then the kmixer which I heard adds 20ms lag
alone, then thru Portcrl->audio driver. So I am trying to see if
theres a way to output audio directly to PortCrl or the right audio
driver since I am already in the kernel mode.

Do you actually have a lag problem, or are you embarking on this journey
under the assumption that you will have a lag problem?

Kmixer no longer exists in Vista, so that’s not an issue.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Hi Tim,

/Do you actually have a lag problem, or are you embarking on this journey
under the assumption that you will have a lag problem
Kmixer no longer exists in Vista, so that’s not an issue./

/There is no “best way” to get audio output from a virtual audio driver.
Generally, a virtual audio driver is virtual – no connection to
hardware. If you need to filter the output stream, then you should be
using a filter driver (pre-Vista) or a GFX APO (Vista and beyond)/

I am assuming that there will be a noticeable lag delay The primary
reason is to keep the audio in the kernel is the I’ve been told the client
doesn’t want to have any issues with copy right. Our audio driver is
being converted for them to use. They will receive through a pipe the
audio snippets at regular intervals but not constantly, this will allow
them to detect what tv show is playing but can’t be accused of copying
every. So that leaves me in the situation where I am trying to figgure
out a way to piping the audio stream to the sound card as quick as
possible without the stream ever touching the usermode application they
would have.

And my manager is asking me to try and to one approach for
2k,xp,vista/win7 if possible but I got the feeling I forced to do 2
approaches?

Thanks for telling me about APOs, I will research into them as well.
Any tips on how I should implement this redirect?

Cheers
Obble.

Obble Smith NCHSoftware wrote:

And my manager is asking me to try and to one approach for
2k,xp,vista/win7 if possible but I got the feeling I forced to do 2
approaches?

The Microsoft audio subsystem was substantially redesigned for Vista.
It really is very, very different from what it was before. A driver for
XP can be made to work on Vista, but if you’re doing trickery, it’s
often going to take two solutions.

By the way, there is another excellent mailing list called “wdmaudiodev”
designed specifically for people doing Windows audio drivers. There are
a lot of people doing loony high-end stuff there, and the Microsoft
audio team even drops by from time to time.
http://www.freelists.org/list/wdmaudiodev

Thanks for telling me about APOs, I will research into them as well.
Any tips on how I should implement this redirect?

You have dropped a couple of snippets here and there, but we still have
no real clue what the path is here. Where does your driver fit? What’s
the input, what’s the output?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Hi Tim,

I just learn about wdmaudiodev about 10 seconds ago, :slight_smile:

My goal is to have a audio driver that will listen in on all outgoing
sounds (because its the default sound card) and output that captured
rendered audio to the real audio out so people can listen to it but
with the /full/ audio stream entering back into user-mode.

Because it’s a virtual sound card not really connected to the hardware,
it will need to play the audio to the previous soundcard (The real
speakers).
The custom virtual driver is the way the usermode application can listen
in on the on the audio data so it can do statistical reporting.

Currently I have this:

Games/Apps -> DirectX/WinMM -> [wasapi on vista] -> PortCrl -> Audio Driver -> Mini AudioDriver(*My Virtual Sound card Driver*)

What I would like is:

Games/Apps -> DirectX/WinMM -> [wasapi on vista] -> PortCrl ->
Audio Driver -> Mini AudioDriver(*My Virtual Sound card Driver*) -> [/*voodoo magic*/] -> Audio Driver -> Mini AudioDriver(*Real PC Speakers*)

I hope this provides enough information for you.

Obble Smith NCHSoftware wrote:

My goal is to have a audio driver that will listen in on all outgoing
sounds (because its the default sound card) and output that captured
rendered audio to the real audio out so people can listen to it but
with the /full/ audio stream entering back into user-mode.

Because it’s a virtual sound card not really connected to the
hardware, it will need to play the audio to the previous soundcard
(The real speakers).
The custom virtual driver is the way the usermode application can
listen in on the on the audio data so it can do statistical reporting.

Currently I have this:
Games/Apps -> DirectX/WinMM -> [wasapi on vista] -> PortCrl -> Audio Driver -> Mini AudioDriver(*My Virtual Sound card Driver*)

What I would like is:
Games/Apps -> DirectX/WinMM -> [wasapi on vista] -> PortCrl ->
Audio Driver -> Mini AudioDriver(*My Virtual Sound card Driver*) -> [/*voodoo magic*/] -> Audio Driver -> Mini AudioDriver(*Real PC Speakers*)

I hope this provides enough information for you.

The obvious architectural choice here (for 2K and XP) is to write a WDM
(or KMDF) filter driver that sits above the standard audio driver and
intercepts the streaming output requests. There’s no point in writing a
completely separate driver. The filter driver approach has the added
advantage that the users will still refer to the normal audio driver,
instead of having to use your driver’s name.

For Vista, the obvious choice (to me) is a GFX APO, as I suggested
earlier. That has some installation trickiness, but it’s solveable.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

On 7/10/2009 11:10 AM, Tim Roberts wrote:

Obble Smith NCHSoftware wrote:

> My goal is to have a audio driver that will listen in on all outgoing
> sounds (because its the default sound card) and output that captured
> rendered audio to the real audio out so people can listen to it but
> with the /full/ audio stream entering back into user-mode.
>
> Because it’s a virtual sound card not really connected to the
> hardware, it will need to play the audio to the previous soundcard
> (The real speakers).
> The custom virtual driver is the way the usermode application can
> listen in on the on the audio data so it can do statistical reporting.
>
> Currently I have this:
> Games/Apps -> DirectX/WinMM -> [wasapi on vista] -> PortCrl -> Audio Driver -> Mini AudioDriver(*My Virtual Sound card Driver*)
>
> What I would like is:
> Games/Apps -> DirectX/WinMM -> [wasapi on vista] -> PortCrl ->
> Audio Driver -> Mini AudioDriver(*My Virtual Sound card Driver*) -> [/*voodoo magic*/] -> Audio Driver -> Mini AudioDriver(*Real PC Speakers*)
>
>
> I hope this provides enough information for you.
>
>
The obvious architectural choice here (for 2K and XP) is to write a WDM
(or KMDF) filter driver that sits above the standard audio driver and
intercepts the streaming output requests. There’s no point in writing a
completely separate driver. The filter driver approach has the added
advantage that the users will still refer to the normal audio driver,
instead of having to use your driver’s name.

For Vista, the obvious choice (to me) is a GFX APO, as I suggested
earlier. That has some installation trickiness, but it’s solveable.

Thank you very much for pointing me in the right direction, I will do
as you suggest Tim.

Cheers
Obble.