From db5d1f603e0dd3076444f27008fcf1a61a4e151c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 28 Nov 2020 12:32:24 +0100 Subject: Factor out Connector from PatchageCanvas This finally breaks the dependency of the canvas on the entire application, and fixes the confusing situation where it wasn't clear whether connect/disconnect methods made/broke connections on the canvas or on the system. --- src/Patchage.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/Patchage.cpp') diff --git a/src/Patchage.cpp b/src/Patchage.cpp index fb269d5..fdd0ce9 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -168,6 +168,7 @@ Patchage::Patchage(int argc, char** argv) , INIT_WIDGET(_status_text) , _legend(nullptr) , _log(_status_text) + , _connector(_log) , _pane_initialized(false) , _attach(true) , _driver_detached(false) @@ -179,7 +180,7 @@ Patchage::Patchage(int argc, char** argv) #endif { _conf = new Configuration(); - _canvas = std::make_shared(this, 1600 * 2, 1200 * 2); + _canvas = std::make_shared(_connector, 1600 * 2, 1200 * 2); while (argc > 0) { if (!strcmp(*argv, "-h") || !strcmp(*argv, "--help")) { @@ -338,6 +339,8 @@ Patchage::Patchage(int argc, char** argv) #if defined(PATCHAGE_LIBJACK) || defined(HAVE_JACK_DBUS) _jack_driver = new JackDriver(this, _log); + _connector.add_driver(PortID::Type::jack, _jack_driver); + _jack_driver->signal_detached.connect( sigc::mem_fun(this, &Patchage::driver_detached)); @@ -349,6 +352,7 @@ Patchage::Patchage(int argc, char** argv) #ifdef HAVE_ALSA _alsa_driver = new AlsaDriver(this, _log); + _connector.add_driver(PortID::Type::alsa, _alsa_driver); #endif connect_widgets(); -- cgit v1.2.1