summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/JackDbusDriver.cpp124
-rw-r--r--src/JackDbusDriver.hpp20
-rw-r--r--src/JackDriver.hpp22
-rw-r--r--src/Patchage.cpp10
4 files changed, 65 insertions, 111 deletions
diff --git a/src/JackDbusDriver.cpp b/src/JackDbusDriver.cpp
index 46f29b1..f2ae7ed 100644
--- a/src/JackDbusDriver.cpp
+++ b/src/JackDbusDriver.cpp
@@ -28,14 +28,16 @@
#include <dbus/dbus-glib-lowlevel.h>
#include <boost/format.hpp>
+
+#include "raul/log.hpp"
#include "raul/SharedPtr.hpp"
+#include "Driver.hpp"
+#include "JackDbusDriver.hpp"
+#include "Patchage.hpp"
#include "PatchageCanvas.hpp"
#include "PatchageEvent.hpp"
-#include "Patchage.hpp"
#include "PatchageModule.hpp"
-#include "Driver.hpp"
-#include "JackDbusDriver.hpp"
using namespace std;
using namespace FlowCanvas;
@@ -163,36 +165,33 @@ JackDriver::on_jack_disappeared()
}
+/** Handle signals we have subscribed for in attach(). */
DBusHandlerResult
JackDriver::dbus_message_hook(
DBusConnection* connection,
DBusMessage* message,
void* jack_driver)
{
- dbus_uint64_t new_graph_version;
- dbus_uint64_t client_id;
- const char *client_name;
- dbus_uint64_t port_id;
- const char *port_name;
+ const char* client2_name;
+ const char* client_name;
+ const char* new_owner;
+ const char* object_name;
+ const char* old_owner;
+ const char* port2_name;
+ const char* port_name;
dbus_uint32_t port_flags;
dbus_uint32_t port_type;
dbus_uint64_t client2_id;
- const char *client2_name;
- dbus_uint64_t port2_id;
- const char *port2_name;
+ dbus_uint64_t client_id;
dbus_uint64_t connection_id;
- const char *object_name;
- const char *old_owner;
- const char *new_owner;
+ dbus_uint64_t new_graph_version;
+ dbus_uint64_t port2_id;
+ dbus_uint64_t port_id;
assert(jack_driver);
JackDriver* me = reinterpret_cast<JackDriver*>(jack_driver);
assert(me->_dbus_connection);
- //me->info_msg("dbus_message_hook() called.");
-
- // Handle signals we have subscribed for in attach()
-
if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
if (!dbus_message_get_args( message, &me->_dbus_error,
DBUS_TYPE_STRING, &object_name,
@@ -706,27 +705,27 @@ JackDriver::disconnect_ports(
void
JackDriver::refresh_internal(bool force)
{
- DBusMessage* reply_ptr;
+ DBusMessage* reply_ptr;
DBusMessageIter iter;
- dbus_uint64_t version;
- const char * reply_signature;
+ dbus_uint64_t version;
+ const char* reply_signature;
DBusMessageIter clients_array_iter;
DBusMessageIter client_struct_iter;
DBusMessageIter ports_array_iter;
DBusMessageIter port_struct_iter;
DBusMessageIter connections_array_iter;
DBusMessageIter connection_struct_iter;
- dbus_uint64_t client_id;
- const char *client_name;
- dbus_uint64_t port_id;
- const char *port_name;
- dbus_uint32_t port_flags;
- dbus_uint32_t port_type;
- dbus_uint64_t client2_id;
- const char *client2_name;
- dbus_uint64_t port2_id;
- const char *port2_name;
- dbus_uint64_t connection_id;
+ dbus_uint64_t client_id;
+ const char* client_name;
+ dbus_uint64_t port_id;
+ const char* port_name;
+ dbus_uint32_t port_flags;
+ dbus_uint32_t port_type;
+ dbus_uint64_t client2_id;
+ const char* client2_name;
+ dbus_uint64_t port2_id;
+ const char* port2_name;
+ dbus_uint64_t connection_id;
if (force) {
version = 0; // workaround module split/join stupidity
@@ -874,16 +873,16 @@ JackDriver::connect(
boost::shared_ptr<PatchagePort> src,
boost::shared_ptr<PatchagePort> dst)
{
- const char *client1_name;
- const char *port1_name;
- const char *client2_name;
- const char *port2_name;
+ const char* client1_name;
+ const char* port1_name;
+ const char* client2_name;
+ const char* port2_name;
DBusMessage* reply_ptr;
client1_name = src->module().lock()->name().c_str();
- port1_name = src->name().c_str();
+ port1_name = src->name().c_str();
client2_name = dst->module().lock()->name().c_str();
- port2_name = dst->name().c_str();
+ port2_name = dst->name().c_str();
if (!call(true, JACKDBUS_IFACE_PATCHBAY, "ConnectPortsByName", &reply_ptr,
DBUS_TYPE_STRING, &client1_name,
@@ -904,16 +903,16 @@ JackDriver::disconnect(
boost::shared_ptr<PatchagePort> src,
boost::shared_ptr<PatchagePort> dst)
{
- const char *client1_name;
- const char *port1_name;
- const char *client2_name;
- const char *port2_name;
+ const char* client1_name;
+ const char* port1_name;
+ const char* client2_name;
+ const char* port2_name;
DBusMessage* reply_ptr;
client1_name = src->module().lock()->name().c_str();
- port1_name = src->name().c_str();
+ port1_name = src->name().c_str();
client2_name = dst->module().lock()->name().c_str();
- port2_name = dst->name().c_str();
+ port2_name = dst->name().c_str();
if (!call(true, JACKDBUS_IFACE_PATCHBAY, "DisconnectPortsByName", &reply_ptr,
DBUS_TYPE_STRING, &client1_name,
@@ -1024,9 +1023,9 @@ JackDriver::is_realtime() const
size_t
-JackDriver::xruns()
+JackDriver::get_xruns()
{
- DBusMessage* reply_ptr;
+ DBusMessage* reply_ptr;
dbus_uint32_t xruns;
if (_server_responding && !_server_started) {
@@ -1088,8 +1087,7 @@ JackDriver::get_max_dsp_load()
load /= 100.0; // dbus returns it in percents, we use 0..1
- if (load > _max_dsp_load)
- {
+ if (load > _max_dsp_load) {
_max_dsp_load = load;
}
@@ -1104,37 +1102,9 @@ JackDriver::reset_max_dsp_load()
}
-void
-JackDriver::start_transport()
-{
- //info_msg(__func__);
-}
-
-
-void
-JackDriver::stop_transport()
-{
- //info_msg(__func__);
-}
-
-
-void
-JackDriver::rewind_transport()
-{
- //info_msg(__func__);
-}
-
-
-boost::shared_ptr<PatchagePort>
-JackDriver::find_port_view(Patchage* patchage, const PortID& id)
-{
- assert(false); // we dont use events at all
-}
-
-
boost::shared_ptr<PatchagePort>
JackDriver::create_port_view(
- Patchage * patchage,
+ Patchage* patchage,
const PortID& id)
{
assert(false); // we dont use events at all
diff --git a/src/JackDbusDriver.hpp b/src/JackDbusDriver.hpp
index df9a916..0511c42 100644
--- a/src/JackDbusDriver.hpp
+++ b/src/JackDbusDriver.hpp
@@ -54,28 +54,18 @@ public:
boost::shared_ptr<PatchagePort> src,
boost::shared_ptr<PatchagePort> dst);
- void start_transport();
- void stop_transport();
- void rewind_transport();
+ size_t get_xruns();
+ void reset_xruns();
- void reset_xruns();
+ float get_max_dsp_load();
+ void reset_max_dsp_load();
+ float sample_rate();
jack_nframes_t buffer_size();
bool set_buffer_size(jack_nframes_t size);
- float sample_rate();
-
- size_t xruns();
-
- float get_max_dsp_load();
- void reset_max_dsp_load();
-
void process_events(Patchage* app) {}
- boost::shared_ptr<PatchagePort> find_port_view(
- Patchage* patchage,
- const PortID& ref);
-
boost::shared_ptr<PatchagePort> create_port_view(
Patchage* patchage,
const PortID& ref);
diff --git a/src/JackDriver.hpp b/src/JackDriver.hpp
index 4cf8a1c..b9fb4f4 100644
--- a/src/JackDriver.hpp
+++ b/src/JackDriver.hpp
@@ -64,30 +64,18 @@ public:
bool disconnect(boost::shared_ptr<PatchagePort> src,
boost::shared_ptr<PatchagePort> dst);
- void start_transport() { jack_transport_start(_client); }
- void stop_transport() { jack_transport_stop(_client); }
+ size_t get_xruns() { return _xruns; }
+ void reset_xruns();
- void reset_xruns();
- void reset_max_dsp_load();
-
- void rewind_transport() {
- jack_position_t zero;
- zero.frame = 0;
- zero.valid = (jack_position_bits_t)0;
- jack_transport_reposition(_client, &zero);
- }
+ float get_max_dsp_load();
+ void reset_max_dsp_load();
jack_client_t* client() { return _client; }
+ float sample_rate() { return jack_get_sample_rate(_client); }
jack_nframes_t buffer_size();
bool set_buffer_size(jack_nframes_t size);
- inline float sample_rate() { return jack_get_sample_rate(_client); }
-
- inline size_t xruns() { return _xruns; }
-
- float get_max_dsp_load();
-
void process_events(Patchage* app);
private:
diff --git a/src/Patchage.cpp b/src/Patchage.cpp
index 1db04ea..48f69ae 100644
--- a/src/Patchage.cpp
+++ b/src/Patchage.cpp
@@ -373,7 +373,13 @@ Patchage::idle_callback()
_driver_detached = false;
flush_resize();
- update_load();
+
+ // Update load every 10 idle callbacks
+ static int count = 0;
+ if (++count == 10) {
+ update_load();
+ count = 0;
+ }
return true;
}
@@ -400,7 +406,7 @@ Patchage::update_load()
return true;
char tmp_buf[8];
- snprintf(tmp_buf, 8, "%zd", _jack_driver->xruns());
+ snprintf(tmp_buf, 8, "%zd", _jack_driver->get_xruns());
_main_xrun_progress->set_text(string(tmp_buf) + " Dropouts");