Documentation
¶
Overview ¶
Base class for audio streams. Audio streams are used for sound effects and music playback, and support WAV (via graphics.gd/classdb/AudioStreamWAV) and Ogg (via graphics.gd/classdb/AudioStreamOggVorbis) file formats.
Index ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Implementation
- type Instance
- func (self Instance) AsAudioStream() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) CanBeSampled() bool
- func (self Instance) GenerateSample() AudioSample.Instance
- func (self Instance) GetLength() Float.X
- func (self Instance) ID() ID
- func (self Instance) InstantiatePlayback() AudioStreamPlayback.Instance
- func (self Instance) IsMetaStream() bool
- func (self Instance) IsMonophonic() bool
- func (self Instance) OnParameterListChanged(cb func(), flags ...Signal.Flags)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- 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 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]) AsAudioStream ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
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.AudioStream
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) AsAudioStream ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) CanBeSampled ¶
Returns if the current graphics.gd/classdb/AudioStream can be used as a sample. Only static streams can be sampled.
func (Instance) GenerateSample ¶
func (self Instance) GenerateSample() AudioSample.Instance
Generates an graphics.gd/classdb/AudioSample based on the current stream.
func (Instance) GetLength ¶
Returns the length of the audio stream in seconds. If this stream is an graphics.gd/classdb/AudioStreamRandomizer, returns the length of the last played stream. If this stream has an indefinite length (such as for graphics.gd/classdb/AudioStreamGenerator and graphics.gd/classdb/AudioStreamMicrophone), returns 0.0.
func (Instance) InstantiatePlayback ¶
func (self Instance) InstantiatePlayback() AudioStreamPlayback.Instance
Returns a newly created graphics.gd/classdb/AudioStreamPlayback intended to play this audio stream. Useful for when you want to extend [Interface.InstantiatePlayback] but call Instance.InstantiatePlayback from an internally held AudioStream subresource. An example of this can be found in the source code for AudioStreamRandomPitch::instantiate_playback.
func (Instance) IsMetaStream ¶
Returns true if the stream is a collection of other streams, false otherwise.
func (Instance) IsMonophonic ¶
Returns true if this audio stream only supports one channel (monophony), or false if the audio stream supports two or more channels (polyphony).
func (Instance) OnParameterListChanged ¶
type Interface ¶
type Interface interface { // Override this method to customize the returned value of [Instance.InstantiatePlayback]. Should return a new [graphics.gd/classdb/AudioStreamPlayback] created when the stream is played (such as by an [graphics.gd/classdb/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 [Instance.GetLength]. Should return the length of this audio stream, in seconds. GetLength() Float.X // Override this method to customize the returned value of [Instance.IsMonophonic]. Should return true 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 ([graphics.gd/classdb/AudioStreamWAV.Instance.MixRate], 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 ([graphics.gd/classdb/AudioStreamWAV.Instance.MixRate], for example). GetBeatCount() int // Override this method to customize the tags for this audio stream. Should return a data structure of strings with the tag as the key and its content as the value. // // Commonly used tags include title, artist, album, tracknumber, and date. GetTags() map[string]interface{} // Return the controllable parameters of this stream. This array contains dictionaries with a property info description format (see [graphics.gd/classdb/Object.Instance.GetPropertyList]). Additionally, the default value for this parameter must be added tho each dictionary in "default_value" field. GetParameterList() [][]Object.PropertyInfo // Override this method to return true if this stream has a loop. HasLoop() bool // Override this method to return the bar beats of this stream. GetBarBeats() int }