AudioStreamOggVorbis

继承: AudioStream < Resource < RefCounted < Object

代表 Ogg Vorbis 音频流的类。

描述

AudioStreamOggVorbis 类是专用于处理 Ogg Vorbis 文件格式的 AudioStream 类。它提供加载和播放 Ogg Vorbis 文件以及管理循环和其他播放属性的功能。该类是音频流系统的一部分,该系统还通过 AudioStreamWAV 类支持 WAV 系统。

教程

属性

int

bar_beats

4

int

beat_count

0

float

bpm

0.0

bool

loop

false

float

loop_offset

0.0

OggPacketSequence

packet_sequence

Dictionary

tags

{}

方法

AudioStreamOggVorbis

load_from_buffer(stream_data: PackedByteArray) static

AudioStreamOggVorbis

load_from_file(path: String) static


属性说明

int bar_beats = 4 🔗

  • void set_bar_beats(value: int)

  • int get_bar_beats()

There is currently no description for this property. Please help us by contributing one!


int beat_count = 0 🔗

  • void set_beat_count(value: int)

  • int get_beat_count()

There is currently no description for this property. Please help us by contributing one!


float bpm = 0.0 🔗

There is currently no description for this property. Please help us by contributing one!


bool loop = false 🔗

  • void set_loop(value: bool)

  • bool has_loop()

如果为 true,则音频播放完成后将从 loop_offset 指定的位置再次播放。可用于环境声音和背景音乐。


float loop_offset = 0.0 🔗

  • void set_loop_offset(value: float)

  • float get_loop_offset()

循环时,流开始的时间,单位为秒。


OggPacketSequence packet_sequence 🔗

包含用于这个流的原始 Ogg 数据。


Dictionary tags = {} 🔗

如果在 Ogg Vorbis 数据中存在标签,则包含用户定义的标签。

常用标签包括标题 title、艺术家 artist、专辑 album、音轨号 tracknumber、日期 datedate 没有标准日期格式)。

注意:无法保证每个文件中都有某个标签,因此请考虑键可能不是始终存在。


方法说明

AudioStreamOggVorbis load_from_buffer(stream_data: PackedByteArray) static 🔗

从给定缓冲区新建 AudioStreamOggVorbis 实例。缓冲区中必须包含 Ogg Vorbis 数据。


AudioStreamOggVorbis load_from_file(path: String) static 🔗

从给定的文件路径新建 AudioStreamOggVorbis 实例。文件必须为 Ogg Vorbis 格式。