AudioStreamPlayback
Meta class for playing back audio.
Meta class for playing back audio.
Can play, loop, pause a scroll through audio. See AudioStream and AudioStreamOggVorbis for usage.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
AudioStreamPlaybackConstructor
public AudioStreamPlayback();Methods18
GetLoopCountint
public int GetLoopCount();Overridable method. Should return how many times this audio stream has looped. Most built-in playbacks always return 0.
intGetPlaybackPositiondouble
public double GetPlaybackPosition();Overridable method. Should return the current progress along the audio stream, in seconds.
doubleGetSamplePlaybackAudioSamplePlayback
public AudioSamplePlayback GetSamplePlayback();Returns the AudioSamplePlayback associated with this AudioStreamPlayback for playing back the audio sample of this stream.
AudioSamplePlaybackIsPlayingbool
public bool IsPlaying();Overridable method. Should return true if this playback is active and playing its audio stream.
boolMixAudioVector2[]
public Vector2[] MixAudio(float rateScale, int frames);Mixes up to frames of audio from the stream from the current position, at a rate of rate_scale, advancing the stream.
Returns a Vector2[] 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.
| Name | Type | Default |
|---|---|---|
rateScale | float | — |
frames | int | — |
Vector2[]Seekvoid
public void Seek(double time = 0d);Override this method to customize what happens when seeking this audio stream at the given position, such as by calling AudioStreamPlayer.Seek.
| Name | Type | Default |
|---|---|---|
time | double | 0d |
SetSamplePlaybackvoid
public void SetSamplePlayback(AudioSamplePlayback playbackSample);Associates AudioSamplePlayback to this AudioStreamPlayback for playing back the audio sample of this stream.
| Name | Type | Default |
|---|---|---|
playbackSample | AudioSamplePlayback | — |
Startvoid
public void Start(double fromPos = 0d);Override this method to customize what happens when the playback starts at the given position, such as by calling AudioStreamPlayer.Play.
| Name | Type | Default |
|---|---|---|
fromPos | double | 0d |
Stopvoid
public void Stop();Override this method to customize what happens when the playback is stopped, such as by calling AudioStreamPlayer.Stop.
_GetLoopCountint
public virtual int _GetLoopCount();Overridable method. Should return how many times this audio stream has looped. Most built-in playbacks always return 0.
int_GetParameterVariant
public virtual Variant _GetParameter(StringName name);Return the current value of a playback parameter by name (see AudioStream._GetParameterList).
| Name | Type | Default |
|---|---|---|
name | StringName | — |
Variant_GetPlaybackPositiondouble
public virtual double _GetPlaybackPosition();Overridable method. Should return the current progress along the audio stream, in seconds.
double_IsPlayingbool
public virtual bool _IsPlaying();Overridable method. Should return true if this playback is active and playing its audio stream.
bool_Seekvoid
public virtual void _Seek(double position);Override this method to customize what happens when seeking this audio stream at the given position, such as by calling AudioStreamPlayer.Seek.
| Name | Type | Default |
|---|---|---|
position | double | — |
_SetParametervoid
public virtual void _SetParameter(StringName name, Variant value);Set the current value of a playback parameter by name (see AudioStream._GetParameterList).
| Name | Type | Default |
|---|---|---|
name | StringName | — |
value | Variant | — |
_Startvoid
public virtual void _Start(double fromPos);Override this method to customize what happens when the playback starts at the given position, such as by calling AudioStreamPlayer.Play.
| Name | Type | Default |
|---|---|---|
fromPos | double | — |
_Stopvoid
public virtual void _Stop();Override this method to customize what happens when the playback is stopped, such as by calling AudioStreamPlayer.Stop.
_TagUsedStreamsvoid
public virtual void _TagUsedStreams();Overridable method. Called whenever the audio stream is mixed if the playback is active and AudioServer.SetEnableTaggingUsedAudioStreams 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.