views:

357

answers:

3

I have a stream of PCM audio captured from a cell phone, and I want to play it.

I am trying to find a lightweight method of playing this audio in C++.

I can already slap on a wave header and create a file that plays in any media player, but I want to play the file in real time as it streams in. I would like to avoid writing the file to disc just to read it again, and I also don't want to have pauses in the audio as I stop one file and start another.

I realize that OpenAL provides audio streaming functionality, but I was hoping for something simpler. I only need to play a single channel PCM stream.

Does anyone know of a lightweight, free(for commercial use) library or windows API that can do this?

A: 

It looks like the patent has expired, so there should be no legal complications. The beauty of a patent is that it makes the algorithm public.

wallyk
However, if I used FMOD to play the file, I would have to pay because the software is still under copyright.
Andres
A: 

Playing a single PCM stream is not THAT simple, alas. Its not that hard. I've not used OpenAL but under standard windows audio, XAudio2 or DirectSound its easy to use a double buffered. Play buffer 1 while filling buffer 2 from the stream. Then play buffer2 while filling buffer1 and so on.

Goz
+2  A: 

Use the waveOut API in Windows

joshperry
Perfect, just what I was looking for!
Andres