Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
refactor(filter_audio): completely remove filter_audio dependency
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
antis81 committed Jun 4, 2016
1 parent a77afca commit 792103f
Show file tree
Hide file tree
Showing 17 changed files with 5 additions and 368 deletions.
8 changes: 1 addition & 7 deletions .travis/build-ubuntu_14_04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
33 changes: 0 additions & 33 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 | |
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
34 changes: 2 additions & 32 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -88,32 +80,29 @@ 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"
echo ""
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"
echo " -l|--local : install packages into ${INSTALL_DIR}"
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


############ 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}"
Expand All @@ -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}
}

Expand Down Expand Up @@ -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
Expand Down
18 changes: 0 additions & 18 deletions osx/qTox-Mac-Deployer-ULTIMATE.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
27 changes: 1 addition & 26 deletions qtox.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
37 changes: 0 additions & 37 deletions src/audio/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@

#include <cassert>

#ifdef QTOX_FILTER_AUDIO
#include "audiofilterer.h"
#endif

/**
@internal
Expand Down Expand Up @@ -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);
Expand All @@ -128,9 +120,6 @@ Audio::~Audio()
audioThread->wait();
cleanupInput();
cleanupOutput();
#ifdef QTOX_FILTER_AUDIO
filterer.closeFilter();
#endif
delete d;
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
10 changes: 1 addition & 9 deletions src/audio/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -115,9 +112,7 @@ class Audio : public QObject
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;
Expand All @@ -137,9 +132,6 @@ class Audio : public QObject
bool outputInitialized;

QList<ALuint> outSources;
#ifdef QTOX_FILTER_AUDIO
AudioFilterer filterer;
#endif
};

#endif // AUDIO_H

0 comments on commit 792103f

Please sign in to comment.