summaryrefslogtreecommitdiffstats
path: root/src/JackDriver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/JackDriver.cpp')
-rw-r--r--src/JackDriver.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp
index f77fd32..fc6472b 100644
--- a/src/JackDriver.cpp
+++ b/src/JackDriver.cpp
@@ -489,7 +489,7 @@ JackDriver::jack_buffer_size_cb(jack_nframes_t buffer_size, void* jack_driver)
me->_buffer_size = buffer_size;
me->reset_xruns();
- me->reset_delay();
+ me->reset_max_dsp_load();
return 0;
}
@@ -570,3 +570,30 @@ JackDriver::set_buffer_size(jack_nframes_t size)
}
}
+float
+JackDriver::get_max_dsp_load()
+{
+ float max_load;
+ float max_delay;
+
+ max_delay = jack_get_max_delayed_usecs(_client);
+
+ const float rate = sample_rate();
+ const float size = buffer_size();
+ const float period = size / rate * 1000000; // usec
+
+ if (max_delay > period) {
+ max_load = 1.0;
+ jack_reset_max_delayed_usecs(_client);
+ } else {
+ max_load = max_delay / period;
+ }
+
+ return max_load;
+}
+
+void
+JackDriver::reset_max_dsp_load()
+{
+ jack_reset_max_delayed_usecs(_client);
+}