打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
USB音频声卡的时钟同步方式同步、自适应、异步的理解和优缺点
看了一下WINAMP的WASAPI插件YASAPI的工作原理介绍,翻译如下:

--------------------------------
http://out-yasapi.sourceforge.net/

There are two sides the YASAPI plugin has to take into account:   YASAPI需要一边处理WASAPI侧,一边处理WINAMP侧
·    the WASAPI side, and
·    the Winamp side.

The YASAPI plugin implements the first two strategies, i.e. the ones based on the push model.   使用PUSH方式。
The push model, in principle, works as follows:   原理如下
1.    Query the size of the buffer shared with the audio device.  查询与声卡共享的缓冲大小
2.    Fill in completety the buffer shared with the audio device.  装满缓冲
3.    Start playing.               开始播放
4.    Loop until the track is played:   一直做如下循环直到播完
      1.    Sleep half of the time corresponding to the size of the buffer shared with the audio device.  睡眠 缓冲可以播完的时间的 一半时间
      2.    Into the buffer shared with the audio device, fill in the gap which was growing free by playing during sleep.    充满缓存,即把在睡眠时由于播放而自由生长的空白缓存进行充满。
5.    Sleep until the possibly remaining filled rest of the buffer shared with the audio device was played. 睡眠  直到剩余的缓冲数据被播完
6.    Stop playing.  停止

But the YASAPI plugin not only has to take into account the WASAPI side (the loop consisting of sleeping and writing to the audio device),   but also the Winamp side because Winamp provides the audio samples which should be played in an completely unpredictable way.    但是winamp侧提供的数据样本量也是不可预测的

The YASAPI plugin decouples the two sides by means of a ring or circular buffer.     YASAPI采用一个“环缓冲”来解决这个问题      That way,
·    Winamp can luckily write to the ring buffer whenever it likes without caring about WASAPI, and       winamp侧可以随时写入“环缓冲”,不用顾及WASAPI侧
·    WASAPI can luckily read from the ring buffer and write to the audio device wehenever it likes without caring about Winamp.        WASAPI侧可以随时从“环缓冲”读出数据,并写入声卡,而不用顾及winamp侧
According to step 2 of the push model sketched above, it shoud become clear that the ring buffer should be at least as large (or larger) as the buffer the plugin's WASAPI component shares with the audio device.    根据上面的步骤2, 可以知道这个“环缓冲”应该要至少与 插件WASAPI组件与声卡共享的缓冲大小 一样大,或更大。
----------------------------
由此可见,WASAPI插件是声卡驱动程序要多少数据,就提供多少数据,完全按照声卡的来。

而WINAMP提供给WASAPI插件的数据是按WINAMP自身的解码速度来的。

所以WASAPI插件建立了一个环缓冲来使二者不会冲突。

另外,在exclusive方式下,YASAPI不会做SRC。  在share方式下,YASAPI可以设置成SRC成系统设定的采样率。

由此,如果声卡是USB异步方式,声卡要多少数据,驱动程序就给多少数据,WASAPI插件就要补多少数据到缓存中。声卡完全是按自己的时钟自由运行!

如果声卡是USB自适应方式,驱动程序给多快的数据流,声卡就PLL适应成多快。故声卡时钟JITTER比较大。














本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
比较一下FOOBAR的ASIO和WASAPI输出
来谈谈pcHiFi的优化,自己的经验,网上什么也搜不到
【新提醒】FL Studio 基础教程设置窗口(AUDIO)介绍
咸鱼翻身?经典音乐播放器Winamp获得更新
STM32的 USB传输(双缓冲)
【diy】自制的USB声卡,音色很好哦
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服