to capture the buffer of a microphone

拈花ヽ惹草 提交于 2019-12-11 10:50:59

问题


I am creating a program that will record microphone audio and convert it into mp3 using the DirectShow API in Visual C++. There is no built in filter to convert to convert audio into MPEG Layer 3 i.e. MP3 so i want to send the mic buffer to an external library called as LAME , it will convert the data in MP3 and then i can write it to a file using a file writer. But the problem is that i dont know how to access the buffer of the microphone , please help me i am new in directshow programming..

or tell me any other way to do it


回答1:


If you want to distribute your application then I will suggest to use Sample Grabber instead of Lame DirectShow Encoder filter. This will avoid filter registration but you will need to handle conversion logic.

Regarding using LAME encoder,

  1. what is the return value of hr = pOutputDevice->FindPin().
  2. you can give a try using GraphEdit and check for pin properties.



回答2:


You should be able to do this using a Sample Grabber.

You set it up with a callback object that will receive the samples. You can create a graph with just the source, the sample grabber and a Null Renderer.



来源:https://stackoverflow.com/questions/27243500/to-capture-the-buffer-of-a-microphone

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