From 792103f8b0c76ecec576f7e57efb3edb712561a1 Mon Sep 17 00:00:00 2001
From: Nils Fenner <nilsfenner@web.de>
Date: Sat, 4 Jun 2016 22:12:27 +0200
Subject: [PATCH] refactor(filter_audio): completely remove filter_audio
 dependency

The filter_audio API is not working for qTox/Tox and thus disabled by default via compiler switch. In current qTox UI, it is not configurable, even when this switch is enabled. According to issue #3194 the library is no longer maintained as well. I don't see any reason to keep it in qTox.
---
 .travis/build-ubuntu_14_04.sh       |  8 +---
 INSTALL.md                          | 33 --------------
 bootstrap.sh                        | 34 +-------------
 osx/qTox-Mac-Deployer-ULTIMATE.sh   | 18 --------
 qtox.pro                            | 27 +----------
 src/audio/audio.cpp                 | 37 ----------------
 src/audio/audio.h                   | 10 +----
 src/audio/audiofilterer.cpp         | 69 -----------------------------
 src/audio/audiofilterer.h           | 55 -----------------------
 src/core/coreav.cpp                 | 28 ------------
 src/core/coreav.h                   |  4 --
 src/core/toxcall.cpp                |  4 --
 src/persistence/settings.cpp        | 15 -------
 src/persistence/settings.h          |  4 --
 src/widget/form/settings/avform.cpp |  5 ---
 src/widget/form/settings/avform.h   |  1 -
 windows/bootstrap.sh                | 21 ---------
 17 files changed, 5 insertions(+), 368 deletions(-)
 delete mode 100644 src/audio/audiofilterer.cpp
 delete mode 100644 src/audio/audiofilterer.h

diff --git a/.travis/build-ubuntu_14_04.sh b/.travis/build-ubuntu_14_04.sh
index 2ebe1abbb..a348a37fe 100755
--- a/.travis/build-ubuntu_14_04.sh
+++ b/.travis/build-ubuntu_14_04.sh
@@ -60,12 +60,6 @@ cd ffmpeg*
 make -j$(nproc)
 make install
 cd ../../
-# filter_audio
-git clone https://github.com/irungentoo/filter_audio
-cd filter_audio
-make -j$(nproc)
-sudo make install
-cd ..
 # libsodium
 git clone git://github.com/jedisct1/libsodium.git
 cd libsodium
@@ -96,6 +90,6 @@ make -j10
 # clean it up, and build normal version
 make clean
 echo '*** BUILDING "FULL" VERSION ***'
-qmake qtox.pro QMAKE_CC="$CC" QMAKE_CXX="$CXX" DISABLE_FILTER_AUDIO=NO
+qmake qtox.pro QMAKE_CC="$CC" QMAKE_CXX="$CXX"
 # ↓ with $(nproc) fails, since travis gives 32 threads, and it leads to OOM
 make -j10
