AudioStreamPlaybackPolyphonic
继承: AudioStreamPlayback
< RefCounted
< Object
Playback instance for AudioStreamPolyphonic
.
描述
Playback instance for AudioStreamPolyphonic
. After setting the stream
property of AudioStreamPlayer
, AudioStreamPlayer2D
, or AudioStreamPlayer3D
, the playback instance can be obtained by calling AudioStreamPlayer.get_stream_playback
, AudioStreamPlayer2D.get_stream_playback
or AudioStreamPlayer3D.get_stream_playback
methods.
方法
bool | is_stream_playing ( stream: int ) const1 |
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" ) |
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
Returned by play_stream
in case it could not allocate a stream for playback.
方法说明
bool
is_stream_playing ( stream: int
) const1
Return true whether the stream associated with an integer ID is still playing. Check play_stream
for information on when this ID becomes invalid.
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
)
Change the stream pitch scale. The stream
argument is an integer ID returned by play_stream
.
void
set_stream_volume ( stream: int
, volume_db: float
)
Change the stream volume (in db). The stream
argument is an integer ID returned by play_stream
.
void
stop_stream ( stream: int
)
Stop a stream. The stream
argument is an integer ID returned by play_stream
, which becomes invalid after calling this function.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。