Handmade Hero»Forums»Code
Thompson Lee
20 posts
None
How do you obtain microphone input?
I've decided to try jumping ship and code something entirely new based on Casey's code.

Currently, this is what I did so far:



I am looking around in the MSDN documentation on IDirectSound8 to see if there are some articles telling you how to capture microphone inputs.

My guess is that if you could grab the sample values of the microphone inputs and put the values into the Secondary Buffer, you would be able to hear what you say into the microphone.

But, as a novice IDirectSound8 user, I am lost after looking for it for a while. If anyone could point me the path, I will be grateful for your help.

Thanks in advance.
Mārtiņš Možeiko
2565 posts / 2 projects
How do you obtain microphone input?
Yes, you can use DirectSound to get microphone input. You can get this input by using IDirectSoundCapture8 interface. You use it to create special capture buffer (IDirectSoundCaptureBuffer8 which will be filled by DirectSound with input from microphone. You can copy information out from this buffer to Secondary Buffer if you want to hear microphone input. Or save it disk, or send by network. Etc...

Here is nice overview about sound capture with DirectSound: http://msdn.microsoft.com/en-us/library/ee416968.aspx It includes information for each step you need to do - create capture device object, create capture buffer, and how to start capture.