C++ 中的连续流 PCM 数据?

发布于 2024-08-14 04:26:00 字数 286 浏览 1 评论 0原文

我有从手机捕获的 PCM 音频流,我想播放它。

我正在尝试找到一种在 C++ 中播放此音频的轻量级方法。

我已经可以使用波形头并创建一个可以在任何媒体播放器中播放的文件,但我想在文件流入时实时播放该文件。我想避免将文件写入光盘只是为了再次读取它,而且我也不希望在停止一个文件并启动另一个文件时音频出现暂停。

我意识到 OpenAL 提供了音频流功能,但我希望有更简单的功能。我只需要播放单通道 PCM 流。

有谁知道一个轻量级的、免费的(用于商业用途)库或Windows API可以做到这一点?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

林空鹿饮溪 2024-08-21 04:26:00

使用 waveOut API在Windows中

Use the waveOut API in Windows

瀟灑尐姊 2024-08-21 04:26:00

看起来专利已经过期,所以应该不会有法律上的麻烦。专利的美妙之处在于它使算法公开。

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.

反目相谮 2024-08-21 04:26:00

唉,播放单个 PCM 流并不是那么简单。这并不难。我没有使用过 OpenAL,但在标准 Windows 音频、XAudio2 或 DirectSound 下,它很容易使用双缓冲。播放缓冲区 1,同时从流填充缓冲区 2。然后播放buffer2,同时填充buffer1,依此类推。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文