threejs-audio

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Spatial Audio

空间音频

Use the project's installed versions and existing architecture. These instructions supplement the user's task; they do not authorize unrelated changes or external actions.
Establish whether audio communicates information or provides optional ambience. Expose mute/volume and any required textual equivalent in HTML. Start or resume audio from a user interaction and handle autoplay rejection without breaking the scene.
Attach the listener to the active viewpoint and handle camera changes without duplicating listeners or output paths. For positional sources, choose distance/rolloff and directional cones in the scene's units. A positional source does not automatically simulate wall occlusion.
Load and decode asynchronously with explicit failure and stale-result handling. Bound concurrent sources and reuse buffers where appropriate. Avoid replaying a sound on every frame of a collision; trigger from meaningful state transitions.
Coordinate pause, visibility changes, route transitions, and XR session transitions with playback. Stop/disconnect owned sources and release listeners. Do not close an AudioContext shared with another part of the application.
Verify blocked autoplay, first interaction, mute persistence, moving-camera attenuation, rapid retriggers, and repeated mount/unmount. Measure perceived volume on actual output devices when spatial audio matters.
使用项目已安装的版本和现有架构。这些说明是对用户任务的补充,不授权无关更改或外部操作。
确定音频是用于传达信息还是提供可选的环境氛围。在 HTML 中暴露静音/音量控制及任何必需的文本等价物。通过用户交互开始或恢复音频,并处理自动播放被拒绝的情况,同时不破坏场景。
将监听器附着到活动视点上,并处理相机变化,避免重复监听器或输出路径。对于位置音频源,请以场景单位为距离/衰减和方向锥选择合适的值。位置音频源不会自动模拟墙壁遮挡。
异步加载和解码,并明确处理失败和过期结果。限制并发音频源数量,并在适当处复用缓冲区。避免在碰撞的每一帧都重放声音;应从有意义的状态变化触发。
将暂停、可见性变化、路由切换和 XR 会话切换与播放进行协调。停止/断开所拥有的音频源并释放监听器。不要关闭与应用程序其他部分共享的 AudioContext。
验证被阻止的自动播放、首次交互、静音持久化、移动相机时的衰减、快速重复触发以及反复挂载/卸载。当空间音频很重要时,在实际输出设备上测量感知音量。

API reference

API 参考

Consult the official documentation for exact signatures and revision-specific behavior. If documentation access is unavailable, inspect installed types/source and state any remaining uncertainty.
有关精确签名和特定版本的差异,请查阅官方文档。如果无法访问文档,请检查已安装的类型/源码并说明任何剩余的不确定性。