diff options
author | David Robillard <d@drobilla.net> | 2020-11-28 23:15:04 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-11-28 23:15:04 +0100 |
commit | f95ca1978dd463d1e6c640bb00d4d420ccb9d593 (patch) | |
tree | 94e479f783b43a1eccabdd8df80e2d72ac74be8a /src | |
parent | 0124e669bd43b5d40bff33886dee8a3d464254f7 (diff) | |
download | patchage-f95ca1978dd463d1e6c640bb00d4d420ccb9d593.tar.gz patchage-f95ca1978dd463d1e6c640bb00d4d420ccb9d593.tar.bz2 patchage-f95ca1978dd463d1e6c640bb00d4d420ccb9d593.zip |
Use AlsaDriver only through base class interface
Diffstat (limited to 'src')
-rw-r--r-- | src/Patchage.cpp | 11 | ||||
-rw-r--r-- | src/Patchage.hpp | 8 |
2 files changed, 8 insertions, 11 deletions
diff --git a/src/Patchage.cpp b/src/Patchage.cpp index b071fd2..1df1903 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -125,9 +125,6 @@ port_order(const GanvPort* a, const GanvPort* b, void*) Patchage::Patchage(int argc, char** argv) : _xml(UIFile::open("patchage")) -#ifdef HAVE_ALSA - , _alsa_driver(nullptr) -#endif , _jack_driver(nullptr) , _conf(nullptr) , _gtk_main(nullptr) @@ -340,10 +337,10 @@ Patchage::Patchage(int argc, char** argv) #endif #ifdef HAVE_ALSA - _alsa_driver = new AlsaDriver( - _log, [this](const PatchageEvent& event) { on_driver_event(event); }); + _alsa_driver = std::unique_ptr<Driver>{new AlsaDriver( + _log, [this](const PatchageEvent& event) { on_driver_event(event); })}; - _connector.add_driver(PortID::Type::alsa, _alsa_driver); + _connector.add_driver(PortID::Type::alsa, _alsa_driver.get()); #endif connect_widgets(); @@ -386,7 +383,7 @@ Patchage::~Patchage() delete _jack_driver; #endif #ifdef HAVE_ALSA - delete _alsa_driver; + _alsa_driver.reset(); #endif delete _conf; diff --git a/src/Patchage.hpp b/src/Patchage.hpp index 8f0cb9a..8c0ccb5 100644 --- a/src/Patchage.hpp +++ b/src/Patchage.hpp @@ -53,7 +53,6 @@ #include <set> #include <string> -class AlsaDriver; class JackDriver; class PatchageCanvas; class Configuration; @@ -152,9 +151,10 @@ protected: std::queue<PatchageEvent> _driver_events; #ifdef HAVE_ALSA - AlsaDriver* _alsa_driver; - void menu_alsa_connect(); - void menu_alsa_disconnect(); + std::unique_ptr<Driver> _alsa_driver; + + void menu_alsa_connect(); + void menu_alsa_disconnect(); #endif std::shared_ptr<PatchageCanvas> _canvas; |