Skip to content

SteamAudioStreamPlayback

stechyo edited this page Jan 13, 2024 · 2 revisions

This playback will contain an audio stream that you provided when configuring your Godot scene, and it will apply the SteamAudio effects configured in the corresponding SteamAudioPlayer to it.

play_stream(AudioStream stream, float from_offset, float volume_db, float pitch_scale) - plays the given stream starting at from_offset, at the defined volume and pitch scale.

A very important note: play_stream is what you want to use if you'd like to change a SteamAudioPlayer's stream at runtime. Do not try to set the player's stream directly through set_stream, as that will disable all SteamAudio effects for that player. At runtime, the stream you've configured will be replaced with a SteamAudioStream. This stream has an inner stream which corresponds to what you configured in the scene. If you want to change the stream at runtime, you must access the player's playback and change the stream from there:

# assuming that `self` is a SteamAudioPlayer in this script
play()
var pb: SteamAudioStreamPlayback = get_stream_playback()
pb.play_stream(new_stream)
Clone this wiki locally