• Welcome to Valhalla Legends Archive.
 

Recording from line in?

Started by Zorm, October 20, 2003, 08:19 PM

Previous topic - Next topic

Zorm

Anyone happen to know how to record from line in using C++? Would like to save it to mp3 but I can deal with saving it to wav and converting.
"Now, gentlemen, let us do something today which the world make talk of hereafter."
- Admiral Lord Collingwood

Adron

As with everything, there are several ways. I've used two of them.

You can use MCI which is simple and not very powerful at all. Send a command to start recording to a file, another to stop.

You can use the low level audio functions - much more powerful. You pass buffers to the sound card, it fills them with wave input data. These are what I mostly use for capturing sound.

You could probably also use DirectSound/DirectShow, which might enable you to both capture and encode audio in realtime. I have no experience with doing that programmatically though.


To switch to the right input, you might want to use the audio mixer services

It seems that the Audio Compression Manager might allow you to do the mp3 encoding programmatically, if you have such a codec. Many applications use LAME instead.

Zorm

Thanks Adron great information. +1
"Now, gentlemen, let us do something today which the world make talk of hereafter."
- Admiral Lord Collingwood

Adron

Actually, I forgot to ask what OS it was for, I just assumed Windows. For linux, I have a fully working recording app that reads from line in and writes mp3 files using a forked lame.

Banana fanna fo fanna

If you are looking for apps to do it, LAME, Winamp, and Cooledit can do it rather well.