[wdmaudiodev] Re: WASAPI:Write to input device's endpoint buffer?

  • From: Matthew van Eerde <Matthew.van.Eerde@xxxxxxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Wed, 3 Dec 2014 17:56:23 +0000

No, you can't write to an IAudioCaptureClient, or read from an 
IAudioRenderClient. Virtual audio drivers get audio to the Windows engine by 
implementing a Kernel Streaming filter, usually via a portcls WaveRT miniport.

For example, see the Slate Virtual Audio Device Driver sample. 
https://code.msdn.microsoft.com/windowsapps/slate-system-virtual-audio-f241062f/view/SourceCode

From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of fanggai318wy
Sent: Monday, December 1, 2014 6:37 PM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] WASAPI:Write to input device's endpoint buffer?

Hi,

To implement a virtual microphone, there is a virtual audio driver and an
application,who is responsible for receiving voice data from network and save to
local.

The common way is:
Windows recorder <-> Windows high level audio API(WHLA API) <-> virtual audio
driver(VAD) <-> virtual microphone

But there is no standard way to hand the audio data received from network to
VAD, so I want to complete this by using Core Audio APIs in the following way:

Windows recorder <-> WHLA API <-> EndPoint Buffer <-> virtual audio driver(VAD)
The virtual audio driver still provide a standrad interface to system, but the
difference is directly writting audio data to virtual microphone's endpoint
buffer, not to VAD.

Diagram about EndPoint
buffer:http://msdn.microsoft.com/en-us/library/windows/desktop/dd316780(v=vs.85).
aspx

On 
MSDN(http://msdn.microsoft.com/en-us/library/windows/desktop/dd316764(v=vs.85).aspx),
there is only samples of capture(get) data from input device(microphone),
and render(set) data to output device(player), I'm not sure
whether can I write to input device's endpoint buffer? Pseudo code is following:

while (true) {
    CaptureClient->GetBuffer(pBuf); // get microphone's endpoint buffer
    memcpy(pBuf, audioData); // write audio data to gotten buffer
    CaptureClient->ReleaseBuffer();
}

Thanks

Other related posts: