From 8652fe99e3cb80fac22a601c89ba405962c5537d Mon Sep 17 00:00:00 2001 From: sudden6 Date: Mon, 5 Jun 2017 18:36:18 +0200 Subject: [PATCH] feat(audio): make the libfilteraudio dependency optional --- cmake/Dependencies.cmake | 1 - src/audio/audio.cpp | 7 ++++++- src/widget/form/settings/avform.cpp | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 558c5e44a..8364ac367 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -117,7 +117,6 @@ if (NOT TOXCORE_FOUND OR endif() search_dependency(OPENAL PACKAGE openal) -search_dependency(FILTERAUDIO LIBRARY filteraudio) if (PLATFORM_EXTENSIONS AND UNIX AND NOT APPLE) # Automatic auto-away support. (X11 also using for capslock detection) diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index 1e0681b98..aa92fbe35 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -19,7 +19,9 @@ #include "audio.h" #include "src/audio/backend/openal.h" +#ifdef USE_FILTERAUDIO #include "src/audio/backend/openal2.h" +#endif #include "src/persistence/settings.h" #include @@ -167,6 +169,7 @@ */ Audio& Audio::getInstance() { +#ifdef USE_FILTERAUDIO static bool initialized = false; static bool Backend2 = false; @@ -178,7 +181,9 @@ Audio& Audio::getInstance() if (Backend2) { static OpenAL2 instance; return instance; - } else { + } else +#endif + { static OpenAL instance; return instance; } diff --git a/src/widget/form/settings/avform.cpp b/src/widget/form/settings/avform.cpp index dbd8dd63f..cea87eea6 100644 --- a/src/widget/form/settings/avform.cpp +++ b/src/widget/form/settings/avform.cpp @@ -60,6 +60,9 @@ AVForm::AVForm() cbEnableTestSound->setToolTip(tr("Play a test sound while changing the output volume.")); +#ifndef USE_FILTERAUDIO + cbEnableBackend2->setVisible(false); +#endif cbEnableBackend2->setChecked(s.getEnableBackend2()); connect(rescanButton, &QPushButton::clicked, this, &AVForm::rescanDevices);