Write an audio source filter for use as Lync microphone

霸气de小男生 提交于 2019-12-24 05:43:33

问题


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.


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:


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:


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.



来源:https://stackoverflow.com/questions/31706844/write-an-audio-source-filter-for-use-as-lync-microphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!