AudioStreamGeneratorPlayback

Inherits: AudioStreamPlaybackResampled < AudioStreamPlayback < Reference < Object

Plays back audio generated using AudioStreamGenerator.

Description

This class is meant to be used with AudioStreamGenerator to play back the generated audio in real-time.

Methods

bool

can_push_buffer ( int amount ) const

void

clear_buffer ( )

int

get_frames_available ( ) const

int

get_skips ( ) const

bool

push_buffer ( PoolVector2Array frames )

bool

push_frame ( Vector2 frame )

Method Descriptions

  • bool can_push_buffer ( int amount ) const

Returns true if a buffer of the size amount can be pushed to the audio sample data buffer without overflowing it, false otherwise.


  • void clear_buffer ( )

Clears the audio sample data buffer.


  • int get_frames_available ( ) const

Returns the number of audio data frames left to play. If this returned number reaches 0, the audio will stop playing until frames are added again. Therefore, make sure your script can always generate and push new audio frames fast enough to avoid audio cracking.


  • int get_skips ( ) const


Pushes several audio data frames to the buffer. This is usually more efficient than push_frame in C# and compiled languages via GDNative, but push_buffer may be less efficient in GDScript.


Pushes a single audio data frame to the buffer. This is usually less efficient than push_buffer in C# and compiled languages via GDNative, but push_frame may be more efficient in GDScript.