CC Audio Expand 为 ComputerCraft: Tweaked 的扬声器外围设备添加了高质量的 PCM 音频播放支持,解决了原版实现中存在的音频同步和播放流畅性问题。
核心功能
多格式支持
- PCM_S16LE(16位有符号小端序)
- PCM_U8(8位无符号)
- PCM_S8(8位有符号)
智能音频同步
- 基于时间戳的同步:每个音频数据包都携带服务器端发送的时间戳
- 自动跳过过期数据:客户端检测并跳过已排队超过 200ms 的音频数据包
- 快速恢复:在延迟后自动追赶至服务器的播放进度
抗延迟优化
- 改进的泵送策略:更主动地唤醒音频引擎
- 持久的心跳机制:减少“约 1 秒的音频接收暂停”
- 智能缓冲区管理:根据队列状态动态调整泵送次数
解决的问题
本模组参考并解决了 CC: Tweaked 上游的问题:
CC Audio Expand adds high-quality PCM audio playback support to ComputerCraft: Tweaked's speaker peripheral, solving audio synchronization and playback smoothness issues in the vanilla implementation.
Core Features
Multiple Format Support
- PCM_S16LE (16-bit signed little-endian)
- PCM_U8 (8-bit unsigned)
- PCM_S8 (8-bit signed)
Intelligent Audio Synchronization
- Timestamp-based synchronization: Each audio packet carries a server-side send timestamp
- Automatic stale data skipping: Client detects and skips audio packets that have been queued for more than 200ms
- Fast recovery: Automatically catches up to server playback progress after lag
Anti-Lag Optimization
- Improved pump strategy: More proactive audio engine wake-up
- Persistent keep-alive mechanism: Reduces "~1 second audio reception pauses"
- Smart buffer management: Dynamically adjusts pump count based on queue status
Problems Solved
This mod references and solves upstream CC: Tweaked issues:
-
Issue #2120 - Client-server audio desync
When the client experiences lag or volume is set to 0, playback resumes with old queued audio, causing severe desynchronization with the server.
-
PR #2412 - Failed fix attempt
This PR attempted to solve the problem using sample counting but was rejected by maintainers, who required "must use time, not sample count". This mod adopts the correct timestamp-based approach.
评论 0
登录后参与评分
还没有评论,来抢沙发吧