[wdmaudiodev] Re: Virtual Audio Driver development based on AVStream model.

  • From: Robert Bielik <robert.bielik@xxxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Mon, 13 Dec 2010 19:49:08 +0100

Anton Shpakovsky skrev 2010-12-13 11:26:
Thanks for the answer, Rob.

Yes, that's a kind of solution, but:
virtual audio cable is a playback device also. I would not like to confuse user 
- I want a microphone device only.

I'm now looking forward to modify msvad CopyFrom function, but I'm a bit 
scared. So many questions on this topic are on the web
and it looks like nobody has succeeded in. I would appreciate if someone could 
provide me with their modifications of msvad.

Don't be scared, get readin' ;) The WDK docs that is. I'm afraid I can't share 
any code with you, both because it really belongs
to a client and also because it nowhere near does what you need, but in short 
you need to:

1. Modify the wavtable.h nodes to have only a KSNODETYPE_ADC
2. Modify mintopo.cpp so that:

PHYSICALCONNECTIONTABLE TopologyPhysicalConnections =
{
    ULONG(-1), // KSPIN_TOPO_WAVEOUT_SOURCE,  TopologyIn
    KSPIN_TOPO_WAVEIN_DEST,     // TopologyOut
    KSPIN_WAVE_CAPTURE_SOURCE,  // WaveIn
    ULONG(-1), // KSPIN_WAVE_RENDER_SOURCE    WaveOut
};

That _should_ take care of the rendering pin of the VAD (so it won't appear in 
sound control panel, right Tim ? )

3. Modify toptable.h to only have the nodes that you really need, f.i. you can 
remove all nodes in there that has anything
to do with rendering audio. Be careful though that the nodes that you keep are 
"connected" (in the MiniportConnections)

4. As you've also gathered, implement the 
CMiniportWaveCyclicStreamMSVAD::CopyFrom method to read from a file. You might 
be
able to use libsndfile to do the actual reading. How you supply the path of the 
file to read is up to you, might be in the registry,
or another setting file. Also, pay attention to the format so that you write 
correctly into the supplied buffer (i.e. interleaved
data with correct no of bits)

MSVAD has an implementation to get a timer IRQ every 10 ms wherein it will 
update the DMA position. This incrementing of the DMA position (and notifying 
PortCls) will induce calls to CopyFrom to get the data.

Plus: And this is really, REALLY important. Once you've decided to take the red 
pill, setup a virtual machine with VirtualBox and use
VirtualKD (http://virtualkd.sysprogs.org/) + Visual Studio to setup a debugging 
environment for your driver. It will save you a LOT of headaches, not to 
mention blown-up heads ;)

I'm scared, my head is goind to blow up..

I know. Been there, done that. Was really a mess to clean it up ;)

/Rob
******************

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.com/

Other related posts: