summaryrefslogtreecommitdiffstats
path: root/servers/audio_server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'servers/audio_server.cpp')
-rw-r--r--servers/audio_server.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index fefb8bfd41..2f01f05a76 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -1369,6 +1369,12 @@ bool AudioServer::is_playback_active(Ref<AudioStreamPlayback> p_playback) {
float AudioServer::get_playback_position(Ref<AudioStreamPlayback> p_playback) {
ERR_FAIL_COND_V(p_playback.is_null(), 0);
+ // Samples.
+ if (p_playback->get_is_sample() && p_playback->get_sample_playback().is_valid()) {
+ Ref<AudioSamplePlayback> sample_playback = p_playback->get_sample_playback();
+ return AudioServer::get_singleton()->get_sample_playback_position(sample_playback);
+ }
+
AudioStreamPlaybackListNode *playback_node = _find_playback_list_node(p_playback);
if (!playback_node) {
return 0;
@@ -1835,6 +1841,11 @@ bool AudioServer::is_sample_playback_active(const Ref<AudioSamplePlayback> &p_pl
return AudioDriver::get_singleton()->is_sample_playback_active(p_playback);
}
+double AudioServer::get_sample_playback_position(const Ref<AudioSamplePlayback> &p_playback) {
+ ERR_FAIL_COND_V_MSG(p_playback.is_null(), false, "Parameter p_playback is null.");
+ return AudioDriver::get_singleton()->get_sample_playback_position(p_playback);
+}
+
void AudioServer::update_sample_playback_pitch_scale(const Ref<AudioSamplePlayback> &p_playback, float p_pitch_scale) {
ERR_FAIL_COND_MSG(p_playback.is_null(), "Parameter p_playback is null.");
return AudioDriver::get_singleton()->update_sample_playback_pitch_scale(p_playback, p_pitch_scale);