Write an audio source filter for use as Lync micro

2019-07-13 03:00发布

I'm trying to write a DirectShow Audio Capture Filter that can be recognized by the Microsoft Lync client as a Microphone source. These are the steps I've already taken:

  1. Filter derives from CSource; its output pin derives from CSourceStream and implements IKsPropertySet and IAMStreamConfig and all necessary methods (inc. IUnknown methods)

  2. Ensure that the appropriate metadata for the AM_MEDIA_TYPE and its WAVEFORMATEX header are set in GetStreamCaps() and GetMediaType()

  3. In fillBuffer(), each media sample is filled with a sine wave test sequence

  4. Created the class factory for the COM server and exported DLL functions in a .def file, registering the filter under CLSID_AudioInputDeviceCategory.

After registering my filter using regsvr32, everything currently works in GraphEdit: the filter displays under Audio Capture Devices, and the tone plays correctly.

GraphEdit.exe demonstration


However, I get different results in "real" programs. In Picasa's webcam tester, for example, the filter displays as an audio source but switching to it crashes the program.

In all versions of the Lync client, the filter doesn't display at all as a Microphone choice under Audio Device -> Microphone. I've read in the Lync documentation that only virtual audio devices with a physical speaker and microphone are returned.

After looking around some more, it seems that Virtual Audio Cable produces the desired effect of being recognized by the system, as shown below:

Lync VAC demo


I require the flexibility of writing my own solution code-wise, which has the added benefit of not needing to purchase a license.

Do I need to switch to Windows Media Foundation, support additional interfaces in my filter, couple the source filter with a hardware speaker source, etc.?

What steps do I need to take to make my filter appear as a Microphone source?

1条回答
冷血范
2楼-- · 2019-07-13 03:18

Lync (Skype for Business) does not use DirectShow for audio capture, so it does not see your virtual device and cannot pick it up. Presumably, it uses WASAPI. Virtual Audio Cable presumably implements a kernel level driver for audio device, which WASAPI picks up and exposes via user mode API. There is no way to connect your virtual audio source to application that does not use DirectShow for audio capture.

查看更多
登录 后发表回答