Re: Enumurating Audio devices like DirectSound using DirectShow
- From: "Chris P. [MVP]" <msdn@xxxxxxxxxxxx>
- Date: Mon, 18 Apr 2005 12:21:30 -0400
On 18 Apr 2005 01:07:45 -0700, Tareq Ahmed Siraj wrote:
> Hi all,
> I'm very new to DirectShow programming and did some DirectSound
> programming in the past. So please correct me if i am wrong with
> anything.
> I'm creating an application for rec/playback supporting audio
> compression through directshow filters. I've used the code from "Using
> the System Device Enumerator" documentation and for rendering devices,
> i get 4 devices for my 1 sound card (1. Default DirectSound Device, 2.
> Default Waveout device, 3. DirectSound: SoundMAX Audio, 4. SoundMax
> Audio). But in DirectSound, I get 2 devices (1. Primary Sound Driver,
> 2. SoundMax Audio) which is more convenient for the user. Is there any
> way to get this list like directsound does? Currently, the only
> solution I can think about is string comparing the FriendlyName with
> the ones i dont want in the list. Just wondering... why does Default
> DirectSound device show up in DirectShow enumuration instead of
> DirectSound Enumuration?
Yes the defaults are called different things, don't ask me why :) The
reason things show up twice is because both WinMM and DirectSound are
enumerated. All DirectSound device outputs are prefixed with
"DirectSound:" except for the default which is always called "Default
DirectSound Device". The default has the highest merit.
> Another thing is, In DirectSound, we get a GUID associated with the
> sound driver. Here, I only get a IMoniker* ... how do i retrieve the
> GUID associated with the specific sound device? and if possible to
> retrieve the GUID, is it possible to create a basefilter from the GUID
> from that device?
You can create a IBaseFilter pointer by calling BindToObject(). If you are
creating a user list for example, store the IMoniker* and when the user
selects the device call BindToObject() with the IMoniker*. If your only
interested in DirectSound outputs then filter out the WinMM devices using
string comparison (not graceful but it works).
IBaseFilter *pRenderer=NULL;
hr = pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&pRenderer);
> Also, I'm wondering what other properties i can read from the property
> bag other than FriendlyName.
You can retrieve the CLSID, but it is not the DirectSound GUID. All
DirectShow audio renderers have the exact same CLSID except for custom
renderers. You can also retrieve the FilterData which contains the Merit
and some other standard DirectShow information.
.
- Follow-Ups:
- Re: Enumurating Audio devices like DirectSound using DirectShow
- From: Tareq Ahmed Siraj
- Re: Enumurating Audio devices like DirectSound using DirectShow
- References:
- Enumurating Audio devices like DirectSound using DirectShow
- From: Tareq Ahmed Siraj
- Enumurating Audio devices like DirectSound using DirectShow
- Prev by Date: Re: Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
- Next by Date: Re: Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
- Previous by thread: Enumurating Audio devices like DirectSound using DirectShow
- Next by thread: Re: Enumurating Audio devices like DirectSound using DirectShow
- Index(es):
Relevant Pages
|
Loading