ALSA:全双工 C 示例?
C 语言中有全双工 ALSA 连接的示例吗?我读到它是受支持的,但我看到的所有介绍性示例都要么录制要么播放声音样本,但我希望有一个处理程序可以为我的 VoIP 应用程序执行这两种操作。
非常感谢您的帮助, 延斯
is there an example of a full-duplex ALSA connection in C? I've read that it is supported, but all the introductory examples I saw did either record or play a sound sample, but I'd like to have one handler that can do both for my VoIP-app.
Big thanks for help,
Jens
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
一些名叫 Alan 的人发布了这个很好的(但旧的)教程, 全双工 ALSA,用 C 编写。
Some guy named Alan has published this good (but old) tutorial, Full Duplex ALSA, which is written in C.
您提供两个手柄的链接并依次泵送它们。
这是艾伦的代码,已被删除和注释。
然后配置并泵送它们。
环形模组可以完成这项工作: http://soundprogramming.net/programming_and_apis/creating_a_ring_buffer 或者你可以使用上面概述的艾伦方式。
You provide a link to both handles and pump them in turn.
Here's alan's code elided and commented.
then config and pump them.
A ring mod could do the job: http://soundprogramming.net/programming_and_apis/creating_a_ring_buffer or you could use alans way outlined above.
这是我对 Linux/Unix VoIP 项目的第一个要求,我需要了解所有可用的音频设备的功能和名称。然后我需要使用这些设备来捕获和播放音频。
为了大家的帮助,我制作了一个 (.so) 库和一个示例应用程序,演示了在 C++ 中如何使用该库。
我的库的输出就像 -
该库提供捕获和播放实时音频数据的功能。
带有文档的完整源代码可在 带有 Duplex Alsa Audio 的 IdeaAudio 库中找到
库源代码现已在 github.com 开放
It was my first requirements to a Linux/Unix VoIP projects where I need to know about all of the available audio devices capability and name. Then I need to use these devices to capture and playback the audio.
For everyone's help I have made a (.so) library and a sample Application demonstrating the use of this library in c++.
The output of my library is like-
The library provides functionality to capture and playback real-time audio data.
Full source with documentation is available in IdeaAudio library with Duplex Alsa Audio
Library source is now open at github.com
另请参阅
latency.c
,包含在alsa-lib
源代码中;在 ALSA wiki 上:See also
latency.c
, included inalsa-lib
source; on the ALSA wiki: