Link to home
Start Free TrialLog in
Avatar of Gordonp
GordonpFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Playing Microphone Input.

I'm looking for code to read in the audio input from the Microphone and play it out again throught the soundcard.

I believe it can be done using the waveIn* and waveOut* api calls but I cant suss out the buffer stuff.

Thanks in advance
Gordon
Avatar of Wyn
Wyn

Hi,Gordon .There are many ways to record input from soundcard.

Qed:
1. MCIWnd Window Class

Recording with MCIWnd Controls
http://msdn.microsoft.com/library/psdk/multimed/mciwnd_0e43.htm 

2. MCI

Recording with a Waveform-Audio Device
http://msdn.microsoft.com/library/psdk/multimed/mci_4wpx.htm 

3. Waveform Audio

Example of Writing Waveform Data
http://msdn.microsoft.com/library/psdk/multimed/wave_8rj5.htm 

Recording and Playing Waveform Audio
http://msdn.microsoft.com/library/techart/msdn_spellit.htm 

4. DirectSound

Tutorial 2: Capturing a Sound
http://msdn.microsoft.com/library/psdk/directx/dstut_9ox0.htm

Regards
And here are some info you need:

some samples:
Audio Mixer Functions Demo
http://www.codeguru.com/multimedia/ADMixer.shtml 


http://msdn.microsoft.com/workshop/c-frame.htm?944437056110#/workshop/imedia/windowsmedia/sdk/wmsdk_fmt.asp

And if you want to use waveinxxx waveoutxx .I can write another sample but it will take some time.First check above info.

Regards
W.Yinan
Avatar of Gordonp

ASKER

Wyn>
All bar one of your links are for recording an audio input, and the other link is broken.

I want to play the audio input straight out again on the speakers, not record it into a file.

GordonP
I know what you want and Okay now I will write one for you .But I dont think it's big different to above!

Waiting....
One Directions:
Use threads for this application. One for receiving and playing the voice you are receiving and another for recording and sending the voice.

One question:
Is your card duplex?
Avatar of Gordonp

ASKER

> One question:
> Is your card duplex?
Yes!
You will find code how to record in above links.Here is how to play them concurrently

The MM_WIM_DATA message will be sent when the input structure are filled.
Then you create a create in handler code:

case MM_WIM_DATA:
_beginthread(doit,0,buffer);
The doit will the function you want to do with the buffer.

Avatar of Gordonp

ASKER

can I just use one buffer! do I need to use synchro for buffer access??

GordonP
Avatar of Gordonp

ASKER

the link "Recording and Playing Waveform Audio" doesnt work.

I assume this would have shown me how to read the data into the buffer, do you have a working link for this!!

GordonP
ASKER CERTIFIED SOLUTION
Avatar of Wyn
Wyn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

->can I just use one buffer! do I need to use synchro for buffer access??  
================
All above:)
Avatar of Gordonp

ASKER

Thanks I'll try it and get back to you

Gordon
Avatar of Gordonp

ASKER

Thanks for your help

Gordon
I have a problem in that I have two sound cards in the one machine and I am having troubles selecting the individual device under waveinopen.  It keeps returning error 32 any help