Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DirectShow-Add USB audio render but sound not come out the USB hea

10 views
Skip to first unread message

Thanh

unread,
Sep 14, 2009, 5:46:11 PM9/14/09
to
My computer is set to use internal speaker for playback but have an "USB
sound device" plugin. I want my app to output audio to USB headset. I create
an 'USB' audio render by matching the filter, add the filter to the
IGraphBuilder and then call RenderFile. The audio is still output to internal
speaker.
here is the code:
IGraphBuilder *pGB;
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&pGB);
IBaseFilter *pNewRenderFilter = GetAudioPlaybackFilter();
if( pNewRenderFilter )
hr = pGB->AddFilter( (IBaseFilter *) pNewRenderFilter, L"USB Renderer" );
pGB->RenderFile(wFile, NULL);

Before add the USB filter, I enumerate the filters on the IGraphBuilder and
get:
Default DirectSound Device
MPEG Layer-3 Decoder
MPEG-1 Stream Splitter
mp3 audio filename

When I add the USB filter, I enumerate the filters on the IGraphBuilder and
get:
USB renderer
MPEG-1 Stream Splitter
mp3 audio filename
(I notice MPEG Layer-3 Decoder is missing)

Why the playback is not using the USB device? Am I doing something wrong here?
Any help will be appreciate.
-Thanh

Daniel Sundberg

unread,
Sep 15, 2009, 2:51:46 AM9/15/09
to

You could try to add a file source and then use "manual" rendering of
the graph using:

ICaptureGraphBuilder2::RenderStream

Please take a look at the DirectShow samples for more information.

Thanh

unread,
Sep 15, 2009, 1:12:02 PM9/15/09
to

Thanks Daniel.
The problem was solved.
I was using the old APIs and created a wrong filter: IFilterMapper,
IEnumRegFilters and create "device name" render filter
New code: IFilterMapper2, IEnumMoniker and create "DirectSound: device name"
filter.

0 new messages