This tutorial is the final part of the three part tutorial on audio capture with DirectShow. This part uses the infinite pin tee filter to provide preview (pre-listen) while saving the file.
Since I have written two other tutorials which are the building grounds for this one, they should be read through thoroughly. Following are the other two tutorials:
Using the code
The only code that is extra from the second part of the tutorial is that of the infinite pin tee filter. The filter connects with the audio input, and the outputs of the tee filters connect with two filters, the AudioRecorder WAV Dest filter and the speakers, and in my case, the headphones, too.
Following is the code where the filter is read, added to the graph, and the connections are made:
DEVICE_CLSID = CLSID_LegacyAmFilterCategory;
bstrDeviceName = SysAllocString(L"Infinite Pin Tee Filter");
pDeviceMonik = Device_Read(pDeviceEnum,pDeviceMonik,
pPinTeeFilter = Device_Init(pDeviceMonik,pPinTeeFilter);
bstrInPinName = SysAllocString(L"Capture");
bstrOutPinName = SysAllocString(L"Input");
bstrInPinName = SysAllocString(L"Output1");
bstrOutPinName = SysAllocString(L"In");
bstrInPinName = SysAllocString(L"Output2");
bstrOutPinName = SysAllocString(L"Audio Input pin (rendered)");
After the connections are made, we are ready to go. The
run() method kick starts the graph.
I hope this small series of tutorials on getting to know the use of DirectShow filters would be helpful for beginners. I deliberately broke apart the whole process into three steps so that a newbie could have a better insight at how, at each step, things are built around filters. How filters are read, instantiated, connected, and finally used to do something useful for us. To be honest, when I started DirectShow programming, it was very difficult to get to a starting point. MSDN tells a lot about filters, but I personally found MSDN quite hard to grasp as you need to loop back into your past to get a grasp of what is being explained.
I enjoyed my journey here, I hope you did too. Thanks for all your time!
The code is built with the following
- Windows Server 2008
- Microsoft Visual Studio 2008
- DirectX 10.1
- Microsoft Windows SDK 6.1
-I am a die hard fan of C/C++ programming. It is poetry and I love the poems of C++.
-I tell people that C# is "NOTHING" compared to C++ and I always say that!
My interest lie in Signal Processing, Image Processing,Video Processing, Pattern Recognition, DSP, Communications. Though I have no ONE stop in terms of interests.