diff --git a/INSTALL.md b/INSTALL.md
index db689afa8..1064515ea 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -29,7 +29,6 @@
     - [openSUSE](#opensuse-toxcore)
     - [Slackware](#slackware-toxcore)
     - [Ubuntu >=15.04](#ubuntu-toxcore)
-  - [filter_audio](#filter_audio)
   - [sqlcipher](#sqlcipher)
   - [Compile toxcore](#compile-toxcore)
   - [Compile qTox](#compile-qtox)
@@ -46,7 +45,6 @@
 | toxcore       | most recent | core, av                                          |
 | FFmpeg        | >= 2.6.0    | avformat, avdevice, avcodec, avutil, swscale      |
 | OpenAL Soft   | >= 1.16.0   |                                                   |
-| filter_audio  | most recent |                                                   |
 | qrencode      | >= 3.0.3    |                                                   |
 | sqlcipher     | >= 3.2.0    |                                                   |
 | libXScrnSaver | >= 1.2      |                                                   |
@@ -298,28 +296,6 @@ libopus-dev libvpx-dev libsodium-dev
 ```
 
 
-### filter_audio
-This step is  best done before compiling toxcore.
-
-Now you can either follow the instructions at
-https://github.com/irungentoo/toxcore/blob/master/INSTALL.md#unix or use the
-[`bootstrap.sh`](/bootstrap.sh) script. The script will automatically download
-and install `toxcore` and `libfilteraudio`:
-```bash
-## in qTox directory
-./bootstrap.sh # use -h or --help for more information
-
-```
-If you've used script, you can skip directly to [compiling qTox](#compile-qtox).
-
-If you want to compile and install it manually:
-```bash
-git clone https://github.com/irungentoo/filter_audio
-cd filter_audio
-make -j$(nproc)
-sudo make install
-```
-
 ### sqlcipher
 
 If you are not using Fedora, skip this section, and go directly to compiling
@@ -459,15 +435,6 @@ brew install git ffmpeg qrencode libtool automake autoconf check qt5 libvpx \
 opus sqlcipher libsodium
 ```
 
-Next, install [filter_audio](https://github.com/irungentoo/filter_audio) (you
-may delete the directory it creates afterwards):
-```bash
-git clone https://github.com/irungentoo/filter_audio.git
-cd filter_audio
-sudo make install
-cd ../
-```
-
 Next, install
 [toxcore](https://github.com/irungentoo/toxcore/blob/master/INSTALL.md#osx)
 
diff --git a/bootstrap.sh b/bootstrap.sh
index ac67c01c5..25efcd78f 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -39,12 +39,10 @@ BASE_DIR=${SCRIPT_DIR}/${INSTALL_DIR}
 
 # directory names of cloned repositories
 TOX_CORE_DIR=libtoxcore-latest
-FILTER_AUDIO_DIR=libfilteraudio-latest
 SQLCIPHER_DIR=sqlcipher-stable
 
 # default values for user given parameters
 INSTALL_TOX=true
-INSTALL_FILTER_AUDIO=true
 INSTALL_SQLCIPHER=false
 SYSTEM_WIDE=true
 KEEP_BUILD_FILES=false
@@ -63,12 +61,6 @@ while [ $# -ge 1 ] ; do
     elif [ ${1} = "--without-tox" ] ; then
         INSTALL_TOX=false
         shift
-    elif [ ${1} = "--with-filter-audio" ] ; then
-        INSTALL_FILTER_AUDIO=true
-        shift
-    elif [ ${1} = "--without-filter-audio" ] ; then
-        INSTALL_FILTER_AUDIO=false
-        shift
     elif [ ${1} = "--with-sqlcipher" ] ; then
         INSTALL_SQLCIPHER=true
         shift
@@ -88,7 +80,7 @@ while [ $# -ge 1 ] ; do
         fi
 
         # print help
-        echo "Use this script to install/update libtoxcore and libfilteraudio"
+        echo "Use this script to install/update libtoxcore"
         echo ""
         echo "usage:"
         echo "    ${0} PARAMETERS"
@@ -96,8 +88,6 @@ while [ $# -ge 1 ] ; do
         echo "parameters:"
         echo "    --with-tox             : install/update libtoxcore"
         echo "    --without-tox          : do not install/update libtoxcore"
-        echo "    --with-filter-audio    : install/update libfilteraudio"
-        echo "    --without-filter-audio : do not install/update libfilteraudio"
         echo "    --with-sqlcipher       : install/update sqlcipher"
         echo "    --without-sqlcipher    : do not install/update sqlcipher"
         echo "    -h|--help              : displays this help"
@@ -105,7 +95,7 @@ while [ $# -ge 1 ] ; do
         echo "    -k|--keep              : keep build files after installation/update"
         echo ""
         echo "example usages:"
-        echo "    ${0}    -- install libtoxcore and libfilteraudio"
+        echo "    ${0}    -- install libtoxcore"
         exit 1
     fi
 done
@@ -113,7 +103,6 @@ done
 
 ############ print debug output ############
 echo "with tox                    : ${INSTALL_TOX}"
-echo "with filter-audio           : ${INSTALL_FILTER_AUDIO}"
 echo "with sqlcipher              : ${INSTALL_SQLCIPHER}"
 echo "install system-wide         : ${SYSTEM_WIDE}"
 echo "keep build files            : ${KEEP_BUILD_FILES}"
@@ -127,7 +116,6 @@ mkdir -p ${BASE_DIR}
 # remove not needed dirs
 remove_build_dirs() {
     rm -rf ${BASE_DIR}/${TOX_CORE_DIR}
-    rm -rf ${BASE_DIR}/${FILTER_AUDIO_DIR}
     rm -rf ${BASE_DIR}/${SQLCIPHER_DIR}
 }
 
@@ -176,24 +164,6 @@ if [[ $INSTALL_TOX = "true" ]]; then
     popd
 fi
 
-#install libfilteraudio
-if [[ $INSTALL_FILTER_AUDIO = "true" ]]; then
-    git clone https://github.com/irungentoo/filter_audio.git \
-        ${BASE_DIR}/${FILTER_AUDIO_DIR} --depth 1
-    pushd ${BASE_DIR}/${FILTER_AUDIO_DIR}
-
-    if [[ $SYSTEM_WIDE = "false" ]]; then
-        PREFIX=${BASE_DIR} make -j$(nproc)
-        PREFIX=${BASE_DIR} make install
-    else
-        make -j$(nproc)
-        sudo make install
-        sudo ldconfig
-    fi
-
-    popd
-fi
-
 
 #install sqlcipher
 if [[ $INSTALL_SQLCIPHER = "true" ]]; then
diff --git a/osx/qTox-Mac-Deployer-ULTIMATE.sh b/osx/qTox-Mac-Deployer-ULTIMATE.sh
index c50908436..7d9769deb 100755
--- a/osx/qTox-Mac-Deployer-ULTIMATE.sh
+++ b/osx/qTox-Mac-Deployer-ULTIMATE.sh
@@ -39,7 +39,6 @@ MACDEPLOYQT="${QT_DIR_VER}/bin/macdeployqt" # Don't change
 
 TOXCORE_DIR="${MAIN_DIR}/toxcore" # Change to Git location
 
-FA_DIR="${MAIN_DIR}/filter_audio"
 LIB_INSTALL_PREFIX="${QTOX_DIR}/libs"
 
 if [[ ! -e "${LIB_INSTALL_PREFIX}" ]]; then
@@ -139,18 +138,6 @@ function install() {
 			git clone https://github.com/tux3/qTox.git
 		fi
 	fi
-	# filter_audio
-	if [[ -e $FA_DIR/.git/index ]]; then # Check if this exists
-		fcho "Filter_Audio git repo already in place !"
-		cd $FA_DIR
-		git pull
-	else
-		fcho "Cloning Filter_Audio git ... "
-		git clone https://github.com/irungentoo/filter_audio.git
-		cd $FA_DIR
-	fi
-	fcho "Installing filter_audio."
-	make install PREFIX="${LIB_INSTALL_PREFIX}"
 	
 	# toxcore build
 	if [[ $TRAVIS = true ]]; then #travis check
@@ -231,11 +218,6 @@ function bootstrap() {
 	fcho "------------------------------"
 	fcho "starting bootstrap process ..."
 	
-	# filter_audio
-	cd $FA_DIR
-	fcho "Installing filter_audio."
-	make install PREFIX="${LIB_INSTALL_PREFIX}"
-	
 	#Toxcore
 	build_toxcore
 	
diff --git a/qtox.pro b/qtox.pro
index 5d40dcfe3..91e23c897 100644
--- a/qtox.pro
+++ b/qtox.pro
@@ -68,21 +68,12 @@ contains(DISABLE_PLATFORM_EXT, YES) {
     DEFINES += QTOX_PLATFORM_EXT
 }
 
-contains(DISABLE_FILTER_AUDIO, NO) {
-     DEFINES += QTOX_FILTER_AUDIO
-}
-
 contains(JENKINS,YES) {
     INCLUDEPATH += ./libs/include/
 } else {
     INCLUDEPATH += libs/include
 }
 
-contains(DEFINES, QTOX_FILTER_AUDIO) {
-    HEADERS += src/audio/audiofilterer.h
-    SOURCES += src/audio/audiofilterer.cpp
-}
-
 contains(DEFINES, QTOX_PLATFORM_EXT) {
     HEADERS += src/platform/timer.h
     SOURCES += src/platform/timer_osx.cpp \
@@ -103,13 +94,6 @@ win32 {
     LIBS += -lqrencode -lsqlcipher -lcrypto
     LIBS += -lopengl32 -lole32 -loleaut32 -lvfw32 -lws2_32 -liphlpapi -lgdi32 -lshlwapi -luuid
     LIBS += -lstrmiids # For DirectShow
-    contains(DEFINES, QTOX_FILTER_AUDIO) {
-        contains(STATICPKG, YES) {
-            LIBS += -Wl,-Bstatic -lfilteraudio
-        } else {
-            LIBS += -lfilteraudio
-        }
-    }
 } else {
     macx {
         BUNDLEID = chat.tox.qtox
@@ -120,7 +104,6 @@ win32 {
         LIBS += -framework AVFoundation -framework Foundation -framework CoreMedia -framework ApplicationServices
         LIBS += -lqrencode -lsqlcipher
         contains(DEFINES, QTOX_PLATFORM_EXT) { LIBS += -framework IOKit -framework CoreFoundation }
-        contains(DEFINES, QTOX_FILTER_AUDIO) { LIBS += -lfilteraudio }
         #Files to be includes into the qTox.app/Contents/Resources folder
         #OSX-Migrater.sh part of migrateProfiles() compatabilty code
         APP_RESOURCE.files = img/icons/qtox_profile.icns OSX-Migrater.sh
@@ -167,16 +150,8 @@ win32 {
             LIBS += -lX11 -lXss
         }
 
-        contains(DEFINES, QTOX_FILTER_AUDIO) {
-            contains(STATICPKG, YES) {
-                LIBS += -Wl,-Bstatic -lfilteraudio
-            } else {
-                LIBS += -lfilteraudio
-            }
-        }
-
         contains(JENKINS, YES) {
-            LIBS = ./libs/lib/libtoxav.a ./libs/lib/libvpx.a ./libs/lib/libopus.a ./libs/lib/libtoxdns.a ./libs/lib/libtoxencryptsave.a ./libs/lib/libtoxcore.a ./libs/lib/libopenal.a ./libs/lib/libsodium.a ./libs/lib/libfilteraudio.a ./libs/lib/libavdevice.a ./libs/lib/libavformat.a ./libs/lib/libavcodec.a ./libs/lib/libavutil.a ./libs/lib/libswscale.a ./libs/lib/libqrencode.a -ldl -lX11 -lXss
+            LIBS = ./libs/lib/libtoxav.a ./libs/lib/libvpx.a ./libs/lib/libopus.a ./libs/lib/libtoxdns.a ./libs/lib/libtoxencryptsave.a ./libs/lib/libtoxcore.a ./libs/lib/libopenal.a ./libs/lib/libsodium.a ./libs/lib/libavdevice.a ./libs/lib/libavformat.a ./libs/lib/libavcodec.a ./libs/lib/libavutil.a ./libs/lib/libswscale.a ./libs/lib/libqrencode.a -ldl -lX11 -lXss
             contains(ENABLE_SYSTRAY_UNITY_BACKEND, YES) {
                 LIBS += -lgobject-2.0 -lappindicator -lgtk-x11-2.0
             }
diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp
index 8016f3aa0..1030b6cfa 100644
--- a/src/audio/audio.cpp
+++ b/src/audio/audio.cpp
@@ -32,10 +32,6 @@
 
 #include <cassert>
 
-#ifdef QTOX_FILTER_AUDIO
-#include "audiofilterer.h"
-#endif
-
 /**
 @internal
 
@@ -108,10 +104,6 @@ Audio::Audio()
 
     moveToThread(audioThread);
 
-#ifdef QTOX_FILTER_AUDIO
-    filterer.startFilter(AUDIO_SAMPLE_RATE);
-#endif
-
     connect(&captureTimer, &QTimer::timeout, this, &Audio::doCapture);
     captureTimer.setInterval(AUDIO_FRAME_DURATION/2);
     captureTimer.setSingleShot(false);
@@ -128,9 +120,6 @@ Audio::~Audio()
     audioThread->wait();
     cleanupInput();
     cleanupOutput();
-#ifdef QTOX_FILTER_AUDIO
-    filterer.closeFilter();
-#endif
     delete d;
 }
 
@@ -580,17 +569,6 @@ void Audio::doCapture()
     int16_t buf[AUDIO_FRAME_SAMPLE_COUNT * AUDIO_CHANNELS];
     alcCaptureSamples(alInDev, buf, AUDIO_FRAME_SAMPLE_COUNT);
 
-#ifdef QTOX_FILTER_AUDIO
-    if (Settings::getInstance().getFilterAudio())
-    {
-#ifdef ALC_LOOPBACK_CAPTURE_SAMPLES
-        // compatibility with older versions of OpenAL
-        getEchoesToFilter(filterer, AUDIO_FRAME_SAMPLE_COUNT * AUDIO_CHANNELS);
-#endif
-        filterer.filterAudio(buf, AUDIO_FRAME_SAMPLE_COUNT * AUDIO_CHANNELS);
-    }
-#endif
-
     for (quint32 i = 0; i < AUDIO_FRAME_SAMPLE_COUNT * AUDIO_CHANNELS; ++i)
     {
         // gain amplification with clipping to 16-bit boundaries
@@ -698,18 +676,3 @@ void Audio::stopLoop()
     alSourcei(alMainSource, AL_LOOPING, AL_FALSE);
     alSourceStop(alMainSource);
 }
-
-#if defined(QTOX_FILTER_AUDIO) && defined(ALC_LOOPBACK_CAPTURE_SAMPLES)
-void Audio::getEchoesToFilter(AudioFilterer* filterer, int samples)
-{
-    ALint samples;
-    alcGetIntegerv(&alOutDev, ALC_LOOPBACK_CAPTURE_SAMPLES, sizeof(samples), &samples);
-    if (samples >= samples)
-    {
-        int16_t buf[samples];
-        alcCaptureSamplesLoopback(&alOutDev, buf, samples);
-        filterer->passAudioOutput(buf, samples);
-        filterer->setEchoDelayMs(5); // This 5ms is configurable I believe
-    }
-}
-#endif
diff --git a/src/audio/audio.h b/src/audio/audio.h
index 133d8c183..d30fe8152 100644
--- a/src/audio/audio.h
+++ b/src/audio/audio.h
@@ -42,9 +42,6 @@
 #include <AL/alext.h>
 #endif
 
-#ifdef QTOX_FILTER_AUDIO
-#include "audiofilterer.h"
-#endif
 
 // Public default audio settings
 static constexpr uint32_t AUDIO_SAMPLE_RATE = 48000; ///< The next best Opus would take is 24k
@@ -115,9 +112,7 @@ private:
     void playMono16SoundCleanup();
     /// Called on the captureTimer events to capture audio
     void doCapture();
-#if defined(QTOX_FILTER_AUDIO) && defined(ALC_LOOPBACK_CAPTURE_SAMPLES)
-    void getEchoesToFilter(AudioFilterer* filter, int samples);
-#endif
+
 
 private:
     Private* d;
@@ -137,9 +132,6 @@ private:
     bool                outputInitialized;
 
     QList<ALuint>       outSources;
-#ifdef QTOX_FILTER_AUDIO
-    AudioFilterer filterer;
-#endif
 };
 
 #endif // AUDIO_H
diff --git a/src/audio/audiofilterer.cpp b/src/audio/audiofilterer.cpp
deleted file mode 100644
index 456872259..000000000
--- a/src/audio/audiofilterer.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-    Copyright © 2014-2015 by The qTox Project
-
-    This file is part of qTox, a Qt-based graphical interface for Tox.
-
-    qTox is libre software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    qTox is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with qTox.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-
-#ifdef QTOX_FILTER_AUDIO
-
-#include "audiofilterer.h"
-extern "C"{
-#include <filter_audio.h>
-}
-
-void AudioFilterer::startFilter(uint32_t fs)
-{
-    closeFilter();
-    filter = new_filter_audio(fs);
-}
-
-void AudioFilterer::closeFilter()
-{
-    if (filter)
-        kill_filter_audio(filter);
-    filter = nullptr;
-}
-
-bool AudioFilterer::filterAudio(int16_t* data, unsigned int samples)
-{
-    return filter && 0 == filter_audio(filter, data, samples);
-}
-
-/* Enable/disable filters. 1 to enable, 0 to disable. */
-bool AudioFilterer::enableDisableFilters(int echo, int noise, int gain, int vad)
-{
-    return filter && 0 == enable_disable_filters(filter, echo, noise, gain, vad);
-}
-
-/* Give the audio output from your software to this function so it knows what echo to cancel from the frame */
-bool AudioFilterer::passAudioOutput(const int16_t *data, int samples)
-{
-    return filter && 0 == pass_audio_output(filter, data, samples);
-}
-
-/* Tell the echo canceller how much time in ms it takes for audio to be played and recorded back after. */
-bool AudioFilterer::setEchoDelayMs(int16_t msInSndCardBuf)
-{
-    return filter && 0 == set_echo_delay_ms(filter, msInSndCardBuf);
-}
-
-AudioFilterer::~AudioFilterer()
-{
-    closeFilter();
-}
-
-#endif // QTOX_FILTER_AUDIO
diff --git a/src/audio/audiofilterer.h b/src/audio/audiofilterer.h
deleted file mode 100644
index 5a94384e7..000000000
--- a/src/audio/audiofilterer.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-    Copyright © 2014-2015 by The qTox Project
-
-    This file is part of qTox, a Qt-based graphical interface for Tox.
-
-    qTox is libre software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    qTox is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with qTox.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifdef QTOX_FILTER_AUDIO
-#ifndef AUDIOFILTERER_H
-#define AUDIOFILTERER_H
-#include <cstdint>
-
-#ifndef _FILTER_AUDIO
-typedef struct Filter_Audio Filter_Audio;
-#endif
-
-class AudioFilterer
-{
-public:
-    explicit AudioFilterer() = default;
-    explicit AudioFilterer(const AudioFilterer&) = delete;
-    ~AudioFilterer();
-    AudioFilterer operator=(const AudioFilterer) = delete;
-    void startFilter(uint32_t fs);
-    void closeFilter();
-
-    /* Enable/disable filters. 1 to enable, 0 to disable. */
-    bool enableDisableFilters(int echo, int noise, int gain, int vad);
-
-    bool filterAudio(int16_t* data, unsigned int samples);
-
-    /* Give the audio output from your software to this function so it knows what echo to cancel from the frame */
-    bool passAudioOutput(const int16_t *data, int samples);
-
-    /* Tell the echo canceller how much time in ms it takes for audio to be played and recorded back after. */
-    bool setEchoDelayMs(int16_t msInSndCardBuf);
-
-private:
-    struct Filter_Audio* filter{nullptr};
-};
-
-#endif // AUDIOFILTERER_H
-#endif // QTOX_FILTER_AUDIO
diff --git a/src/core/coreav.cpp b/src/core/coreav.cpp
index 47a28a7cd..691c58796 100644
--- a/src/core/coreav.cpp
+++ b/src/core/coreav.cpp
@@ -31,10 +31,6 @@
 #include <QCoreApplication>
 #include <QtConcurrent/QtConcurrentRun>
 
-#ifdef QTOX_FILTER_AUDIO
-#include "src/audio/audiofilterer.h"
-#endif
-
 IndexedList<ToxFriendCall> CoreAV::calls;
 IndexedList<ToxGroupCall> CoreAV::groupCalls;
 
@@ -251,30 +247,6 @@ bool CoreAV::sendCallAudio(uint32_t callId, const int16_t *pcm, size_t samples,
         return true;
     }
 
-#if 0
-#ifdef QTOX_FILTER_AUDIO
-    if (Settings::getInstance().getFilterAudio())
-    {
-        if (!call.filterer)
-        {
-            call.filterer = new AudioFilterer();
-            call.filterer->startFilter(AUDIO_SAMPLE_RATE);
-        }
-
-#ifdef ALC_LOOPBACK_CAPTURE_SAMPLES
-        // compatibility with older versions of OpenAL
-        Audio::getInstance().getEchoesToFilter(call.filterer, AUDIO_FRAME_SAMPLE_COUNT * AUDIO_CHANNELS);
-#endif
-        call.filterer->filterAudio(buf, AUDIO_FRAME_SAMPLE_COUNT * AUDIO_CHANNELS);
-    }
-    else if (call.filterer)
-    {
-        delete call.filterer;
-        call.filterer = nullptr;
-    }
-#endif
-#endif
-
     // TOXAV_ERR_SEND_FRAME_SYNC means toxav failed to lock, retry 5 times in this case
     TOXAV_ERR_SEND_FRAME err;
     int retries = 0;
diff --git a/src/core/coreav.h b/src/core/coreav.h
index 79f3f2802..5d62e0f07 100644
--- a/src/core/coreav.h
+++ b/src/core/coreav.h
@@ -27,10 +27,6 @@
 #include "src/core/toxcall.h"
 #include <tox/toxav.h>
 
-#ifdef QTOX_FILTER_AUDIO
-class AudioFilterer;
-#endif
-
 class QTimer;
 class QThread;
 class CoreVideoSource;
diff --git a/src/core/toxcall.cpp b/src/core/toxcall.cpp
index 237eab033..390957f2b 100644
--- a/src/core/toxcall.cpp
+++ b/src/core/toxcall.cpp
@@ -7,10 +7,6 @@
 #include <QTimer>
 #include <QtConcurrent/QtConcurrent>
 
-#ifdef QTOX_FILTER_AUDIO
-#include "src/audio/audiofilterer.h"
-#endif
-
 using namespace std;
 
 ToxCall::ToxCall(uint32_t CallId)
diff --git a/src/persistence/settings.cpp b/src/persistence/settings.cpp
index fe3a040c7..65af74a40 100644
--- a/src/persistence/settings.cpp
+++ b/src/persistence/settings.cpp
@@ -238,7 +238,6 @@ void Settings::loadGlobal()
         outDev = s.value("outDev", "").toString();
         audioInGainDecibel = s.value("inGain", 0).toReal();
         outVolume = s.value("outVolume", 100).toInt();
-        filterAudio = s.value("filterAudio", false).toBool();
     s.endGroup();
 
     s.beginGroup("Video");
@@ -469,7 +468,6 @@ void Settings::saveGlobal()
         s.setValue("outDev", outDev);
         s.setValue("inGain", audioInGainDecibel);
         s.setValue("outVolume", outVolume);
-        s.setValue("filterAudio", filterAudio);
     s.endGroup();
 
     s.beginGroup("Video");
@@ -1414,19 +1412,6 @@ void Settings::setOutVolume(int volume)
     outVolume = volume;
 }
 
-bool Settings::getFilterAudio() const
-{
-    QMutexLocker locker{&bigLock};
-    // temporary disable filteraudio, as it doesn't work as expected
-    return false;
-}
-
-void Settings::setFilterAudio(bool newValue)
-{
-    QMutexLocker locker{&bigLock};
-    filterAudio = newValue;
-}
-
 QSize Settings::getCamVideoRes() const
 {
     QMutexLocker locker{&bigLock};
diff --git a/src/persistence/settings.h b/src/persistence/settings.h
index 7d220bfad..15af3ae08 100644
--- a/src/persistence/settings.h
+++ b/src/persistence/settings.h
@@ -187,9 +187,6 @@ public:
     int getOutVolume() const;
     void setOutVolume(int volume);
 
-    bool getFilterAudio() const;
-    void setFilterAudio(bool newValue);
-
     QString getVideoDev() const;
     void setVideoDev(const QString& deviceSpecifier);
 
@@ -434,7 +431,6 @@ private:
     QString outDev;
     qreal audioInGainDecibel;
     int outVolume;
-    bool filterAudio;
 
     // Video
     QString videoDev;
diff --git a/src/widget/form/settings/avform.cpp b/src/widget/form/settings/avform.cpp
index 514e7f832..c0b0c43b6 100644
--- a/src/widget/form/settings/avform.cpp
+++ b/src/widget/form/settings/avform.cpp
@@ -407,11 +407,6 @@ void AVForm::onOutDevChanged(QString deviceDescriptor)
     bodyUI->playbackSlider->setSliderPosition(qRound(audio.outputVolume() * 100.0));
 }
 
-void AVForm::onFilterAudioToggled(bool filterAudio)
-{
-    Settings::getInstance().setFilterAudio(filterAudio);
-}
-
 void AVForm::onPlaybackValueChanged(int value)
 {
     Settings::getInstance().setOutVolume(value);
diff --git a/src/widget/form/settings/avform.h b/src/widget/form/settings/avform.h
index f02af4fce..e58d95812 100644
--- a/src/widget/form/settings/avform.h
+++ b/src/widget/form/settings/avform.h
@@ -56,7 +56,6 @@ private slots:
     // audio
     void onInDevChanged(QString deviceDescriptor);
     void onOutDevChanged(QString deviceDescriptor);
-    void onFilterAudioToggled(bool filterAudio);
     void onPlaybackValueChanged(int value);
     void onMicrophoneValueChanged(int value);
 
diff --git a/windows/bootstrap.sh b/windows/bootstrap.sh
index 0343bc7cc..901cf0cfe 100644
--- a/windows/bootstrap.sh
+++ b/windows/bootstrap.sh
@@ -29,27 +29,6 @@ if [ ! -d "include/tox" ]; then
 fi
 
 
-## filter_audio
-if [ ! -d $QTOX_DIR/libs/filter_audio ]; then
-    git clone https://github.com/irungentoo/filter_audio.git $QTOX_DIR/libs/filter_audio
-    rm bin/libfilteraudio.dll
-else
-    pushd $QTOX_DIR/libs/filter_audio
-    git pull
-    popd
-fi
-
-if [ ! -f "bin/libfilteraudio.dll" ]; then
-    pushd $QTOX_DIR/libs/filter_audio
-    PREFIX="$QTOX_DIR/libs" CC="gcc.exe" make install
-    mv libfilteraudio.dll.a $QTOX_DIR/libs/lib
-    popd
-    if [ -f "lib/libfilteraudio.dll" ]; then
-        mv lib/libfilteraudio.dll bin/
-    fi
-fi
-
-
 ## qrencode
 if [ ! -f "qrencode-3.4.4.tar.gz" ]; then
     wget http://fukuchi.org/works/qrencode/qrencode-3.4.4.tar.gz