AudioStream
继承: Resource
< RefCounted
< Object
派生: AudioStreamGenerator
, AudioStreamInteractive
, AudioStreamMicrophone
, AudioStreamMP3
, AudioStreamOggVorbis
, AudioStreamPlaylist
, AudioStreamPolyphonic
, AudioStreamRandomizer
, AudioStreamSynchronized
, AudioStreamWAV
Base class for audio streams.
描述
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.
方法
int | _get_beat_count ( ) virtual1 const2 |
float | _get_bpm ( ) virtual1 const2 |
float | _get_length ( ) virtual1 const2 |
Array Dictionary | _get_parameter_list ( ) virtual1 const2 |
String | _get_stream_name ( ) virtual1 const2 |
AudioStreamPlayback | _instantiate_playback ( ) virtual1 const2 |
bool | _is_monophonic ( ) virtual1 const2 |
bool | can_be_sampled ( ) const2 |
AudioSample | generate_sample ( ) const2 |
float | get_length ( ) const2 |
AudioStreamPlayback | instantiate_playback ( ) |
bool | is_meta_stream ( ) const2 |
bool | is_monophonic ( ) const2 |
信号
parameter_list_changed ( )
Signal to be emitted to notify when the parameter list changed.
方法说明
int
_get_beat_count ( ) virtual1 const2
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 (AudioStreamWAV.mix_rate
, for example).
float
_get_bpm ( ) virtual1 const2
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 (AudioStreamWAV.mix_rate
, for example).
float
_get_length ( ) virtual1 const2
Override this method to customize the returned value of get_length
. Should return the length of this audio stream, in seconds.
Array Dictionary
_get_parameter_list ( ) virtual1 const2
Return the controllable parameters of this stream. This array contains dictionaries with a property info description format (see Object.get_property_list
). Additionally, the default value for this parameter must be added tho each dictionary in "default_value" field.
String
_get_stream_name ( ) virtual1 const2
Override this method to customize the name assigned to this audio stream. Unused by the engine.
AudioStreamPlayback
_instantiate_playback ( ) virtual1 const2
Override this method to customize the returned value of instantiate_playback
. Should returned a new AudioStreamPlayback
created when the stream is played (such as by an AudioStreamPlayer
)..
bool
_is_monophonic ( ) virtual1 const2
Override this method to customize the returned value of is_monophonic
. Should return true
if this audio stream only supports one channel.
bool
can_be_sampled ( ) const2
实验性: 未来版本中可能会修改或移除该方法。
Returns if the current AudioStream can be used as a sample. Only static streams can be sampled.
AudioSample
generate_sample ( ) const2
实验性: 未来版本中可能会修改或移除该方法。
Generates an AudioSample
based on the current stream.
Returns the length of the audio stream in seconds.
AudioStreamPlayback
instantiate_playback ( )
Returns a newly created AudioStreamPlayback
intended to play this audio stream. Useful for when you want to extend _instantiate_playback
but call instantiate_playback
from an internally held AudioStream subresource. An example of this can be found in the source code for AudioStreamRandomPitch::instantiate_playback
.
bool
is_meta_stream ( ) const2
Returns true
if the stream is a collection of other streams, false
otherwise.
Returns true
if this audio stream only supports one channel (monophony), or false
if the audio stream supports two or more channels (polyphony).
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。