Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
AudioSource.Play 播放
# [AudioSource](AudioSource.html).Play 播放 function *Play* (*delay* : UInt64 = 0) : void *Description* 描述 Plays the [clip](AudioSource.clip.html). 播放剪辑。 Delay allows a source to be played later at a specific sample-accurate point in time. Note that the delay must be set according to the reference output rate of 44.1 Khz, meaning that Play(44100) will delay the playing by exactly 1 sec. Note: To obtain sample accuracy with an [AudioClip](../AudioClip/AudioClip.html) with a different samplerate (than 44.1 khz) you have to do the math yourselves. Delaying an audiosource with an attached [AudioClip](../AudioClip/AudioClip.html) with samplerate of, say, 32 khz, with 16k samples(.5 sec) is done by Play(22050). ((44100/32000) * 16000 = 22050). 延迟允许一个源在一个特定精确采样时间点之后播放。请注意,延迟必须设置根据 44.1 Khz 的输出率,意思是播放(44100) 将延迟播放刚好 1 秒。注意:为了获得 [AudioClip](../AudioClip/AudioClip.html) 准确的采样,带有不同的采样率,你必须做自己的计算。延迟一个附加 [AudioClip](../AudioClip/AudioClip.html) 的 AudioSource,带有采样率,32 khz,带有 16k 采样(.5 秒)来播放(22050)。 ((44100/32000) * 16000 = 22050)。 * [C#](#) * [JavaScript](#) ``` using UnityEngine; using System.Collections; public class example : MonoBehaviour { void Awake() { audio.Play(); audio.Play(44100); } } ``` ``` audio.Play(); // Delay a clip by 1 sec (44100 samples) 延迟一个剪辑1秒 audio.Play(44100); ``` 参见:[Stop](AudioSource.Stop.html), [Pause](AudioSource.Pause.html), [clip](AudioSource.clip.html) 函数
da
2022年5月14日 23:16
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码