diff options
author | David Robillard <d@drobilla.net> | 2008-02-23 18:48:59 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-02-23 18:48:59 +0000 |
commit | 52c970b2d32cce2090efbbaaed6ff50de80958df (patch) | |
tree | 8e69392e8054c8349ce6dad9a4b4028d08e1ae7c /src/PatchageEvent.cpp | |
parent | 8efff32d97b1b578f8c42fe2db7b30cfc44ecf2f (diff) | |
download | patchage-52c970b2d32cce2090efbbaaed6ff50de80958df.tar.gz patchage-52c970b2d32cce2090efbbaaed6ff50de80958df.tar.bz2 patchage-52c970b2d32cce2090efbbaaed6ff50de80958df.zip |
Rearrange event port referencing stuff to make a bit more sense.
git-svn-id: http://svn.drobilla.net/lad/patchage@1159 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/PatchageEvent.cpp')
-rw-r--r-- | src/PatchageEvent.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/PatchageEvent.cpp b/src/PatchageEvent.cpp index 3f03208..d123188 100644 --- a/src/PatchageEvent.cpp +++ b/src/PatchageEvent.cpp @@ -22,6 +22,10 @@ #include "PatchageModule.hpp" #include "PatchageEvent.hpp" #include "Driver.hpp" +#include "JackDriver.hpp" +#ifdef HAVE_ALSA +#include "AlsaDriver.hpp" +#endif using namespace std; @@ -49,13 +53,24 @@ PatchageEvent::execute(Patchage* patchage) } else if (_type == PORT_CREATION) { - if ( ! _driver->create_port_view(patchage, _port_1)) { - cerr << "Unable to create port view (already exists?" << endl; + Driver* driver; + if (_port_1.type == PatchageEvent::PortRef::JACK_ID) + driver = patchage->jack_driver(); +#ifdef HAVE_ALSA + else if (_port_1.type == PatchageEvent::PortRef::ALSA_ADDR) + driver = patchage->alsa_driver(); +#endif + + if (driver) { + if ( ! driver->create_port_view(patchage, _port_1)) + cerr << "Unable to create port view (already exists?" << endl; + } else { + cerr << "ERROR: Create port with unknown port type" << endl; } } else if (_type == PORT_DESTRUCTION) { - SharedPtr<PatchagePort> port = _driver->find_port_view(patchage, _port_1); + SharedPtr<PatchagePort> port = patchage->canvas()->find_port(_port_1); if (port) { SharedPtr<PatchageModule> module = PtrCast<PatchageModule>(port->module().lock()); @@ -78,8 +93,8 @@ PatchageEvent::execute(Patchage* patchage) } else if (_type == CONNECTION) { - SharedPtr<PatchagePort> port_1 = _driver->find_port_view(patchage, _port_1); - SharedPtr<PatchagePort> port_2 = _driver->find_port_view(patchage, _port_2); + SharedPtr<PatchagePort> port_1 = patchage->canvas()->find_port(_port_1); + SharedPtr<PatchagePort> port_2 = patchage->canvas()->find_port(_port_2); if (port_1 && port_2) patchage->canvas()->add_connection(port_1, port_2, port_1->color() + 0x22222200); @@ -88,8 +103,8 @@ PatchageEvent::execute(Patchage* patchage) } else if (_type == DISCONNECTION) { - SharedPtr<PatchagePort> port_1 = _driver->find_port_view(patchage, _port_1); - SharedPtr<PatchagePort> port_2 = _driver->find_port_view(patchage, _port_2); + SharedPtr<PatchagePort> port_1 = patchage->canvas()->find_port(_port_1); + SharedPtr<PatchagePort> port_2 = patchage->canvas()->find_port(_port_2); if (port_1 && port_2) patchage->canvas()->remove_connection(port_1, port_2); |