summaryrefslogtreecommitdiffstats
path: root/src/JackDriver.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-04-06 17:35:19 +0000
committerDavid Robillard <d@drobilla.net>2014-04-06 17:35:19 +0000
commit3ef2b738b728b9758b527028b88d9d44b929c1d7 (patch)
treea4ce90739b4cca27aed56202a50f0f423034fdf4 /src/JackDriver.cpp
parent9e31195fec9fb11b03891f1c5bbc243e82da4d30 (diff)
downloadpatchage-3ef2b738b728b9758b527028b88d9d44b929c1d7.tar.gz
patchage-3ef2b738b728b9758b527028b88d9d44b929c1d7.tar.bz2
patchage-3ef2b738b728b9758b527028b88d9d44b929c1d7.zip
Resurrect toolbar with Jack info and dropout indicator.
Move legend to right hand side of toolbar. Store toolbar visible state in configuration. git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@5359 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/JackDriver.cpp')
-rw-r--r--src/JackDriver.cpp39
1 files changed, 28 insertions, 11 deletions
diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp
index db06480..bb40647 100644
--- a/src/JackDriver.cpp
+++ b/src/JackDriver.cpp
@@ -86,14 +86,6 @@ JackDriver::attach(bool launch_daemon)
signal_attached.emit();
std::stringstream ss;
_app->info_msg("Jack: Attached.");
- const jack_nframes_t buffer_size = this->buffer_size();
- const jack_nframes_t sample_rate = this->sample_rate();
- if (sample_rate != 0) {
- const int latency_ms = lrintf((buffer_size * 1000 / (float)sample_rate));
- ss << "Jack: Latency: " << buffer_size << " frames @ "
- << (sample_rate / 1000) << "kHz (" << latency_ms << "ms).";
- _app->info_msg(ss.str());
- }
} else {
_app->error_msg("Jack: Client activation failed.");
_is_activated = false;
@@ -463,9 +455,6 @@ JackDriver::jack_xrun_cb(void* jack_driver)
++me->_xruns;
me->_xrun_delay = jack_get_xrun_delayed_usecs(me->_client);
- me->_app->warning_msg((format("Jack: xrun of %1%ms.")
- % me->_xrun_delay).str());
-
jack_reset_max_delayed_usecs(me->_client);
return 0;
@@ -499,6 +488,34 @@ JackDriver::reset_xruns()
_xrun_delay = 0;
}
+float
+JackDriver::get_max_dsp_load()
+{
+ float max_load = 0.0f;
+ if (_client) {
+ const float 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()
+{
+ if (_client) {
+ jack_reset_max_delayed_usecs(_client);
+ }
+}
+
bool
JackDriver::set_buffer_size(jack_nframes_t size)
{