Class AudioStream
- Namespace
- Godot
- Assembly
- GodotSharp.dll
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.
public class AudioStream : Resource, IDisposable
- Inheritance
-
AudioStream
- Implements
- Derived
- Inherited Members
Constructors
AudioStream()
public AudioStream()
Methods
GetLength()
Returns the length of the audio stream in seconds.
public double GetLength()
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InstantiatePlayback()
Returns a newly created AudioStreamPlayback intended to play this audio stream. Useful for when you want to extend _InstantiatePlayback() but call InstantiatePlayback() from an internally held AudioStream subresource. An example of this can be found in the source code for AudioStreamRandomPitch::instantiate_playback
.
public AudioStreamPlayback InstantiatePlayback()
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
IsMonophonic()
Returns true
if this audio stream only supports one channel (monophony), or false
if the audio stream supports two or more channels (polyphony).
public bool IsMonophonic()
Returns
_GetBeatCount()
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 (MixRate, for example).
public virtual int _GetBeatCount()
Returns
_GetBpm()
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 (MixRate, for example).
public virtual double _GetBpm()
Returns
_GetLength()
Override this method to customize the returned value of GetLength(). Should return the length of this audio stream, in seconds.
public virtual double _GetLength()
Returns
_GetStreamName()
Override this method to customize the name assigned to this audio stream. Unused by the engine.
public virtual string _GetStreamName()
Returns
_InstantiatePlayback()
Override this method to customize the returned value of InstantiatePlayback(). Should returned a new AudioStreamPlayback created when the stream is played (such as by an AudioStreamPlayer)..
public virtual AudioStreamPlayback _InstantiatePlayback()
Returns
_IsMonophonic()
Override this method to customize the returned value of IsMonophonic(). Should return true
if this audio stream only supports one channel.
public virtual bool _IsMonophonic()