Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

AudioStreamPlaybackPolyphonic

繼承: AudioStreamPlayback < RefCounted < Object

AudioStreamPolyphonic 的播放實例。

說明

AudioStreamPolyphonic 的播放實例。設定 AudioStreamPlayerAudioStreamPlayer2DAudioStreamPlayer3Dstream 屬性後,可透過 AudioStreamPlayer.get_stream_playback()AudioStreamPlayer2D.get_stream_playback()AudioStreamPlayer3D.get_stream_playback() 取得播放實例。

方法

bool

is_stream_playing(stream: int) const

int

play_stream(stream: AudioStream, from_offset: float = 0, volume_db: float = 0, pitch_scale: float = 1.0, playback_type: PlaybackType = 0, bus: StringName = &"Master")

void

set_stream_pitch_scale(stream: int, pitch_scale: float)

void

set_stream_volume(stream: int, volume_db: float)

void

stop_stream(stream: int)


常數

INVALID_ID = -1 🔗

當無法再分配播放串流時,play_stream() 會回傳此值。


方法說明

bool is_stream_playing(stream: int) const 🔗

若與指定整數 ID 關聯的串流仍在播放則回傳 true。關於此 ID 何時失效請參考 play_stream()


int play_stream(stream: AudioStream, from_offset: float = 0, volume_db: float = 0, pitch_scale: float = 1.0, playback_type: PlaybackType = 0, bus: StringName = &"Master") 🔗

以指定的偏移、音量、音高倍率、播放型態及匯流排播放一段 AudioStream,播放會立即開始。

此函式會回傳一個獨一無二的整數 ID,可用來控制該播放串流。

當串流結束(未循環)、AudioStreamPlaybackPolyphonic 被停止,或呼叫 stop_stream() 時,該 ID 將失效。

若同時播放的串流數已達 AudioStreamPolyphonic.polyphony,本函式將回傳 INVALID_ID。如需更高的最大複音數,請提高此屬性值。


void set_stream_pitch_scale(stream: int, pitch_scale: float) 🔗

修改串流的音高倍率。streamplay_stream() 回傳的整數 ID。


void set_stream_volume(stream: int, volume_db: float) 🔗

修改串流音量(dB)。streamplay_stream() 回傳的整數 ID。


void stop_stream(stream: int) 🔗

停止指定串流。streamplay_stream() 回傳的整數 ID,呼叫後即失效。