AudioStreamPlaybackPolyphonic
继承: AudioStreamPlayback < RefCounted < Object
AudioStreamPolyphonic 的播放实例。
描述
AudioStreamPolyphonic 的播放实例。设置 AudioStreamPlayer、AudioStreamPlayer2D 或 AudioStreamPlayer3D 的 stream
属性后,可以通过调用 AudioStreamPlayer.get_stream_playback、AudioStreamPlayer2D.get_stream_playback 或 AudioStreamPlayer3D.get_stream_playback 方法获取播放实例。
方法
is_stream_playing(stream: int) const | |
play_stream(stream: AudioStream, from_offset: float = 0, volume_db: float = 0, pitch_scale: float = 1.0, playback_type: PlaybackType = 0, bus: StringName = &”Master”) | |
void | set_stream_pitch_scale(stream: int, pitch_scale: float) |
void | set_stream_volume(stream: int, volume_db: float) |
void | stop_stream(stream: int) |
常量
INVALID_ID = -1
🔗
无法为播放分配一个流时由 play_stream 返回。
方法说明
bool is_stream_playing(stream: int) const 🔗
与整数 ID 关联的流仍在播放时返回 true。请检查 play_stream 以获取有关此 ID 何时失效的信息。
int play_stream(stream: AudioStream, from_offset: float = 0, volume_db: float = 0, pitch_scale: float = 1.0, playback_type: PlaybackType = 0, bus: StringName = &”Master”) 🔗
Play an AudioStream at a given offset, volume, pitch scale, playback type, and bus. Playback starts immediately.
The return value is a unique integer ID that is associated to this playback stream and which can be used to control it.
This ID becomes invalid when the stream ends (if it does not loop), when the AudioStreamPlaybackPolyphonic is stopped, or when stop_stream is called.
This function returns INVALID_ID if the amount of streams currently playing equals AudioStreamPolyphonic.polyphony. If you need a higher amount of maximum polyphony, raise this value.
void set_stream_pitch_scale(stream: int, pitch_scale: float) 🔗
改变流的音阶。stream
参数是一个由 play_stream 返回的整数 ID。
void set_stream_volume(stream: int, volume_db: float) 🔗
改变流的音量(单位:db)。stream
参数是一个由 play_stream 返回的整数 ID。
void stop_stream(stream: int) 🔗
停止某个流。stream
参数是由 play_stream 返回的整数 ID,在调用这个函数后失效。