I'm in the process of writing an app to record audio using DirectSound. Of all the samples I have looked at allows one to specify the capture device. I would like to be able to select which input to use, i.e., line1, line2, microphone, ... I know this can be done via the "open volume controls" by right clicking on the volume icon in the system tray. I want to do this in my program.
I've searched MSDN using the keyword "mixer" but the results deal with mixing playback sounds. Looking at the DirectSound reference page didn't yield any results either.
Any ideas on what I can search for
Thanks again,
LGuy

Selecting Input within DirectSound
SimonS_
Hi,
just wanted to tell you that what you want to do is described in this project
http://www.codeproject.com/cs/media/directxcapture.asp
But it's all done with functions made by the author so you will have to do some serious analysis of his sourcecode =)
BTW, I'm trying to find the same info as you
/Jonas
Serene Seraph
The way directX work is that you setup for the system a function to call
(a callback function)
It's not you who call that function but the system itself
(when you ask him to enumerate)
The system, not you, will look into each device on your PC
and call that function repeatedly Not to make anything work but just to give you info
It is very much the way the screen resolution setup work it ''enumerate''
So for each device the system find installed in your pc
the system call the function...since you know that you ''only''
have to catch those call in a Table that you can access later
In that table will be 3 device if the system found tree device and call your callback
3 times...
Exemple: you set up this call back in your code
MyCallBack(Info){
Table
=Info;
i++;
}
You call this
EnumerateAllInputDevice(my call back is MyCallBack);
The system call your call back 3 times
You are left with a table of 3 entry each containing info to each device
MyDevice->Setmyinfo(Table[0]);
You choose one of the three to select your input device
(all this is only a sample...not the real function in any way)
Allmost all Hardward function work this way...
Hope this help
http://msdn.microsoft.com/library/default.asp url=/library/en-us/directx9_c/directsoundcaptureenumerate.asp
m00gle
- It's an unmanaged function call
- The managed equivalent is DevicesCollection().
If I am right, then this isn't what I'm looking for. If I'm wrong, then I don't understand how DirectsoundCaptureEnumerate works.In the Win32 world, it looks like one would use calls to mixerOpen() and the like.
Is there an mixerOpen() equivalent within DirectSound
LGuy
112ilias
You set up the call back function :
http://msdn.microsoft.com/library/default.asp url=/library/en-us/directx9_c/DSEnumCallback.asp
This will be call for each device
and give you the ID of all the Input Device one call at a time
You have to save those in a global table value
lpGuid
Address of the GUID that identifies the device being enumerated, or NULL for the
primary device. This value can be passed to the DirectSoundCreate8 or
DirectSoundCaptureCreate8 function to create a device object for that driver.
You put one of those lpGuid entry in this:
HRESULT DirectSoundCaptureCreate8(
LPCGUID lpcGUID,
LPDIRECTSOUNDCAPTURE8 * lplpDSC,
LPUNKNOWN pUnkOuter
);
You will select the input device you want...
(NULL is the default Capture device that you can set manually)
According to what you tell me it's call DevicesCollection in managed code
It's the same principle...in some form this collection
will include entry for each input device
You will need to find which is which in that collection
And retreive the info for the input device you want to select
then use some sort of DirectSoundCreateCaptureBuffer with the info
I'm not good in Managed code but maybe others can help you
It must go something like (just a far from it example...)
DevicesCollection(0).Info = is the primary line
DevicesCollection(1).Info = is the line 2
DevicesCollection(2).Info = is the microphone line
etc...
you use that GUID in the Info to create your capture buffer
Something like:
DirectSoundCaptureCreate8(DeviceCollection(1).Info.GUID)
Something of that kind...will select the input line you want to use
Probably that in managed code it's a lot easier to use then in C++
Hopefully others can explain to you how those collection work in managed code
Musa34252
I'm in the same situation as the originator of this thread.
Can MS say lound and clear that it is impossible to enumerate & select an individual input (e.g. Microphone) when using DirectSound It is possible with DirectShow which is , as I understand, a layer above DirectSound - so how come it is not possible with DirectSound
I need this for a C++ application that searches for an audio pattern on all possible computer inputs.
Thanks
parthsaha
I've come to the conclusion that managed DirectSound does not offer what I want to do. I was hoping that whatever was available in the Win32 world would be available in the managed DirectSound.
Thanks for your help,
LGuy