summaryrefslogtreecommitdiff
path: root/drivers/pulseaudio/audio_driver_pulseaudio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pulseaudio/audio_driver_pulseaudio.cpp')
-rw-r--r--drivers/pulseaudio/audio_driver_pulseaudio.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
index dfe9ddc55f..4cda141f92 100644
--- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp
+++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp
@@ -82,6 +82,17 @@ Error AudioDriverPulseAudio::init() {
return OK;
}
+float AudioDriverPulseAudio::get_latency() {
+
+ if (latency==0) { //only do this once since it's approximate anyway
+ int error_code;
+ pa_usec_t palat = pa_simple_get_latency( pulse,&error_code);
+ latency=double(palat)/1000000.0;
+ }
+
+ return latency;
+}
+
void AudioDriverPulseAudio::thread_func(void* p_udata) {
AudioDriverPulseAudio* ad = (AudioDriverPulseAudio*)p_udata;
@@ -121,6 +132,7 @@ void AudioDriverPulseAudio::thread_func(void* p_udata) {
ad->exit_thread = true;
break;
}
+
}
ad->thread_exited = true;
@@ -185,6 +197,7 @@ AudioDriverPulseAudio::AudioDriverPulseAudio() {
mutex = NULL;
thread = NULL;
pulse = NULL;
+ latency=0;
}
AudioDriverPulseAudio::~AudioDriverPulseAudio() {