Andres
Andres

Reputation: 5187

Continuous Streaming PCM data in C++?

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?

Upvotes: 2

Views: 5609

Answers (3)

joshperry
joshperry

Reputation: 42227

Use the waveOut API in Windows

Upvotes: 2

Goz
Goz

Reputation: 62323

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.

Upvotes: 0

wallyk
wallyk

Reputation: 57774

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.

Upvotes: 0

Related Questions