AudioStream

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: 25 Imported by: 0

Documentation

Overview

Package AudioStream provides methods for working with AudioStream 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
	AsAudioStream() Instance
}

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]) AsAudioStream

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

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

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.AudioStream

Base class for audio streams. Audio streams are used for sound effects and music playback, and support WAV (via [AudioStreamWAV]) and Ogg (via [AudioStreamOggVorbis]) file formats.

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

func (self Instance) AsAudioStream() Instance

func (Instance) AsObject

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

func (Instance) AsRefCounted

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

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) CanBeSampled

func (self Instance) CanBeSampled() bool

Returns if the current [AudioStream] can be used as a sample. Only static streams can be sampled.

func (Instance) GenerateSample

func (self Instance) GenerateSample() AudioSample.Instance

Generates an [AudioSample] based on the current stream.

func (Instance) GetLength

func (self Instance) GetLength() Float.X

Returns the length of the audio stream in seconds.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) InstantiatePlayback

func (self Instance) InstantiatePlayback() AudioStreamPlayback.Instance

Returns a newly created [AudioStreamPlayback] intended to play this audio stream. Useful for when you want to extend [method _instantiate_playback] but call [method instantiate_playback] from an internally held AudioStream subresource. An example of this can be found in the source code for [code]AudioStreamRandomPitch::instantiate_playback[/code].

func (Instance) IsMetaStream

func (self Instance) IsMetaStream() bool

Returns [code]true[/code] if the stream is a collection of other streams, [code]false[/code] otherwise.

func (Instance) IsMonophonic

func (self Instance) IsMonophonic() bool

Returns [code]true[/code] if this audio stream only supports one channel ([i]monophony[/i]), or [code]false[/code] if the audio stream supports two or more channels ([i]polyphony[/i]).

func (Instance) OnParameterListChanged

func (self Instance) OnParameterListChanged(cb func(), flags ...Signal.Flags)

func (*Instance) SetObject

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

func (Instance) Virtual

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

type Interface

type Interface interface {
	//Override this method to customize the returned value of [method instantiate_playback]. Should return a new [AudioStreamPlayback] created when the stream is played (such as by an [AudioStreamPlayer]).
	InstantiatePlayback() AudioStreamPlayback.Instance
	//Override this method to customize the name assigned to this audio stream. Unused by the engine.
	GetStreamName() string
	//Override this method to customize the returned value of [method get_length]. Should return the length of this audio stream, in seconds.
	GetLength() Float.X
	//Override this method to customize the returned value of [method is_monophonic]. Should return [code]true[/code] if this audio stream only supports one channel.
	IsMonophonic() bool
	//Overridable method. Should return the tempo of this audio stream, in beats per minute (BPM). Used by the engine to determine the position of every beat.
	//Ideally, the returned value should be based off the stream's sample rate ([member AudioStreamWAV.mix_rate], for example).
	GetBpm() Float.X
	//Overridable method. Should return the total number of beats of this audio stream. Used by the engine to determine the position of every beat.
	//Ideally, the returned value should be based off the stream's sample rate ([member AudioStreamWAV.mix_rate], for example).
	GetBeatCount() int
	//Return the controllable parameters of this stream. This array contains dictionaries with a property info description format (see [method Object.get_property_list]). Additionally, the default value for this parameter must be added tho each dictionary in "default_value" field.
	GetParameterList() []map[any]any
	//Override this method to return [code]true[/code] if this stream has a loop.
	HasLoop() bool
	//Override this method to return the bar beats of this stream.
	GetBarBeats() int
}

Jump to

Keyboard shortcuts

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