AudioStreamPlayback

package
v0.0.0-...-156fa99 Latest Latest
Warning

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

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

Documentation

Overview

Package AudioStreamPlayback provides methods for working with AudioStreamPlayback object instances.

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 [param time], in seconds.

func (Expanded) Start

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

Starts the stream from the given [param 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

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

Can play, loop, pause a scroll through audio. See [AudioStream] and [AudioStreamOggVorbis] for usage.

See [Interface] for methods that can be overridden by a [Class] that extends it.
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 [AudioSamplePlayback] associated with this [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 [code]true[/code] if the stream is playing.

func (Instance) MixAudio

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

Mixes up to [param frames] of audio from the stream from the current position, at a rate of [param rate_scale], advancing the stream. Returns a [PackedVector2Array] where each element holds the left and right channel volume levels of each frame. [b]Note:[/b] 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 [param 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 [AudioSamplePlayback] to this [AudioStreamPlayback] for playing back the audio sample of this stream.

func (Instance) Start

func (self Instance) Start()

Starts the stream from the given [param 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 [method AudioStreamPlayer.play].
	Start(from_pos Float.X)
	//Override this method to customize what happens when the playback is stopped, such as by calling [method AudioStreamPlayer.stop].
	Stop()
	//Overridable method. Should return [code]true[/code] 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 [code]0[/code].
	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 [param position], such as by calling [method AudioStreamPlayer.seek].
	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.
	//[b]Note:[/b] 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 [method AudioServer.set_enable_tagging_used_audio_streams] has been set to [code]true[/code]. 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 [method AudioStream._get_parameter_list]).
	SetParameter(name string, value any)
	//Return the current value of a playback parameter by name (see [method AudioStream._get_parameter_list]).
	GetParameter(name string) any
}

Jump to

Keyboard shortcuts

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