diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/JackDbusDriver.cpp | 46 | ||||
-rw-r--r-- | src/JackDbusDriver.hpp | 3 |
3 files changed, 49 insertions, 3 deletions
@@ -2,8 +2,9 @@ patchage (1.0.1) unstable; * Support Jack CV and OSC via metadata. * Configure based on compiler target OS for cross-compilation. + * Fix compilation with Jack DBus. - -- David Robillard <d@drobilla.net> Sat, 04 Oct 2014 23:07:45 -0400 + -- David Robillard <d@drobilla.net> Wed, 19 Nov 2014 13:42:09 -0500 patchage (1.0.0) stable; diff --git a/src/JackDbusDriver.cpp b/src/JackDbusDriver.cpp index ff802ce..e17d423 100644 --- a/src/JackDbusDriver.cpp +++ b/src/JackDbusDriver.cpp @@ -56,6 +56,7 @@ JackDriver::JackDriver(Patchage* app) : _app(app) , _dbus_connection(0) + , _max_dsp_load(0) , _server_responding(false) , _server_started(false) , _graph_version(0) @@ -506,8 +507,10 @@ JackDriver::add_port(PatchageModule* module, *module, type, name, + "", // TODO: pretty name is_input, - _app->state_manager()->get_port_color(type)); + _app->conf()->get_port_color(type), + _app->show_human_names()); } void @@ -533,7 +536,7 @@ JackDriver::add_port(dbus_uint64_t client_id, } ModuleType type = InputOutput; - if (_app->state_manager()->get_module_split(client_name, port_flags & JACKDBUS_PORT_FLAG_TERMINAL)) { + if (_app->conf()->get_module_split(client_name, port_flags & JACKDBUS_PORT_FLAG_TERMINAL)) { if (port_flags & JACKDBUS_PORT_FLAG_INPUT) { type = Input; } else { @@ -985,6 +988,45 @@ JackDriver::reset_xruns() dbus_message_unref(reply_ptr); } +float +JackDriver::get_max_dsp_load() +{ + DBusMessage* reply_ptr; + double load; + + if (_server_responding && !_server_started) { + return 0.0; + } + + if (!call(true, JACKDBUS_IFACE_CONTROL, "GetLoad", &reply_ptr, DBUS_TYPE_INVALID)) { + return 0.0; + } + + if (!dbus_message_get_args(reply_ptr, &_dbus_error, DBUS_TYPE_DOUBLE, &load, DBUS_TYPE_INVALID)) { + dbus_message_unref(reply_ptr); + dbus_error_free(&_dbus_error); + error_msg("decoding reply of GetLoad failed."); + return 0.0; + } + + dbus_message_unref(reply_ptr); + + load /= 100.0; // convert from percent to [0..1] + + if (load > _max_dsp_load) { + _max_dsp_load = load; + } + + return _max_dsp_load; +} + + +void +JackDriver::reset_max_dsp_load() +{ + _max_dsp_load = 0.0; +} + PatchagePort* JackDriver::create_port_view(Patchage* patchage, const PortID& id) diff --git a/src/JackDbusDriver.hpp b/src/JackDbusDriver.hpp index 01c9d5c..69cc0a5 100644 --- a/src/JackDbusDriver.hpp +++ b/src/JackDbusDriver.hpp @@ -56,6 +56,8 @@ public: size_t get_xruns(); void reset_xruns(); + float get_max_dsp_load(); + void reset_max_dsp_load(); float sample_rate(); jack_nframes_t buffer_size(); @@ -148,6 +150,7 @@ private: Patchage* _app; DBusError _dbus_error; DBusConnection* _dbus_connection; + float _max_dsp_load; bool _server_responding; bool _server_started; |