Table of Contents

Class AudioStreamMP3

Namespace
Godot
Assembly
GodotSharp.dll

MP3 audio stream driver. See Data if you want to load an MP3 file at run-time.

public class AudioStreamMP3 : AudioStream, IDisposable
Inheritance
AudioStreamMP3
Implements
Inherited Members

Constructors

AudioStreamMP3()

public AudioStreamMP3()

Properties

BarBeats

public int BarBeats { get; set; }

Property Value

int

BeatCount

public int BeatCount { get; set; }

Property Value

int

Bpm

public double Bpm { get; set; }

Property Value

double

Data

Contains the audio data in bytes.

You can load a file without having to import it beforehand using the code snippet below. Keep in mind that this snippet loads the whole file into memory and may not be ideal for huge files (hundreds of megabytes or more).

public AudioStreamMP3 LoadMP3(string path)
  {
      using var file = FileAccess.Open(path, FileAccess.ModeFlags.Read);
      var sound = new AudioStreamMP3();
      sound.Data = file.GetBuffer(file.GetLength());
      return sound;
  }
public byte[] Data { get; set; }

Property Value

byte[]

Loop

If true, the stream will automatically loop when it reaches the end.

public bool Loop { get; set; }

Property Value

bool

LoopOffset

Time in seconds at which the stream starts after being looped.

public double LoopOffset { get; set; }

Property Value

double

Methods

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_name

Name of the method to check for.

Returns

bool

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_name

Name of the signal to check for.

Returns

bool

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_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool