diff options
author | David Robillard <d@drobilla.net> | 2008-03-16 17:01:28 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-03-16 17:01:28 +0000 |
commit | 9b24c3ac59cd0a394672689aa82b6845628626cb (patch) | |
tree | dd1b7769da86c0f6545f96c21e4937f769430701 /src/JackDriver.cpp | |
parent | 25f833aac2100a9947dbd7ee1de7d8c6a6b41648 (diff) | |
download | patchage-9b24c3ac59cd0a394672689aa82b6845628626cb.tar.gz patchage-9b24c3ac59cd0a394672689aa82b6845628626cb.tar.bz2 patchage-9b24c3ac59cd0a394672689aa82b6845628626cb.zip |
Add Jack D-Bus driver (from Nedko).
git-svn-id: http://svn.drobilla.net/lad/patchage@1167 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/JackDriver.cpp')
-rw-r--r-- | src/JackDriver.cpp | 29 |
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); +} |