AudioStreamPlayback
继承: RefCounted < Object
派生: AudioStreamPlaybackInteractive, AudioStreamPlaybackPlaylist, AudioStreamPlaybackPolyphonic, AudioStreamPlaybackResampled, AudioStreamPlaybackSynchronized
Meta class for playing back audio.
描述
Can play, loop, pause a scroll through audio. See AudioStream and AudioStreamOggVorbis for usage.
方法
int | _get_loop_count ( ) virtual1 const2 |
Variant | _get_parameter ( name: StringName ) virtual1 const2 |
float | _get_playback_position ( ) virtual1 const2 |
bool | _is_playing ( ) virtual1 const2 |
int | _mix ( buffer: AudioFrame*, rate_scale: float, frames: int ) virtual1 |
void | _seek ( position: float ) virtual1 |
void | _set_parameter ( name: StringName, value: Variant ) virtual1 |
void | _start ( from_pos: float ) virtual1 |
void | _stop ( ) virtual1 |
void | _tag_used_streams ( ) virtual1 |
int | get_loop_count ( ) const2 |
float | get_playback_position ( ) const2 |
AudioSamplePlayback | get_sample_playback ( ) const2 |
bool | is_playing ( ) const2 |
PackedVector2Array | mix_audio ( rate_scale: float, frames: int ) |
void | seek ( time: float = 0.0 ) |
void | set_sample_playback ( playback_sample: AudioSamplePlayback ) |
void | start ( from_pos: float = 0.0 ) |
void | stop ( ) |
方法说明
int _get_loop_count ( ) virtual1 const2
Overridable method. Should return how many times this audio stream has looped. Most built-in playbacks always return 0.
Variant _get_parameter ( name: StringName ) virtual1 const2
Return the current value of a playback parameter by name (see AudioStream._get_parameter_list).
float _get_playback_position ( ) virtual1 const2
Overridable method. Should return the current progress along the audio stream, in seconds.
bool _is_playing ( ) virtual1 const2
Overridable method. Should return true if this playback is active and playing its audio stream.
int _mix ( buffer: AudioFrame*, rate_scale: float, frames: int ) virtual1
Override this method to customize how the audio stream is mixed. This method is called even if the playback is not active.
Note: It is not useful to override this method in GDScript or C#. Only GDExtension can take advantage of it.
void _seek ( position: float ) virtual1
Override this method to customize what happens when seeking this audio stream at the given position, such as by calling AudioStreamPlayer.seek.
void _set_parameter ( name: StringName, value: Variant ) virtual1
Set the current value of a playback parameter by name (see AudioStream._get_parameter_list).
void _start ( from_pos: float ) virtual1
Override this method to customize what happens when the playback starts at the given position, such as by calling AudioStreamPlayer.play.
void _stop ( ) virtual1
Override this method to customize what happens when the playback is stopped, such as by calling AudioStreamPlayer.stop.
void _tag_used_streams ( ) virtual1
Overridable method. Called whenever the audio stream is mixed if the playback is active and AudioServer.set_enable_tagging_used_audio_streams has been set to true. Editor plugins may use this method to "tag" the current position along the audio stream and display it in a preview.
Returns the number of times the stream has looped.
float get_playback_position ( ) const2
Returns the current position in the stream, in seconds.
AudioSamplePlayback get_sample_playback ( ) const2
实验性: 未来版本中可能会修改或移除该方法。
Returns the AudioSamplePlayback associated with this AudioStreamPlayback for playing back the audio sample of this stream.
Returns true if the stream is playing.
PackedVector2Array mix_audio ( rate_scale: float, frames: int )
Mixes up to frames of audio from the stream from the current position, at a rate of rate_scale, advancing the stream.
Returns a PackedVector2Array where each element holds the left and right channel volume levels of each frame.
Note: Can return fewer frames than requested, make sure to use the size of the return value.
void seek ( time: float = 0.0 )
Seeks the stream at the given time, in seconds.
void set_sample_playback ( playback_sample: AudioSamplePlayback )
实验性: 未来版本中可能会修改或移除该方法。
Associates AudioSamplePlayback to this AudioStreamPlayback for playing back the audio sample of this stream.
void start ( from_pos: float = 0.0 )
Starts the stream from the given from_pos, in seconds.
void stop ( )
Stops the stream.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。