Class AudioStreamPlaybackPolyphonic
Playback instance for AudioStreamPolyphonic.
- Inheritance
-
AudioStreamPlaybackPolyphonic
Remarks
Playback instance for AudioStreamPolyphonic. After setting the stream
property of AudioStreamPlayer, AudioStreamPlayer2D, or AudioStreamPlayer3D, the playback instance can be obtained by calling get_stream_playback, get_stream_playback or get_stream_playback methods.
Fields
INVALID_ID
Returned by AudioStreamPlaybackPolyphonic.play_stream in case it could not allocate a stream for playback.
const INVALID_ID = -1
Methods
is_stream_playing(int)
Qualifiers: const
Returns true
if the stream associated with the given integer ID is still playing. Check AudioStreamPlaybackPolyphonic.play_stream for information on when this ID becomes invalid.
bool is_stream_playing(int stream)
Parameters
stream
int
play_stream(AudioStream, float, float, float, int, StringName)
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 AudioStreamPlaybackPolyphonic.stop_stream is called.
This function returns INVALID_ID if the amount of streams currently playing equals polyphony. If you need a higher amount of maximum polyphony, raise this value.
int play_stream(AudioStream stream, float from_offset, float volume_db, float pitch_scale, int playback_type, StringName bus)
Parameters
stream
AudioStreamfrom_offset
floatvolume_db
floatpitch_scale
floatplayback_type
intbus
StringName
set_stream_pitch_scale(int, float)
Change the stream pitch scale. The stream
argument is an integer ID returned by AudioStreamPlaybackPolyphonic.play_stream.
void set_stream_pitch_scale(int stream, float pitch_scale)
Parameters
set_stream_volume(int, float)
Change the stream volume (in db). The stream
argument is an integer ID returned by AudioStreamPlaybackPolyphonic.play_stream.
void set_stream_volume(int stream, float volume_db)
Parameters
stop_stream(int)
Stop a stream. The stream
argument is an integer ID returned by AudioStreamPlaybackPolyphonic.play_stream, which becomes invalid after calling this function.
void stop_stream(int stream)
Parameters
stream
int