ALSA:扬声器的周期大小与麦克风之间的关系 [英] ALSA: Relation between period size of speaker and mic

查看:132
本文介绍了ALSA:扬声器的周期大小与麦克风之间的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带麦克风和扬声器的音频会议设备.麦克风和扬声器具有相同的采样率,由snd_pcm_hw_params_set_rate_near()设置为8000 Hz.我是否需要将两者的周期大小和周期数设置为相同(因为两个这样的设备相互通信)?

I have audio conferencing device which has a mic and speaker. Both mic and speaker having same sampling rate set by snd_pcm_hw_params_set_rate_near() say 8000 Hz. Do I need to set period size and number of periods to be same for both (for two such devices communicate each other) ?

或者我可以为扬声器选择与为麦克风配置的周期/周期不同的周期/周期大小吗? 我该如何决定要使用哪个时期和时期大小?

Or can I choose a different period/period size for speaker than the one configured for mic ? How do I decide on which period and period size to use ?

我正在使用snd_pcm_hw_params_set_period_size_near()snd_pcm_hw_params_set_periods_near() API来设置扬声器和麦克风的周期大小和周期.

I am using snd_pcm_hw_params_set_period_size_near() and snd_pcm_hw_params_set_periods_near() APIs to set period size and period for both speaker and mic.

(我是ALSA的新手).

(I am new to ALSA).

推荐答案

支持哪种周期大小和缓冲区大小取决于驱动程序,但是如果是同一设备,则回放和捕获设备可能支持相同的参数.

What period sized and buffer sizes are supported depends on the driver, but if it's the same device, it's likely that the playback and capture devices support the same parameters.

参数是否需要相同取决于您的应用程序访问这些设备的方式.就驱动程序而言,这些设备是独立运行的.

Whether the parameters need to be the same depends on how your application accesses these devices. As far as the driver is concerned, these devices work independently.

要使用的缓冲区/周期大小取决于您如何平衡等待时间,电源使用情况和过载/欠载安全性. 延迟与回放设备上的缓冲区大小或捕获设备上的周期siz成正比. 较短的时间会稍微增加电源使用量. 较大的缓冲区增加了Xrun安全性,较短的时间间隔则增加了Xrun安全性.

What buffer/period sizes to use depends on how you want to balance latency, power usage, and over/underrun safety. Latency is directly proportional with the buffer size on playback devices or the period siz on capture devices. Power usage is increased slightly by shorter periods. Xrun safety is increased by larger buffers, and a little by shorter periods.

这篇关于ALSA:扬声器的周期大小与麦克风之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