AudioStreamOggVorbis
A class representing an Ogg Vorbis audio stream.
A class representing an Ogg Vorbis audio stream.
The AudioStreamOggVorbis class is a specialized AudioStream for handling Ogg Vorbis file formats. It offers functionality for loading and playing back Ogg Vorbis files, as well as managing looping and other playback properties. More info can be found in ResourceImporterOggVorbis.
This class is part of the audio stream system, which also supports WAV files through the AudioStreamWav class, and MP3 files through the AudioStreamMP3 class.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
AudioStreamOggVorbisConstructor
public AudioStreamOggVorbis();Properties7
BarBeatsProperty
public int BarBeats { get; set; }Number of musical beats per bar, for example 4 for a four-beat bar. This is composition metadata, not bars within one beat or an automatically analyzed audio value.
BeatCountProperty
public int BeatCount { get; set; }The length of the audio track, in beats. The actual duration of the audio file might be longer than what is indicated by this property. It defines the end of the audio for looping, AudioStreamPlaylist, and AudioStreamInteractive.
BpmProperty
public double Bpm { get; set; }The tempo of the audio track, measured in beats per minute.
LoopProperty
public bool Loop { get; set; }If true, the stream will play again from the specified AudioStreamOggVorbis.LoopOffset once it reaches the end of the audio track, or once it reaches the end of the last beat according to the amount specified in AudioStreamOggVorbis.BeatCount. Useful for ambient sounds and background music.
LoopOffsetProperty
public double LoopOffset { get; set; }Loop restart position in seconds when Loop is enabled. It is not a WAV frame index and does not specify an independent loop end. Check it against the actual recording.
PacketSequenceProperty
public OggPacketSequence PacketSequence { get; set; }Contains the raw Ogg data for this stream.
TagsProperty
public Reckfell.Collections.Dictionary Tags { get; set; }Contains user-defined tags if found in the Ogg Vorbis data.
Commonly used tags include title, artist, album, tracknumber, and date (date does not have a standard date format).
Note: No tag is guaranteed to be present in every file, so make sure to account for the keys not always existing.
Methods17
GetBarBeatsint
public int GetBarBeats();intGetBeatCountint
public int GetBeatCount();intGetBpmdouble
public double GetBpm();doubleGetLoopOffsetdouble
public double GetLoopOffset();doubleGetPacketSequenceOggPacketSequence
public OggPacketSequence GetPacketSequence();OggPacketSequenceGetTagsReckfell.Collections.Dictionary
public Reckfell.Collections.Dictionary GetTags();Reckfell.Collections.DictionaryHasLoopbool
public bool HasLoop();boolLoadFromBuffer2 overloads
public static AudioStreamOggVorbis LoadFromBuffer(byte[] streamData);Creates a new AudioStreamOggVorbis instance from the given buffer. The buffer must contain Ogg Vorbis data.
| Name | Type | Default |
|---|---|---|
streamData | byte[] | — |
AudioStreamOggVorbispublic static AudioStreamOggVorbis LoadFromBuffer(ReadOnlySpan<byte> streamData);Creates a new AudioStreamOggVorbis instance from the given buffer. The buffer must contain Ogg Vorbis data.
| Name | Type | Default |
|---|---|---|
streamData | ReadOnlySpan<byte> | — |
AudioStreamOggVorbisLoadFromFileAudioStreamOggVorbis
public static AudioStreamOggVorbis LoadFromFile(string path);Reads a raw audio file directly without applying editor .import settings. Use ResourceLoader.Load for a project asset with its imported settings. Set loop and music metadata on the result explicitly.
| Name | Type | Default |
|---|---|---|
path | string | — |
pathPath to the actual source file. Ensure it is available in the chosen build; an imported resource path does not guarantee the original bytes are shipped.
AudioStreamOggVorbisLoaded audio resource, or null on a reading/format error. Check the result before playback.
SetBarBeatsvoid
public void SetBarBeats(int count);| Name | Type | Default |
|---|---|---|
count | int | — |
SetBeatCountvoid
public void SetBeatCount(int count);| Name | Type | Default |
|---|---|---|
count | int | — |
SetBpmvoid
public void SetBpm(double bpm);| Name | Type | Default |
|---|---|---|
bpm | double | — |
SetLoopvoid
public void SetLoop(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetLoopOffsetvoid
public void SetLoopOffset(double seconds);| Name | Type | Default |
|---|---|---|
seconds | double | — |
SetPacketSequencevoid
public void SetPacketSequence(OggPacketSequence packetSequence);| Name | Type | Default |
|---|---|---|
packetSequence | OggPacketSequence | — |
SetTagsvoid
public void SetTags(Reckfell.Collections.Dictionary tags);| Name | Type | Default |
|---|---|---|
tags | Reckfell.Collections.Dictionary | — |