AudioStreamPlaybackPolyphonic
Playback instance for AudioStreamPolyphonic.
Playback instance for AudioStreamPolyphonic.
Playback instance for AudioStreamPolyphonic. After setting the stream property of AudioStreamPlayer, AudioStreamPlayer2D, or AudioStreamPlayer3D, the playback instance can be obtained by calling AudioStreamPlayer.GetStreamPlayback, AudioStreamPlayer2D.GetStreamPlayback or AudioStreamPlayer3D.GetStreamPlayback methods.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Methods6
IsStreamPlayingbool
public bool IsStreamPlaying(long stream);Returns true if the stream associated with the given integer ID is still playing. Check AudioStreamPlaybackPolyphonic.PlayStream for information on when this ID becomes invalid.
| Name | Type | Default |
|---|---|---|
stream | long | — |
boolPlayStream2 overloads
public long PlayStream(AudioStream stream, float fromOffset, float volumeDb, float pitchScale);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.StopStream is called.
This function returns AudioStreamPlaybackPolyphonic.InvalidId if the amount of streams currently playing equals AudioStreamPolyphonic.Polyphony. If you need a higher amount of maximum polyphony, raise this value.
| Name | Type | Default |
|---|---|---|
stream | AudioStream | — |
fromOffset | float | — |
volumeDb | float | — |
pitchScale | float | — |
longpublic long PlayStream(AudioStream stream, float fromOffset = 0f, float volumeDb = 0f, float pitchScale = 1f, AudioServer.PlaybackType playbackType = AudioServer.PlaybackType.Default, StringName bus = null);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.StopStream is called.
This function returns AudioStreamPlaybackPolyphonic.InvalidId if the amount of streams currently playing equals AudioStreamPolyphonic.Polyphony. If you need a higher amount of maximum polyphony, raise this value.
| Name | Type | Default |
|---|---|---|
stream | AudioStream | — |
fromOffset | float | 0f |
volumeDb | float | 0f |
pitchScale | float | 1f |
playbackType | AudioServer.PlaybackType | AudioServer.PlaybackType.Default |
bus | StringName | null |
longSetStreamPitchScalevoid
public void SetStreamPitchScale(long stream, float pitchScale);Change the stream pitch scale. The stream argument is an integer ID returned by AudioStreamPlaybackPolyphonic.PlayStream.
| Name | Type | Default |
|---|---|---|
stream | long | — |
pitchScale | float | — |
SetStreamVolumevoid
public void SetStreamVolume(long stream, float volumeDb);Change the stream volume (in db). The stream argument is an integer ID returned by AudioStreamPlaybackPolyphonic.PlayStream.
| Name | Type | Default |
|---|---|---|
stream | long | — |
volumeDb | float | — |
StopStreamvoid
public void StopStream(long stream);Stop a stream. The stream argument is an integer ID returned by AudioStreamPlaybackPolyphonic.PlayStream, which becomes invalid after calling this function.
| Name | Type | Default |
|---|---|---|
stream | long | — |
Fields and constants1
InvalidIdField
public const long InvalidId = -1;Returned by AudioStreamPlaybackPolyphonic.PlayStream in case it could not allocate a stream for playback.