summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-01-09 03:22:27 +0000
committerDavid Robillard <d@drobilla.net>2008-01-09 03:22:27 +0000
commit8977d27c4a038ce640d1726d48a1f8fc597eb90b (patch)
tree943c0af410241d03f4b37b4ea62abebfc59e9c35 /src
parent6ee437d238c8cefe62b286f5a422670e705e795d (diff)
downloadpatchage-8977d27c4a038ce640d1726d48a1f8fc597eb90b.tar.gz
patchage-8977d27c4a038ce640d1726d48a1f8fc597eb90b.tar.bz2
patchage-8977d27c4a038ce640d1726d48a1f8fc597eb90b.zip
More patchage refresh performance improvements.
git-svn-id: http://svn.drobilla.net/lad/patchage@1044 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/AlsaDriver.cpp10
-rw-r--r--src/JackDriver.cpp42
2 files changed, 20 insertions, 32 deletions
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp
index 8047318..340d050 100644
--- a/src/AlsaDriver.cpp
+++ b/src/AlsaDriver.cpp
@@ -311,14 +311,8 @@ AlsaDriver::add_connections(boost::shared_ptr<PatchagePort> port)
connected_port = _app->canvas()->find_port(*connected_addr, true);
- if (connected_port) {
- boost::shared_ptr<Connection> existing = _app->canvas()->get_connection(port, connected_port);
- if (existing) {
- existing->set_flagged(false);
- } else {
- _app->canvas()->add_connection(port, connected_port, port->color() + 0x22222200);
- }
- }
+ if (connected_port && !port->is_connected_to(connected_port))
+ _app->canvas()->add_connection(port, connected_port, port->color() + 0x22222200);
snd_seq_query_subscribe_set_index(subsinfo, snd_seq_query_subscribe_get_index(subsinfo) + 1);
}
diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp
index 7a3e66d..adf380c 100644
--- a/src/JackDriver.cpp
+++ b/src/JackDriver.cpp
@@ -222,8 +222,6 @@ JackDriver::refresh()
client1_name = client1_name.substr(0, client1_name.find(":"));
ModuleType type = InputOutput;
- //if (_app->state_manager()->get_module_split(client1_name)
- // || jack_port_flags(port) & JackPortIsTerminal)
if (_app->state_manager()->get_module_split(client1_name,
(jack_port_flags(port) & JackPortIsTerminal))) {
if (jack_port_flags(port) & JackPortIsInput) {
@@ -238,7 +236,6 @@ JackDriver::refresh()
if (!m) {
m = boost::shared_ptr<PatchageModule>(new PatchageModule(_app, client1_name, type));
m->load_location();
- m->store_location();
_app->canvas()->add_item(m);
}
@@ -263,20 +260,21 @@ JackDriver::refresh()
}
// Add all connections
- if (ports)
+ if (ports) {
+
+ _mutex.lock();
+
+ if (!_client) {
+ _mutex.unlock();
+ shutdown();
+ return;
+ }
+
for (int i=0; ports[i]; ++i) {
- _mutex.lock();
- if (!_client) {
- _mutex.unlock();
- shutdown();
- return;
- }
port = jack_port_by_name(_client, ports[i]);
const char** connected_ports = jack_port_get_all_connections(_client, port);
-
- _mutex.unlock();
-
+
if (connected_ports) {
for (int j=0; connected_ports[j]; ++j) {
client1_name = ports[i];
@@ -301,26 +299,22 @@ JackDriver::refresh()
if (port1->is_output() && port2->is_input()) {
src = port1;
dst = port2;
- } else if (port2->is_output() && port1->is_input()) {
+ } else {
src = port2;
dst = port1;
}
- if (src && dst) {
- boost::shared_ptr<Connection> existing
- = _app->canvas()->get_connection(src, dst);
-
- if (existing) {
- existing->set_flagged(false);
- } else {
- _app->canvas()->add_connection(src, dst, port1->color() + 0x22222200);
- }
- }
+ if (src && dst && !src->is_connected_to(dst))
+ _app->canvas()->add_connection(src, dst, port1->color() + 0x22222200);
}
free(connected_ports);
}
}
+
+ _mutex.unlock();
+
+ }
free(ports);
}