Represents a handle to a sound that has been played. The
handle is required to control the sound while it is playing
(for example, to call stop, setVolume, setPitch,
fade, or seekTo). Infinitely-looping sounds (started
with loop: -1) stop automatically when the last
SoundInstance reference is dropped; retain the handle for
as long as the sound should keep playing.
Gets the identifier of the sound event this instance was
started with.
方法
fade
fade(duration:number,targetVolume:number):void
预览版世界修改
参数
duration: number
Duration of the fade in seconds. Must be non-negative.
Minimum value: 0
targetVolume: number
Volume multiplier to fade to, relative to the selected sound
variant's volume. Must be non-negative.
Minimum value: 0
返回 void
备注
Fades this sound instance from its current volume multiplier
to the target multiplier over the specified duration. Volume
multipliers are relative to the selected sound variant's
volume. To fade in from silence, call setVolume(0.0)
first; to fade out, pass a target volume of 0.0.
pause
pause():void
预览版世界修改
返回 void
备注
Pauses this sound.
resume
resume():void
预览版世界修改
返回 void
备注
Resumes this sound after a pause.
seekTo
seekTo(seconds:number):void
预览版世界修改
参数
seconds: number
Position to seek to in seconds. Must be non-negative.
Bounds: [0, 107374184]
返回 void
备注
Sets the playback position of this sound instance.
抛出
Throws if seconds is negative, or if the sound has a known
duration and seconds is greater than that duration.
Represents a handle to a sound that has been played. The handle is required to control the sound while it is playing (for example, to call
stop,setVolume,setPitch,fade, orseekTo). Infinitely-looping sounds (started withloop: -1) stop automatically when the lastSoundInstancereference is dropped; retain the handle for as long as the sound should keep playing.