AudioStreamPlayback

package
v0.0.0-...-e1beaa7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Can play, loop, pause a scroll through audio. See graphics.gd/classdb/AudioStream and graphics.gd/classdb/AudioStreamOggVorbis for usage.

Index

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 Any

type Any interface {
	gd.IsClass
	AsAudioStreamPlayback() Instance
}

type AudioFrame

type AudioFrame = gd.AudioFrame

type Expanded

type Expanded [1]gdclass.AudioStreamPlayback

func (Expanded) SeekTo

func (self Expanded) SeekTo(time Float.X)

Seeks the stream at the given 'time', in seconds.

func (Expanded) Start

func (self Expanded) Start(from_pos Float.X)

Starts the stream from the given 'from_pos', in seconds.

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

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 (self *Extension[T]) AsAudioStreamPlayback() Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

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 New

func New() Instance

func (Instance) AsAudioStreamPlayback

func (self Instance) AsAudioStreamPlayback() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) GetLoopCount

func (self Instance) GetLoopCount() int

Returns the number of times the stream has looped.

func (Instance) GetPlaybackPosition

func (self Instance) GetPlaybackPosition() Float.X

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) ID

func (self Instance) ID() ID

func (Instance) IsPlaying

func (self Instance) IsPlaying() bool

Returns true if the stream is playing.

func (Instance) MixAudio

func (self Instance) MixAudio(rate_scale Float.X, frames int) []Vector2.XY

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) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

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.

func (Instance) Start

func (self Instance) Start()

Starts the stream from the given 'from_pos', in seconds.

func (Instance) Stop

func (self Instance) Stop()

Stops the stream.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL