Question

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?

Was it helpful?

Solution

Use the waveOut API in Windows

OTHER TIPS

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top