用户工具

站点工具


侧边栏



Unity3D中文文档

script:unityengine:classes:audioclip:audioclip

AudioClip 音频剪辑

class in UnityEngine / Inherits from: Object

Description 描述

A container for audio data.

用于音频数据的一个容器。

An AudioClip stores the audio file either compressed as ogg vorbis or uncompressed. AudioClips are referenced and used by AudioSources to play sounds.

一个音频剪辑储存压缩的ogg vorbis 或未压缩的音频文件。AudioClips被引用和被用于AudioSources播放声音。

Variables 变量

channelsThe number of channels in the audio clip. (Read Only)
该音频剪辑的通声道数。
frequencyThe sample frequency of the clip in Hertz. (Read Only)
音频剪辑的采样频率,单位赫兹。(只读)
lengthThe length of the audio clip in seconds. (Read Only)
该音频剪辑的长度,单位秒。(只读)
loadInBackgroundCorresponding to the “Load In Background” flag in the inspector, when this flag is set, the loading will happen delayed without blocking the main thread.
对应检视面板的Load In Background标识,当此标识设置为true,加载会延迟,而不会阻塞主线程。
loadStateReturns the current load state of the audio data associated with an AudioClip.
返回当前与音频相关的音频数据加载状态。
loadTypeThe load type of the clip (read-only).
该剪辑的加载类型。(只读)
preloadAudioDataPreloads audio data of the clip when the clip asset is loaded. When this flag is off, scripts have to call AudioClip.LoadAudioData() to load the data before the clip can be played. Properties like length, channels and format are available before the audio data has been loaded.
当该剪辑资源被加载,预加载该剪辑的音频数据。当该标识为false,在剪辑播放之前,脚本必须调用AudioClip.LoadAudioData()来加载数据。属性像length、channels以及在音频数据已经被加载之前可用的格式。
samplesThe length of the audio clip in samples. (Read Only)
采样的音频数据长度(只读)。

Public Functions 公共变量

GetDataFills an array with sample data from the clip.
该剪辑的采样数据数据。
LoadAudioDataLoads the audio data of a clip. Clips that have “Preload Audio Data” set will load the audio data automatically.
加载一个剪辑的音频数据。剪辑设置“Preload Audio Data”将会自动加载音频数据。
SetDataSet sample data in a clip.
设置剪辑的采样数据。
UnloadAudioDataUnloads the audio data associated with the clip. This works only for AudioClips that are based on actual sound file assets.
卸载有关该剪辑的音频数据。这仅适用基于实际声音文件资源的音频剪辑。

Delegates 委托

PCMReaderCallbackDelegate called each time AudioClip reads data.
委托每次音频剪辑调用读取数据。
PCMSetPositionCallbackDelegate called each time AudioClip changes read position.
委托每次音频剪辑调用改变的读取位置。
script/unityengine/classes/audioclip/audioclip.txt · 最后更改: 2016/08/02 05:37 (外部编辑)