mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-05 14:10:19 +03:00
236 lines
10 KiB
ReStructuredText
236 lines
10 KiB
ReStructuredText
:github_url: hide
|
||
|
||
.. _class_AudioStreamOggVorbis:
|
||
|
||
AudioStreamOggVorbis
|
||
====================
|
||
|
||
**继承:** :ref:`AudioStream<class_AudioStream>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
||
|
||
代表 Ogg Vorbis 音频流的类。
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
描述
|
||
----
|
||
|
||
AudioStreamOggVorbis 类是专用于处理 Ogg Vorbis 文件格式的 :ref:`AudioStream<class_AudioStream>` 类。它提供加载和播放 Ogg Vorbis 文件以及管理循环和其他播放属性的功能。该类是音频流系统的一部分,该系统还通过 :ref:`AudioStreamWAV<class_AudioStreamWAV>` 类支持 WAV 系统。
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
教程
|
||
----
|
||
|
||
- :doc:`运行时文件加载与保存 <../tutorials/io/runtime_file_loading_and_saving>`
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
属性
|
||
----
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------+-----------+
|
||
| :ref:`int<class_int>` | :ref:`bar_beats<class_AudioStreamOggVorbis_property_bar_beats>` | ``4`` |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------+-----------+
|
||
| :ref:`int<class_int>` | :ref:`beat_count<class_AudioStreamOggVorbis_property_beat_count>` | ``0`` |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------+-----------+
|
||
| :ref:`float<class_float>` | :ref:`bpm<class_AudioStreamOggVorbis_property_bpm>` | ``0.0`` |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------+-----------+
|
||
| :ref:`bool<class_bool>` | :ref:`loop<class_AudioStreamOggVorbis_property_loop>` | ``false`` |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------+-----------+
|
||
| :ref:`float<class_float>` | :ref:`loop_offset<class_AudioStreamOggVorbis_property_loop_offset>` | ``0.0`` |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------+-----------+
|
||
| :ref:`OggPacketSequence<class_OggPacketSequence>` | :ref:`packet_sequence<class_AudioStreamOggVorbis_property_packet_sequence>` | |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------+-----------+
|
||
| :ref:`Dictionary<class_Dictionary>` | :ref:`tags<class_AudioStreamOggVorbis_property_tags>` | ``{}`` |
|
||
+---------------------------------------------------+-----------------------------------------------------------------------------+-----------+
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
方法
|
||
----
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+---------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`AudioStreamOggVorbis<class_AudioStreamOggVorbis>` | :ref:`load_from_buffer<class_AudioStreamOggVorbis_method_load_from_buffer>`\ (\ stream_data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |static| |
|
||
+---------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`AudioStreamOggVorbis<class_AudioStreamOggVorbis>` | :ref:`load_from_file<class_AudioStreamOggVorbis_method_load_from_file>`\ (\ path\: :ref:`String<class_String>`\ ) |static| |
|
||
+---------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
属性说明
|
||
--------
|
||
|
||
.. _class_AudioStreamOggVorbis_property_bar_beats:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`int<class_int>` **bar_beats** = ``4`` :ref:`🔗<class_AudioStreamOggVorbis_property_bar_beats>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_bar_beats**\ (\ value\: :ref:`int<class_int>`\ )
|
||
- :ref:`int<class_int>` **get_bar_beats**\ (\ )
|
||
|
||
.. container:: contribute
|
||
|
||
There is currently no description for this property. Please help us by `contributing one <https://contributing.godotengine.org/en/latest/documentation/class_reference.html>`__!
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AudioStreamOggVorbis_property_beat_count:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`int<class_int>` **beat_count** = ``0`` :ref:`🔗<class_AudioStreamOggVorbis_property_beat_count>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_beat_count**\ (\ value\: :ref:`int<class_int>`\ )
|
||
- :ref:`int<class_int>` **get_beat_count**\ (\ )
|
||
|
||
.. container:: contribute
|
||
|
||
There is currently no description for this property. Please help us by `contributing one <https://contributing.godotengine.org/en/latest/documentation/class_reference.html>`__!
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AudioStreamOggVorbis_property_bpm:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **bpm** = ``0.0`` :ref:`🔗<class_AudioStreamOggVorbis_property_bpm>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_bpm**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_bpm**\ (\ )
|
||
|
||
.. container:: contribute
|
||
|
||
There is currently no description for this property. Please help us by `contributing one <https://contributing.godotengine.org/en/latest/documentation/class_reference.html>`__!
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AudioStreamOggVorbis_property_loop:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **loop** = ``false`` :ref:`🔗<class_AudioStreamOggVorbis_property_loop>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_loop**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **has_loop**\ (\ )
|
||
|
||
如果为 ``true``\ ,则音频播放完成后将从 :ref:`loop_offset<class_AudioStreamOggVorbis_property_loop_offset>` 指定的位置再次播放。可用于环境声音和背景音乐。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AudioStreamOggVorbis_property_loop_offset:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **loop_offset** = ``0.0`` :ref:`🔗<class_AudioStreamOggVorbis_property_loop_offset>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_loop_offset**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_loop_offset**\ (\ )
|
||
|
||
循环时,流开始的时间,单位为秒。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AudioStreamOggVorbis_property_packet_sequence:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`OggPacketSequence<class_OggPacketSequence>` **packet_sequence** :ref:`🔗<class_AudioStreamOggVorbis_property_packet_sequence>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_packet_sequence**\ (\ value\: :ref:`OggPacketSequence<class_OggPacketSequence>`\ )
|
||
- :ref:`OggPacketSequence<class_OggPacketSequence>` **get_packet_sequence**\ (\ )
|
||
|
||
包含用于这个流的原始 Ogg 数据。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AudioStreamOggVorbis_property_tags:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`Dictionary<class_Dictionary>` **tags** = ``{}`` :ref:`🔗<class_AudioStreamOggVorbis_property_tags>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_tags**\ (\ value\: :ref:`Dictionary<class_Dictionary>`\ )
|
||
- :ref:`Dictionary<class_Dictionary>` **get_tags**\ (\ )
|
||
|
||
如果在 Ogg Vorbis 数据中存在标签,则包含用户定义的标签。
|
||
|
||
常用标签包括标题 ``title``\ 、艺术家 ``artist``\ 、专辑 ``album``\ 、音轨号 ``tracknumber``\ 、日期 ``date``\ (\ ``date`` 没有标准日期格式)。
|
||
|
||
\ **注意:**\ 无法\ *保证*\ 每个文件中都有某个标签,因此请考虑键可能不是始终存在。
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
方法说明
|
||
--------
|
||
|
||
.. _class_AudioStreamOggVorbis_method_load_from_buffer:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`AudioStreamOggVorbis<class_AudioStreamOggVorbis>` **load_from_buffer**\ (\ stream_data\: :ref:`PackedByteArray<class_PackedByteArray>`\ ) |static| :ref:`🔗<class_AudioStreamOggVorbis_method_load_from_buffer>`
|
||
|
||
从给定缓冲区新建 **AudioStreamOggVorbis** 实例。缓冲区中必须包含 Ogg Vorbis 数据。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_AudioStreamOggVorbis_method_load_from_file:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`AudioStreamOggVorbis<class_AudioStreamOggVorbis>` **load_from_file**\ (\ path\: :ref:`String<class_String>`\ ) |static| :ref:`🔗<class_AudioStreamOggVorbis_method_load_from_file>`
|
||
|
||
从给定的文件路径新建 **AudioStreamOggVorbis** 实例。文件必须为 Ogg Vorbis 格式。
|
||
|
||
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
|
||
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
||
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
|
||
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`
|
||
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
|
||
.. |static| replace:: :abbr:`static (调用本方法无需实例,可直接使用类名进行调用。)`
|
||
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效运算符。)`
|
||
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列位标志构成位掩码的整数。)`
|
||
.. |void| replace:: :abbr:`void (无返回值。)`
|