mirror of https://github.com/godotengine/godot
Merge pull request #95839 from GustJc/interactive_audio_current_playback
Expose `AudioStreamPlaybackInteractive::get_current_clip_index()`.
This commit is contained in:
commit
ae38cdbb6d
|
|
@ -1018,6 +1018,10 @@ void AudioStreamPlaybackInteractive::switch_to_clip(int p_index) {
|
|||
switch_request = p_index;
|
||||
}
|
||||
|
||||
int AudioStreamPlaybackInteractive::get_current_clip_index() const {
|
||||
return playback_current;
|
||||
}
|
||||
|
||||
int AudioStreamPlaybackInteractive::get_loop_count() const {
|
||||
return 0; // Looping not supported
|
||||
}
|
||||
|
|
@ -1033,4 +1037,5 @@ bool AudioStreamPlaybackInteractive::is_playing() const {
|
|||
void AudioStreamPlaybackInteractive::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("switch_to_clip_by_name", "clip_name"), &AudioStreamPlaybackInteractive::switch_to_clip_by_name);
|
||||
ClassDB::bind_method(D_METHOD("switch_to_clip", "clip_index"), &AudioStreamPlaybackInteractive::switch_to_clip);
|
||||
ClassDB::bind_method(D_METHOD("get_current_clip_index"), &AudioStreamPlaybackInteractive::get_current_clip_index);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -259,6 +259,7 @@ public:
|
|||
|
||||
void switch_to_clip_by_name(const StringName &p_name);
|
||||
void switch_to_clip(int p_index);
|
||||
int get_current_clip_index() const;
|
||||
|
||||
virtual void set_parameter(const StringName &p_name, const Variant &p_value) override;
|
||||
virtual Variant get_parameter(const StringName &p_name) const override;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,18 @@
|
|||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="get_current_clip_index" qualifiers="const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
Return the index of the currently playing clip. You can use this to get the name of the currently playing clip with [method AudioStreamInteractive.get_clip_name].
|
||||
[b]Example:[/b] Get the currently playing clip name from inside an [AudioStreamPlayer] node.
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
var playing_clip_name = stream.get_clip_name(get_stream_playback().get_current_clip_index())
|
||||
[/gdscript]
|
||||
[/codeblocks]
|
||||
</description>
|
||||
</method>
|
||||
<method name="switch_to_clip">
|
||||
<return type="void" />
|
||||
<param index="0" name="clip_index" type="int" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue