作者:
Oswyn (Oswyn)
2020-03-17 21:39:03: → alanswill: 看不懂QQ,不過我在網路上查到的都是說event比push還要 03/16 06:39
: → alanswill: 新? 03/16 06:39
Sorry 漏看了回復
這問題很複雜,首先M$自己就用了一堆不同的名詞來表示或說明 WASAPI 的工作模式
event-driven、timer-driven、event-driven (pull) mode、pull mode
有時用這個有時用那個,不去細看其工作方式很容易搞錯
像 WASAPI (push) 為什麼要叫 push 我到現在還搞不懂,因為文件中有叫 pull mode
所以另一個就是 push 嗎,哪為什麼 WASAPI (event) 不叫作 WASAPI (pull) ...
※ 從名稱中是誰推誰誰拉誰、十分讓人混淆
網上有些查到的 WASAPI 說明是錯誤的,因為名稱太亂實在很容易搞混
因為狗出來不同來源的說明有完全相反或不合理的狀況
所以我是花了不少時間去挖 Windows Audio team 的軟體工程師 Matthew van Eerde
在官網論壇及 Blog 的回覆與發文及比對 Windows Core Audio APIs 的文件
得出來的結論,因為我有比對 WASAPI output support 兩個模式的工作特性
個人是對這個結論滿有信心的啦XD 雖然我很想說「相信我吧」但8成7吧XD
※
@Matthew van Eerde's web log
HD Audio buffer allocations must be a multiple of 256 bytes. For timer-driven
buffers, this applies to the whole buffer. For event-driven buffers, this
applies to the sum of the “ping” and “pong” buffers, so the individual “
ping” or “pong” buffer must be a multiple of 128 bytes.
※
foobar WASAPI output support 的模式也改過幾次模式名稱
可以去查其 version history,3.0 中有一條
Operates in two different modes, regular and event-driven - the latter seems
to be more compatible with USB devices, but not supported by some other
devices.
因為 foo_out_wasapi 的作者也是 foobar 的開發者 Peter 本來好像只實作了一個模
式也就是 WASAPI 預設的環形緩衝,需要 DMA 與一些其它的硬體功能支援
因為 WASAPI 是 Windows Vista 打掉舊的重寫的新 Audio 核心中的低層 API
所以這也就是說硬體需要有 Windows Vista 相容,但一些舊硬體(大多是USB)...
因為有部分使用者回報錯誤無法順利播放
所以作者就補了使用乒乓緩衝的 event-driven 模式
以 foo_out_wasapi 開發的角度來看,「event」是比較新加入的模式沒錯,但是為了
相容性所補上的較原始的技術
所以環形緩衝稱為「regular」但後來改成「push」
這樣解釋可以看得懂嗎,可能有點亂啦
補個 Peter 對 WASAPI 的發言
Event mode in fact provides worse protection against CPU usage spikes than
push mode (as seen in earlier versions of this plug-in) because we queue less
data with the driver at a time and must wake up and send more data at regular
intervals. However, event mode seems necessary to peacefully cooperate with
certain devices, USB ones in particular.
硬體沒問題 push mode 可用沒什麼理由不用 push mode
且 push mode 會出問題的硬體主要是對 Windows Vista 的相容性有問題
現在都民國幾年了,Vista 都要 two decades 了...