402 lines
9.7 KiB
Diff
402 lines
9.7 KiB
Diff
Index: src/JackDbusDriver.cpp
|
|
===================================================================
|
|
--- src/JackDbusDriver.cpp (revision 2804)
|
|
+++ src/JackDbusDriver.cpp (revision 2985)
|
|
@@ -40,18 +40,19 @@
|
|
#include "PatchageModule.hpp"
|
|
|
|
-#define JACKDBUS_SERVICE "org.jackaudio.service"
|
|
-#define JACKDBUS_OBJECT "/org/jackaudio/Controller"
|
|
-#define JACKDBUS_IFACE_CONTROL "org.jackaudio.JackControl"
|
|
-#define JACKDBUS_IFACE_PATCHBAY "org.jackaudio.JackPatchbay"
|
|
+#define JACKDBUS_SERVICE "org.jackaudio.service"
|
|
+#define JACKDBUS_OBJECT "/org/jackaudio/Controller"
|
|
+#define JACKDBUS_IFACE_CONTROL "org.jackaudio.JackControl"
|
|
+#define JACKDBUS_IFACE_PATCHBAY "org.jackaudio.JackPatchbay"
|
|
+
|
|
#define JACKDBUS_CALL_DEFAULT_TIMEOUT 1000 // in milliseconds
|
|
|
|
-#define JACKDBUS_PORT_FLAG_INPUT 0x00000001
|
|
-#define JACKDBUS_PORT_FLAG_OUTPUT 0x00000002
|
|
-#define JACKDBUS_PORT_FLAG_PHYSICAL 0x00000004
|
|
-#define JACKDBUS_PORT_FLAG_CAN_MONITOR 0x00000008
|
|
-#define JACKDBUS_PORT_FLAG_TERMINAL 0x00000010
|
|
-
|
|
-#define JACKDBUS_PORT_TYPE_AUDIO 0
|
|
-#define JACKDBUS_PORT_TYPE_MIDI 1
|
|
+#define JACKDBUS_PORT_FLAG_INPUT 0x00000001
|
|
+#define JACKDBUS_PORT_FLAG_OUTPUT 0x00000002
|
|
+#define JACKDBUS_PORT_FLAG_PHYSICAL 0x00000004
|
|
+#define JACKDBUS_PORT_FLAG_CAN_MONITOR 0x00000008
|
|
+#define JACKDBUS_PORT_FLAG_TERMINAL 0x00000010
|
|
+
|
|
+#define JACKDBUS_PORT_TYPE_AUDIO 0
|
|
+#define JACKDBUS_PORT_TYPE_MIDI 1
|
|
|
|
//#define LOG_TO_STD
|
|
@@ -59,5 +60,4 @@
|
|
|
|
//#define USE_FULL_REFRESH
|
|
-
|
|
|
|
JackDriver::JackDriver(Patchage* app)
|
|
@@ -72,5 +72,4 @@
|
|
}
|
|
|
|
-
|
|
JackDriver::~JackDriver()
|
|
{
|
|
@@ -84,5 +83,4 @@
|
|
}
|
|
|
|
-
|
|
/** Destroy all JACK (canvas) ports.
|
|
*/
|
|
@@ -90,12 +88,12 @@
|
|
JackDriver::destroy_all()
|
|
{
|
|
- ItemList modules = _app->canvas()->items(); // copy
|
|
- for (ItemList::iterator m = modules.begin(); m != modules.end(); ++m) {
|
|
- SharedPtr<Module> module = PtrCast<Module>(*m);
|
|
+ FlowCanvas::ItemList modules = _app->canvas()->items(); // copy
|
|
+ for (FlowCanvas::ItemList::iterator m = modules.begin(); m != modules.end(); ++m) {
|
|
+ SharedPtr<FlowCanvas::Module> module = PtrCast<FlowCanvas::Module>(*m);
|
|
if (!module)
|
|
continue;
|
|
|
|
- PortVector ports = module->ports(); // copy
|
|
- for (PortVector::iterator p = ports.begin(); p != ports.end(); ++p) {
|
|
+ FlowCanvas::PortVector ports = module->ports(); // copy
|
|
+ for (FlowCanvas::PortVector::iterator p = ports.begin(); p != ports.end(); ++p) {
|
|
SharedPtr<PatchagePort> port = boost::dynamic_pointer_cast<PatchagePort>(*p);
|
|
if (port && (port->type() == JACK_AUDIO || port->type() == JACK_MIDI)) {
|
|
@@ -112,5 +110,4 @@
|
|
}
|
|
|
|
-
|
|
void
|
|
JackDriver::update_attached()
|
|
@@ -137,5 +134,4 @@
|
|
}
|
|
|
|
-
|
|
void
|
|
JackDriver::on_jack_appeared()
|
|
@@ -145,5 +141,4 @@
|
|
}
|
|
|
|
-
|
|
void
|
|
JackDriver::on_jack_disappeared()
|
|
@@ -161,5 +156,4 @@
|
|
_server_started = false;
|
|
}
|
|
-
|
|
|
|
/** Handle signals we have subscribed for in attach(). */
|
|
@@ -368,5 +362,4 @@
|
|
}
|
|
|
|
-
|
|
bool
|
|
JackDriver::call(
|
|
@@ -417,5 +410,4 @@
|
|
}
|
|
|
|
-
|
|
bool
|
|
JackDriver::is_started()
|
|
@@ -442,5 +434,4 @@
|
|
}
|
|
|
|
-
|
|
void
|
|
JackDriver::start_server()
|
|
@@ -456,5 +447,4 @@
|
|
update_attached();
|
|
}
|
|
-
|
|
|
|
void
|
|
@@ -474,5 +464,4 @@
|
|
}
|
|
}
|
|
-
|
|
|
|
void
|
|
@@ -514,5 +503,4 @@
|
|
}
|
|
|
|
-
|
|
void
|
|
JackDriver::detach()
|
|
@@ -520,5 +508,4 @@
|
|
stop_server();
|
|
}
|
|
-
|
|
|
|
bool
|
|
@@ -527,5 +514,4 @@
|
|
return _dbus_connection && _server_responding;
|
|
}
|
|
-
|
|
|
|
void
|
|
@@ -551,5 +537,4 @@
|
|
_app->enqueue_resize(module);
|
|
}
|
|
-
|
|
|
|
void
|
|
@@ -590,5 +575,4 @@
|
|
}
|
|
|
|
-
|
|
void
|
|
JackDriver::remove_port(
|
|
@@ -626,5 +610,4 @@
|
|
}
|
|
|
|
-
|
|
SharedPtr<PatchageModule>
|
|
JackDriver::find_or_create_module(
|
|
@@ -642,5 +625,4 @@
|
|
return module;
|
|
}
|
|
-
|
|
|
|
void
|
|
@@ -658,5 +640,5 @@
|
|
SharedPtr<PatchagePort> port1 = _app->canvas()->find_port_by_name(client1_name, port1_name);
|
|
if (!port1) {
|
|
- error_msg((string)"Unable to connect unknown port '" + port1_name + "' of client '" + client1_name + "'");
|
|
+ error_msg((std::string)"Unable to connect unknown port '" + port1_name + "' of client '" + client1_name + "'");
|
|
return;
|
|
}
|
|
@@ -664,5 +646,5 @@
|
|
SharedPtr<PatchagePort> port2 = _app->canvas()->find_port_by_name(client2_name, port2_name);
|
|
if (!port2) {
|
|
- error_msg((string)"Unable to connect unknown port '" + port2_name + "' of client '" + client2_name + "'");
|
|
+ error_msg((std::string)"Unable to connect unknown port '" + port2_name + "' of client '" + client2_name + "'");
|
|
return;
|
|
}
|
|
@@ -670,5 +652,4 @@
|
|
_app->canvas()->add_connection(port1, port2, port1->color() + 0x22222200);
|
|
}
|
|
-
|
|
|
|
void
|
|
@@ -686,5 +667,5 @@
|
|
SharedPtr<PatchagePort> port1 = _app->canvas()->find_port_by_name(client1_name, port1_name);
|
|
if (!port1) {
|
|
- error_msg((string)"Unable to disconnect unknown port '" + port1_name + "' of client '" + client1_name + "'");
|
|
+ error_msg((std::string)"Unable to disconnect unknown port '" + port1_name + "' of client '" + client1_name + "'");
|
|
return;
|
|
}
|
|
@@ -692,5 +673,5 @@
|
|
SharedPtr<PatchagePort> port2 = _app->canvas()->find_port_by_name(client2_name, port2_name);
|
|
if (!port2) {
|
|
- error_msg((string)"Unable to disconnect unknown port '" + port2_name + "' of client '" + client2_name + "'");
|
|
+ error_msg((std::string)"Unable to disconnect unknown port '" + port2_name + "' of client '" + client2_name + "'");
|
|
return;
|
|
}
|
|
@@ -698,5 +679,4 @@
|
|
_app->canvas()->remove_connection(port1, port2);
|
|
}
|
|
-
|
|
|
|
void
|
|
@@ -739,5 +719,5 @@
|
|
|
|
if (strcmp(reply_signature, "ta(tsa(tsuu))a(tstststst)") != 0) {
|
|
- error_msg((string )"GetGraph() reply signature mismatch. " + reply_signature);
|
|
+ error_msg((std::string)"GetGraph() reply signature mismatch. " + reply_signature);
|
|
goto unref;
|
|
}
|
|
@@ -858,5 +838,4 @@
|
|
}
|
|
|
|
-
|
|
void
|
|
JackDriver::refresh()
|
|
@@ -864,5 +843,4 @@
|
|
refresh_internal(true);
|
|
}
|
|
-
|
|
|
|
bool
|
|
@@ -895,5 +873,4 @@
|
|
}
|
|
|
|
-
|
|
bool
|
|
JackDriver::disconnect(
|
|
@@ -925,5 +902,4 @@
|
|
}
|
|
|
|
-
|
|
jack_nframes_t
|
|
JackDriver::buffer_size()
|
|
@@ -955,5 +931,4 @@
|
|
}
|
|
|
|
-
|
|
bool
|
|
JackDriver::set_buffer_size(jack_nframes_t size)
|
|
@@ -972,5 +947,4 @@
|
|
return true;
|
|
}
|
|
-
|
|
|
|
float
|
|
@@ -996,18 +970,20 @@
|
|
}
|
|
|
|
-
|
|
bool
|
|
JackDriver::is_realtime() const
|
|
{
|
|
DBusMessage* reply_ptr;
|
|
- dbus_bool_t realtime;
|
|
-
|
|
- if (!this->call(true, JACKDBUS_IFACE_CONTROL, "IsRealtime", &reply_ptr, DBUS_TYPE_INVALID)) {
|
|
+ dbus_bool_t realtime;
|
|
+
|
|
+ JackDriver* me = const_cast<JackDriver*>(this);
|
|
+ if (!me->call(true, JACKDBUS_IFACE_CONTROL, "IsRealtime",
|
|
+ &reply_ptr, DBUS_TYPE_INVALID)) {
|
|
return false;
|
|
}
|
|
|
|
- if (!dbus_message_get_args(reply_ptr, &this->_dbus_error, DBUS_TYPE_BOOLEAN, &realtime, DBUS_TYPE_INVALID)) {
|
|
+ if (!dbus_message_get_args(reply_ptr, &me->_dbus_error, DBUS_TYPE_BOOLEAN,
|
|
+ &realtime, DBUS_TYPE_INVALID)) {
|
|
dbus_message_unref(reply_ptr);
|
|
- dbus_error_free(&this->_dbus_error);
|
|
+ dbus_error_free(&me->_dbus_error);
|
|
error_msg("decoding reply of IsRealtime failed.");
|
|
return false;
|
|
@@ -1018,5 +994,4 @@
|
|
return realtime;
|
|
}
|
|
-
|
|
|
|
size_t
|
|
@@ -1046,5 +1021,4 @@
|
|
}
|
|
|
|
-
|
|
void
|
|
JackDriver::reset_xruns()
|
|
@@ -1058,5 +1032,4 @@
|
|
dbus_message_unref(reply_ptr);
|
|
}
|
|
-
|
|
|
|
float
|
|
@@ -1092,5 +1065,4 @@
|
|
}
|
|
|
|
-
|
|
void
|
|
JackDriver::reset_max_dsp_load()
|
|
@@ -1098,5 +1070,4 @@
|
|
_max_dsp_load = 0.0;
|
|
}
|
|
-
|
|
|
|
SharedPtr<PatchagePort>
|
|
@@ -1108,5 +1079,4 @@
|
|
}
|
|
|
|
-
|
|
void
|
|
JackDriver::error_msg(const std::string& msg) const
|
|
@@ -1121,5 +1091,4 @@
|
|
}
|
|
|
|
-
|
|
void
|
|
JackDriver::info_msg(const std::string& msg) const
|
|
Index: src/JackDbusDriver.hpp
|
|
===================================================================
|
|
--- src/JackDbusDriver.hpp (revision 2804)
|
|
+++ src/JackDbusDriver.hpp (revision 2985)
|
|
@@ -77,18 +77,18 @@
|
|
|
|
boost::shared_ptr<PatchageModule> find_or_create_module(
|
|
- ModuleType type,
|
|
+ ModuleType type,
|
|
const std::string& name);
|
|
|
|
void add_port(
|
|
boost::shared_ptr<PatchageModule>& module,
|
|
- PortType type,
|
|
- const std::string& name,
|
|
- bool is_input);
|
|
+ PortType type,
|
|
+ const std::string& name,
|
|
+ bool is_input);
|
|
|
|
void add_port(
|
|
dbus_uint64_t client_id,
|
|
- const char *client_name,
|
|
+ const char* client_name,
|
|
dbus_uint64_t port_id,
|
|
- const char *port_name,
|
|
+ const char* port_name,
|
|
dbus_uint32_t port_flags,
|
|
dbus_uint32_t port_type);
|
|
@@ -96,36 +96,36 @@
|
|
void remove_port(
|
|
dbus_uint64_t client_id,
|
|
- const char *client_name,
|
|
+ const char* client_name,
|
|
dbus_uint64_t port_id,
|
|
- const char *port_name);
|
|
+ const char* port_name);
|
|
|
|
void connect_ports(
|
|
dbus_uint64_t connection_id,
|
|
dbus_uint64_t client1_id,
|
|
- const char *client1_name,
|
|
+ const char* client1_name,
|
|
dbus_uint64_t port1_id,
|
|
- const char *port1_name,
|
|
+ const char* port1_name,
|
|
dbus_uint64_t client2_id,
|
|
- const char *client2_name,
|
|
+ const char* client2_name,
|
|
dbus_uint64_t port2_id,
|
|
- const char *port2_name);
|
|
+ const char* port2_name);
|
|
|
|
void disconnect_ports(
|
|
dbus_uint64_t connection_id,
|
|
dbus_uint64_t client1_id,
|
|
- const char *client1_name,
|
|
+ const char* client1_name,
|
|
dbus_uint64_t port1_id,
|
|
- const char *port1_name,
|
|
+ const char* port1_name,
|
|
dbus_uint64_t client2_id,
|
|
- const char *client2_name,
|
|
+ const char* client2_name,
|
|
dbus_uint64_t port2_id,
|
|
- const char *port2_name);
|
|
+ const char* port2_name);
|
|
|
|
bool call(
|
|
- bool response_expected,
|
|
- const char* iface,
|
|
- const char* method,
|
|
- DBusMessage ** reply_ptr_ptr,
|
|
- int in_type,
|
|
+ bool response_expected,
|
|
+ const char* iface,
|
|
+ const char* method,
|
|
+ DBusMessage** reply_ptr_ptr,
|
|
+ int in_type,
|
|
...);
|
|
|