Documentation
¶
Overview ¶
Can play, loop, pause a scroll through audio. See graphics.gd/classdb/AudioStream and graphics.gd/classdb/AudioStreamOggVorbis for usage.
Index ¶
- type Advanced
- type Any
- type AudioFrame
- type Expanded
- type Extension
- type ID
- type Implementation
- type Instance
- func (self Instance) AsAudioStreamPlayback() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) GetLoopCount() int
- func (self Instance) GetPlaybackPosition() Float.X
- func (self Instance) GetSamplePlayback() AudioSamplePlayback.Instance
- func (self Instance) ID() ID
- func (self Instance) IsPlaying() bool
- func (self Instance) MixAudio(rate_scale Float.X, frames int) []Vector2.XY
- func (self Instance) SeekTo()
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetSamplePlayback(playback_sample AudioSamplePlayback.Instance)
- func (self Instance) Start()
- func (self Instance) Stop()
- func (self Instance) Virtual(name string) reflect.Value
- type Interface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type AudioFrame ¶
type AudioFrame = gd.AudioFrame
type Expanded ¶
type Expanded [1]gdclass.AudioStreamPlayback
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.
func (*Extension[T]) AsAudioStreamPlayback ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Implementation ¶
type Implementation = implementation
Implementation implements Interface with empty methods.
type Instance ¶
type Instance [1]gdclass.AudioStreamPlayback
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsAudioStreamPlayback ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) GetLoopCount ¶
Returns the number of times the stream has looped.
func (Instance) GetPlaybackPosition ¶
Returns the current position in the stream, in seconds.
func (Instance) GetSamplePlayback ¶
func (self Instance) GetSamplePlayback() AudioSamplePlayback.Instance
Returns the graphics.gd/classdb/AudioSamplePlayback associated with this graphics.gd/classdb/AudioStreamPlayback for playing back the audio sample of this stream.
func (Instance) MixAudio ¶
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.XY] 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.
func (Instance) SeekTo ¶
func (self Instance) SeekTo()
Seeks the stream at the given 'time', in seconds.
func (Instance) SetSamplePlayback ¶
func (self Instance) SetSamplePlayback(playback_sample AudioSamplePlayback.Instance)
Associates graphics.gd/classdb/AudioSamplePlayback to this graphics.gd/classdb/AudioStreamPlayback for playing back the audio sample of this stream.
type Interface ¶
type Interface interface { // Override this method to customize what happens when the playback starts at the given position, such as by calling [graphics.gd/classdb/AudioStreamPlayer.Instance.Play]. Start(from_pos Float.X) // Override this method to customize what happens when the playback is stopped, such as by calling [graphics.gd/classdb/AudioStreamPlayer.Instance.Stop]. Stop() // Overridable method. Should return true if this playback is active and playing its audio stream. IsPlaying() bool // Overridable method. Should return how many times this audio stream has looped. Most built-in playbacks always return 0. GetLoopCount() int // Overridable method. Should return the current progress along the audio stream, in seconds. GetPlaybackPosition() Float.X // Override this method to customize what happens when seeking this audio stream at the given 'position', such as by calling [graphics.gd/classdb/AudioStreamPlayer.Instance.SeekTo]. Seek(position Float.X) // Override this method to customize how the audio stream is mixed. This method is called even if the playback is not active. // // Note: It is not useful to override this method in GDScript or C#. Only GDExtension can take advantage of it. Mix(buffer *AudioFrame, rate_scale Float.X, frames int) int // Overridable method. Called whenever the audio stream is mixed if the playback is active and [graphics.gd/classdb/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. TagUsedStreams() // Set the current value of a playback parameter by name (see [graphics.gd/classdb/AudioStream.Instance.GetParameterList]). SetParameter(name string, value any) // Return the current value of a playback parameter by name (see [graphics.gd/classdb/AudioStream.Instance.GetParameterList]). GetParameter(name string) any }