summaryrefslogtreecommitdiffstats
path: root/src/AlsaDriver.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-15 20:10:41 +0000
committerDavid Robillard <d@drobilla.net>2010-12-15 20:10:41 +0000
commitf4f74f3316b474096f164aa33c9d2e8965a545c3 (patch)
tree49ed4402f138d17592d7a33a35fde7232f799bff /src/AlsaDriver.cpp
parentaea13cac2a4106bbca28fc062d60e18ca4990c6c (diff)
downloadpatchage-f4f74f3316b474096f164aa33c9d2e8965a545c3.tar.gz
patchage-f4f74f3316b474096f164aa33c9d2e8965a545c3.tar.bz2
patchage-f4f74f3316b474096f164aa33c9d2e8965a545c3.zip
Improve performance for setups with many apps or ports.
(Eliminate all linear searches for items, except one case for Jack ports which is unavoidable due to the Jack API, but is memoized, so each port will only be searched for once between refreshes). git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@2712 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/AlsaDriver.cpp')
-rw-r--r--src/AlsaDriver.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp
index 8def786..c1928f5 100644
--- a/src/AlsaDriver.cpp
+++ b/src/AlsaDriver.cpp
@@ -122,7 +122,7 @@ AlsaDriver::find_or_create_module(
if (!m) {
m = boost::shared_ptr<PatchageModule>(new PatchageModule(patchage, client_name, type));
m->load_location();
- _app->canvas()->add_item(m);
+ _app->canvas()->add_module(client_name, m);
_app->enqueue_resize(m);
}
return m;
@@ -224,7 +224,13 @@ AlsaDriver::create_port(boost::shared_ptr<PatchageModule> parent,
{
boost::shared_ptr<PatchagePort> ret(
new PatchagePort(parent, ALSA_MIDI, name, is_input,
- _app->state_manager()->get_port_color(ALSA_MIDI)));
+ _app->state_manager()->get_port_color(ALSA_MIDI)));
+
+ boost::shared_ptr<PatchageCanvas> canvas
+ = boost::dynamic_pointer_cast<PatchageCanvas>(parent->canvas().lock());
+ if (canvas)
+ canvas->index_port(PortID(addr, is_input), ret);
+
ret->alsa_addr(addr);
return ret;
}