From db9d1d95f5daece620ea9af5ed1f35b2a2e7c214 Mon Sep 17 00:00:00 2001 From: guillermo Date: Sat, 12 Oct 2024 19:54:28 -0600 Subject: [PATCH] FEAT(client): Restore RNNoise for version 0.2 Reverted the merge which added ReNameNoise as an RNNoise replacement. Added the git submodule from xiph/rnnoise after removing ReNameNoise. Chose to go with rnnoise's `main` here. Resolves mumble-voip#6395 Reverts mumble-voip#6364 --- .gitmodules | 6 +- 3rdparty/renamenoise | 1 - 3rdparty/rnnoise-build/CMakeLists.txt | 75 +++++++++++ 3rdparty/rnnoise-build/config.h | 122 ++++++++++++++++++ 3rdparty/rnnoise-src | 1 + docs/dev/build-instructions/cmake_options.md | 16 +-- installer/ClientInstaller.cs | 15 ++- src/mumble/AudioConfigDialog.cpp | 26 ++-- src/mumble/AudioInput.cpp | 40 ++++-- src/mumble/AudioInput.h | 6 +- src/mumble/AudioInput.ui | 4 +- src/mumble/CMakeLists.txt | 36 +++--- src/mumble/JSONSerialization.cpp | 4 +- src/mumble/Settings.cpp | 4 +- .../generate_test_case.py | 2 +- 15 files changed, 291 insertions(+), 67 deletions(-) delete mode 160000 3rdparty/renamenoise create mode 100644 3rdparty/rnnoise-build/CMakeLists.txt create mode 100644 3rdparty/rnnoise-build/config.h create mode 160000 3rdparty/rnnoise-src diff --git a/.gitmodules b/.gitmodules index 363fafb49b8..14afe7530a5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,6 +7,9 @@ [submodule "3rdparty/speexdsp"] path = 3rdparty/speexdsp url = https://github.com/xiph/speexdsp.git +[submodule "3rdparty/rnnoise-src"] + path = 3rdparty/rnnoise-src + url = https://github.com/xiph/rnnoise.git [submodule "3rdparty/FindPythonInterpreter"] path = 3rdparty/FindPythonInterpreter url = https://github.com/Krzmbrzl/FindPythonInterpreter.git @@ -25,9 +28,6 @@ [submodule "3rdparty/cmake-compiler-flags"] path = 3rdparty/cmake-compiler-flags url = https://github.com/Krzmbrzl/cmake-compiler-flags.git -[submodule "3rdparty/renamenoise"] - path = 3rdparty/renamenoise - url = https://github.com/mumble-voip/ReNameNoise.git [submodule "3rdparty/flag-icons"] path = 3rdparty/flag-icons url = https://github.com/lipis/flag-icons.git diff --git a/3rdparty/renamenoise b/3rdparty/renamenoise deleted file mode 160000 index 2a551ab1261..00000000000 --- a/3rdparty/renamenoise +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2a551ab1261a1d5a5123c34eb6f4d108367d5cb4 diff --git a/3rdparty/rnnoise-build/CMakeLists.txt b/3rdparty/rnnoise-build/CMakeLists.txt new file mode 100644 index 00000000000..269096c9168 --- /dev/null +++ b/3rdparty/rnnoise-build/CMakeLists.txt @@ -0,0 +1,75 @@ +# Copyright 2005-2019 The Mumble Developers. All rights reserved. +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file at the root of the +# Mumble source tree or at . + +set(RNNOISE_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../rnnoise-src") + +if(NOT EXISTS "${RNNOISE_SRC_DIR}/COPYING") + message(FATAL_ERROR + "${RNNOISE_SRC_DIR} was not found.\n" + "Please checkout the submodule:\n" + "git submodule update --init --recursive" + ) +endif() + +if(WIN32) + add_library(rnnoise SHARED) + set_target_properties(rnnoise PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + if(MINGW) + # Remove "lib" prefix. + set_target_properties(rnnoise PROPERTIES PREFIX "") + endif() + target_compile_definitions(rnnoise + PRIVATE + "WIN32" + "DLL_EXPORT" + ) +else() + add_library(rnnoise STATIC) +endif() + +target_compile_definitions(rnnoise PRIVATE "HAVE_CONFIG_H") + +target_include_directories(rnnoise + PRIVATE SYSTEM + ${CMAKE_CURRENT_SOURCE_DIR} + PUBLIC SYSTEM + "${RNNOISE_SRC_DIR}/include" + "${RNNOISE_SRC_DIR}/src" +) + +if(MSVC) + # Use malloc() and free() instead of variable length arrays (unsupported) + target_compile_definitions(rnnoise PRIVATE "USE_MALLOC") + # Define M_PI + target_compile_definitions(rnnoise PRIVATE "_USE_MATH_DEFINES") +endif() + +add_custom_command( + OUTPUT + "${RNNOISE_SRC_DIR}/src/rnnoise_data.c" + "${RNNOISE_SRC_DIR}/src/rnnoise_data.h" + "${RNNOISE_SRC_DIR}/src/rnnoise_data_little.c" + "${RNNOISE_SRC_DIR}/src/rnnoise_data_little.h" + + WORKING_DIRECTORY "${RNNOISE_SRC_DIR}" + COMMAND "${RNNOISE_SRC_DIR}/download_model.sh" + COMMENT "Downloading RNNoise model files" +) + +target_sources(rnnoise PRIVATE + "${RNNOISE_SRC_DIR}/src/rnnoise_data.c" + "${RNNOISE_SRC_DIR}/src/rnnoise_tables.c" + "${RNNOISE_SRC_DIR}/src/dump_rnnoise_tables.c" + "${RNNOISE_SRC_DIR}/src/rnn.c" + "${RNNOISE_SRC_DIR}/src/pitch.c" + "${RNNOISE_SRC_DIR}/src/nnet.c" + "${RNNOISE_SRC_DIR}/src/nnet_default.c" + "${RNNOISE_SRC_DIR}/src/parse_lpcnet_weights.c" + "${RNNOISE_SRC_DIR}/src/kiss_fft.c" + "${RNNOISE_SRC_DIR}/src/denoise.c" + "${RNNOISE_SRC_DIR}/src/celt_lpc.c" +) + +target_disable_warnings(rnnoise) diff --git a/3rdparty/rnnoise-build/config.h b/3rdparty/rnnoise-build/config.h new file mode 100644 index 00000000000..f5063d664eb --- /dev/null +++ b/3rdparty/rnnoise-build/config.h @@ -0,0 +1,122 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Enable assertions in code */ +/* #undef OP_ENABLE_ASSERTIONS */ + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "jmvalin@jmvalin.ca" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "rnnoise" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "rnnoise unknown" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "rnnoise" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "unknown" + +/* This is a build of the library */ +#define RNNOISE_BUILD /**/ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define this if the compiler supports __attribute__(( + ifelse([visibility("default")], , [visibility_default], + [visibility("default")]) )) */ +#define SUPPORT_ATTRIBUTE_VISIBILITY_DEFAULT 1 + +/* Define this if the compiler supports the -fvisibility flag */ +#define SUPPORT_FLAG_VISIBILITY 1 + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* We need at least WindowsXP for getaddrinfo/freeaddrinfo */ +/* #undef _WIN32_WINNT */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif diff --git a/3rdparty/rnnoise-src b/3rdparty/rnnoise-src new file mode 160000 index 00000000000..d98345814b0 --- /dev/null +++ b/3rdparty/rnnoise-src @@ -0,0 +1 @@ +Subproject commit d98345814b0531e61bf10d463be21fa94b352f9c diff --git a/docs/dev/build-instructions/cmake_options.md b/docs/dev/build-instructions/cmake_options.md index f8fda72c05d..642e3d6d6a2 100644 --- a/docs/dev/build-instructions/cmake_options.md +++ b/docs/dev/build-instructions/cmake_options.md @@ -44,10 +44,10 @@ Use the bundled GSL version instead of looking for one on the system Build the included version of nlohmann_json instead of looking for one on the system (Default: ON) -### bundled-renamenoise +### bundled-rnnoise -Build the included version of ReNameNoise instead of looking for one on the system. -(Default: ${renamenoise}) +Build the included version of RNNoise instead of looking for one on the system. +(Default: ${rnnoise}) ### bundled-speex @@ -189,16 +189,16 @@ Build support for custom Diffie-Hellman parameters. Use Qt's text-to-speech system (part of the Qt Speech module) instead of Mumble's own OS-specific text-to-speech implementations. (Default: OFF) -### renamenoise - -Use ReNameNoise for machine learning noise reduction. -(Default: ON) - ### retracted-plugins Build redacted (outdated) plugins as well (Default: OFF) +### rnnoise + +Use RNNoise for machine learning noise reduction. +(Default: OFF) + ### server Build the server (Murmur) diff --git a/installer/ClientInstaller.cs b/installer/ClientInstaller.cs index e8c7fa59a66..5b244db72ac 100644 --- a/installer/ClientInstaller.cs +++ b/installer/ClientInstaller.cs @@ -18,6 +18,7 @@ public struct Features { public bool overlay; public bool g15; + public bool rnnoise; } public class ClientInstaller : MumbleInstall { @@ -86,11 +87,14 @@ public ClientInstaller(string version, string arch, Features features) { // 64 bit this.Platform = WixSharp.Platform.x64; binaries = new List() { - "renamenoise.dll", "speexdsp.dll", "mumble.exe", }; + if (features.rnnoise) { + binaries.Add("rnnoise.dll"); + } + if (features.overlay) { binaries.Add("mumble_ol.dll"); binaries.Add("mumble_ol_helper.exe"); @@ -105,11 +109,14 @@ public ClientInstaller(string version, string arch, Features features) { // 32 bit this.Platform = WixSharp.Platform.x86; binaries = new List() { - "renamenoise.dll", "speexdsp.dll", "mumble.exe", }; + if (features.rnnoise) { + binaries.Add("rnnoise.dll"); + } + if (features.overlay) { binaries.Add("mumble_ol.dll"); binaries.Add("mumble_ol_helper.exe"); @@ -214,6 +221,10 @@ public static void Main(string[] args) { if (args[i] == "--overlay") { features.overlay = true; } + + if (args[i] == "--rnnoise") { + features.rnnoise = true; + } } if (version != null && arch != null) { diff --git a/src/mumble/AudioConfigDialog.cpp b/src/mumble/AudioConfigDialog.cpp index 9ccd7b60eb0..669e3892884 100644 --- a/src/mumble/AudioConfigDialog.cpp +++ b/src/mumble/AudioConfigDialog.cpp @@ -76,9 +76,9 @@ AudioInputDialog::AudioInputDialog(Settings &st) : ConfigWidget(st) { // Hide the slider by default showSpeexNoiseSuppressionSlider(false); -#ifndef USE_RENAMENOISE - // Hide options related to ReNameNoise - qrbNoiseSupReNameNoise->setVisible(false); +#ifndef USE_RNNOISE + // Hide options related to RNNoise + qrbNoiseSupRNNoise->setVisible(false); qrbNoiseSupBoth->setVisible(false); #endif } @@ -143,12 +143,12 @@ void AudioInputDialog::load(const Settings &r) { loadSlider(qsSpeexNoiseSupStrength, 14); } - bool allowReNameNoise = SAMPLE_RATE == 48000; + bool allowRNNoise = SAMPLE_RATE == 48000; - if (!allowReNameNoise) { + if (!allowRNNoise) { const QString tooltip = QObject::tr("RNNoise is not available due to a sample rate mismatch."); - qrbNoiseSupReNameNoise->setEnabled(false); - qrbNoiseSupReNameNoise->setToolTip(tooltip); + qrbNoiseSupRNNoise->setEnabled(false); + qrbNoiseSupRNNoise->setToolTip(tooltip); qrbNoiseSupBoth->setEnabled(false); qrbNoiseSupBoth->setToolTip(tooltip); } @@ -161,9 +161,9 @@ void AudioInputDialog::load(const Settings &r) { loadCheckBox(qrbNoiseSupSpeex, true); break; case Settings::NoiseCancelRNN: -#ifdef USE_RENAMENOISE - if (allowReNameNoise) { - loadCheckBox(qrbNoiseSupReNameNoise, true); +#ifdef USE_RNNOISE + if (allowRNNoise) { + loadCheckBox(qrbNoiseSupRNNoise, true); } else { // We have to switch to speex as a fallback loadCheckBox(qrbNoiseSupSpeex, true); @@ -174,8 +174,8 @@ void AudioInputDialog::load(const Settings &r) { #endif break; case Settings::NoiseCancelBoth: -#ifdef USE_RENAMENOISE - if (allowReNameNoise) { +#ifdef USE_RNNOISE + if (allowRNNoise) { loadCheckBox(qrbNoiseSupBoth, true); } else { // We have to switch to speex as a fallback @@ -233,7 +233,7 @@ void AudioInputDialog::save() const { s.noiseCancelMode = Settings::NoiseCancelOff; } else if (qrbNoiseSupBoth->isChecked()) { s.noiseCancelMode = Settings::NoiseCancelBoth; - } else if (qrbNoiseSupReNameNoise->isChecked()) { + } else if (qrbNoiseSupRNNoise->isChecked()) { s.noiseCancelMode = Settings::NoiseCancelRNN; } else { s.noiseCancelMode = Settings::NoiseCancelSpeex; diff --git a/src/mumble/AudioInput.cpp b/src/mumble/AudioInput.cpp index ffd2c4254fd..33074bdc0b4 100644 --- a/src/mumble/AudioInput.cpp +++ b/src/mumble/AudioInput.cpp @@ -20,9 +20,9 @@ #include -#ifdef USE_RENAMENOISE +#ifdef USE_RNNOISE extern "C" { -# include "renamenoise.h" +# include "rnnoise.h" } #endif @@ -31,6 +31,14 @@ extern "C" { #include #include +#ifdef USE_RNNOISE +/// Clip the given float value to a range that can be safely converted into a short (without causing integer overflow) +static short clampFloatSample(float v) { + return static_cast< short >(std::min(std::max(v, static_cast< float >(std::numeric_limits< short >::min())), + static_cast< float >(std::numeric_limits< short >::max()))); +} +#endif + void Resynchronizer::addMic(short *mic) { bool drop = false; { @@ -237,8 +245,8 @@ AudioInput::AudioInput() opus_encoder_ctl(opusState, OPUS_SET_VBR(0)); // CBR -#ifdef USE_RENAMENOISE - denoiseState = renamenoise_create(nullptr); +#ifdef USE_RNNOISE + denoiseState = rnnoise_create(nullptr); #endif qWarning("AudioInput: %d bits/s, %d hz, %d sample", iAudioQuality, iSampleRate, iFrameSize); @@ -292,9 +300,9 @@ AudioInput::~AudioInput() { opus_encoder_destroy(opusState); } -#ifdef USE_RENAMENOISE +#ifdef USE_RNNOISE if (denoiseState) { - renamenoise_destroy(denoiseState); + rnnoise_destroy(denoiseState); } #endif @@ -810,13 +818,13 @@ void AudioInput::selectNoiseCancel() { noiseCancel = Global::get().s.noiseCancelMode; if (noiseCancel == Settings::NoiseCancelRNN || noiseCancel == Settings::NoiseCancelBoth) { -#ifdef USE_RENAMENOISE +#ifdef USE_RNNOISE if (!denoiseState || iFrameSize != 480) { - qWarning("AudioInput: Ignoring request to enable ReNameNoise: internal error"); + qWarning("AudioInput: Ignoring request to enable RNNoise: internal error"); noiseCancel = Settings::NoiseCancelSpeex; } #else - qWarning("AudioInput: Ignoring request to enable ReNameNoise: Mumble was built without support for it"); + qWarning("AudioInput: Ignoring request to enable RNNoise: Mumble was built without support for it"); noiseCancel = Settings::NoiseCancelSpeex; #endif } @@ -831,11 +839,11 @@ void AudioInput::selectNoiseCancel() { iArg = 1; break; case Settings::NoiseCancelRNN: - qWarning("AudioInput: Using ReNameNoise as noise canceller"); + qWarning("AudioInput: Using RNNoise as noise canceller"); break; case Settings::NoiseCancelBoth: iArg = 1; - qWarning("AudioInput: Using ReNameNoise and Speex as noise canceller"); + qWarning("AudioInput: Using RNNoise and Speex as noise canceller"); break; } speex_preprocess_ctl(sppPreprocess, SPEEX_PREPROCESS_SET_DENOISE, &iArg); @@ -912,15 +920,19 @@ void AudioInput::encodeAudioFrame(AudioChunk chunk) { psSource = chunk.mic; } -#ifdef USE_RENAMENOISE - // At the time of writing this code, ReNameNoise only supports a sample rate of 48000 Hz. +#ifdef USE_RNNOISE + // At the time of writing this code, RNNoise only supports a sample rate of 48000 Hz. if (noiseCancel == Settings::NoiseCancelRNN || noiseCancel == Settings::NoiseCancelBoth) { float denoiseFrames[480]; for (unsigned int i = 0; i < 480; i++) { denoiseFrames[i] = psSource[i]; } - renamenoise_process_frame_clamped(denoiseState, psSource, denoiseFrames); + rnnoise_process_frame(denoiseState, denoiseFrames, denoiseFrames); + + for (unsigned int i = 0; i < 480; i++) { + psSource[i] = clampFloatSample(denoiseFrames[i]); + } } #endif diff --git a/src/mumble/AudioInput.h b/src/mumble/AudioInput.h index 5d597680283..124b5effa1a 100644 --- a/src/mumble/AudioInput.h +++ b/src/mumble/AudioInput.h @@ -33,7 +33,7 @@ class AudioInput; struct OpusEncoder; -struct ReNameNoiseDenoiseState; +struct DenoiseState; typedef boost::shared_ptr< AudioInput > AudioInputPtr; /** @@ -189,8 +189,8 @@ class AudioInput : public QThread { void resetAudioProcessor(); OpusEncoder *opusState; -#ifdef USE_RENAMENOISE - ReNameNoiseDenoiseState *denoiseState; +#ifdef USE_RNNOISE + DenoiseState *denoiseState; #endif bool selectCodec(); void selectNoiseCancel(); diff --git a/src/mumble/AudioInput.ui b/src/mumble/AudioInput.ui index d7a9a7bda04..6833533066b 100644 --- a/src/mumble/AudioInput.ui +++ b/src/mumble/AudioInput.ui @@ -749,7 +749,7 @@ - + Use the noise suppression algorithm provided by RNNoise. @@ -1188,7 +1188,7 @@ qcbEcho qrbNoiseSupDeactivated qrbNoiseSupSpeex - qrbNoiseSupReNameNoise + qrbNoiseSupRNNoise qrbNoiseSupBoth qsSpeexNoiseSupStrength qcbEnableCuePTT diff --git a/src/mumble/CMakeLists.txt b/src/mumble/CMakeLists.txt index 4d6151245c4..fa83a250c81 100644 --- a/src/mumble/CMakeLists.txt +++ b/src/mumble/CMakeLists.txt @@ -21,8 +21,8 @@ option(translations "Include languages other than English." ON) option(bundle-qt-translations "Bundle Qt's translations as well" ${static}) option(bundled-speex "Build the included version of Speex instead of looking for one on the system." ON) -option(renamenoise "Use ReNameNoise for machine learning noise reduction." ON) -option(bundled-renamenoise "Build the included version of ReNameNoise instead of looking for one on the system." ${renamenoise}) +option(rnnoise "Use RNNoise for machine learning noise reduction." ON) +option(bundled-rnnoise "Build the included version of RNNoise instead of looking for one on the system." ${rnnoise}) option(bundled-json "Build the included version of nlohmann_json instead of looking for one on the system" ON) option(manual-plugin "Include the built-in \"manual\" positional audio plugin." ON) @@ -739,32 +739,30 @@ else() ) endif() -if(renamenoise) - target_compile_definitions(mumble_client_object_lib PRIVATE "USE_RENAMENOISE") +if(rnnoise) + target_compile_definitions(mumble_client_object_lib PRIVATE "USE_RNNOISE") - if(bundled-renamenoise) - set(RENAMENOISE_DEMO_EXECUTABLE OFF CACHE INTERNAL "") + if(bundled-rnnoise) + add_subdirectory("${3RDPARTY_DIR}/rnnoise-build" "${CMAKE_CURRENT_BINARY_DIR}/rnnoise" EXCLUDE_FROM_ALL) - add_subdirectory("${3RDPARTY_DIR}/renamenoise" "${CMAKE_CURRENT_BINARY_DIR}/renamenoise" EXCLUDE_FROM_ALL) + # Disable all warnings that the RNNoise code may emit + disable_warnings_for_all_targets_in("${3RDPARTY_DIR}/rnnoise-build") - # Disable all warnings that the ReNameNoise code may emit - disable_warnings_for_all_targets_in("${3RDPARTY_DIR}/renamenoise") - - target_link_libraries(mumble_client_object_lib PRIVATE renamenoise) + target_link_libraries(mumble_client_object_lib PRIVATE rnnoise) if(WIN32) # Shared library on Windows (e.g. ".dll") - set_target_properties(renamenoise PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + set_target_properties(rnnoise PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) else() # Shared library on UNIX (e.g. ".so") - set_target_properties(renamenoise PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + set_target_properties(rnnoise PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) endif() - install_library(renamenoise mumble_client) + install_library(rnnoise mumble_client) else() - find_pkg(renamenoise REQUIRED) + find_pkg(rnnoise REQUIRED) - target_link_libraries(mumble_client_object_lib PRIVATE ${renamenoise_LIBRARIES}) + target_link_libraries(mumble_client_object_lib PRIVATE ${rnnoise_LIBRARIES}) endif() endif() @@ -1181,6 +1179,12 @@ if(packaging AND WIN32) ) endif() + if(rnnoise) + list(APPEND installer_vars + "--rnnoise" + ) + endif() + file(COPY ${CMAKE_SOURCE_DIR}/installer/MumbleInstall.cs ${CMAKE_SOURCE_DIR}/installer/ClientInstaller.cs diff --git a/src/mumble/JSONSerialization.cpp b/src/mumble/JSONSerialization.cpp index d6050365161..953ac32a019 100644 --- a/src/mumble/JSONSerialization.cpp +++ b/src/mumble/JSONSerialization.cpp @@ -217,9 +217,9 @@ void from_json(const nlohmann::json &j, Settings &settings) { settings.mumbleQuitNormally = json.at(SettingsKeys::MUMBLE_QUIT_NORMALLY_KEY); } -#ifndef USE_RENAMENOISE +#ifndef USE_RNNOISE if (settings.noiseCancelMode == Settings::NoiseCancelRNN || settings.noiseCancelMode == Settings::NoiseCancelBoth) { - // Use Speex instead as this Mumble build was built without support for ReNameNoise + // Use Speex instead as this Mumble build was built without support for RNNoise settings.noiseCancelMode = Settings::NoiseCancelSpeex; } #endif diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp index e11bbbe8664..4315fa5c8d7 100644 --- a/src/mumble/Settings.cpp +++ b/src/mumble/Settings.cpp @@ -803,9 +803,9 @@ void Settings::legacyLoad(const QString &path) { LOADENUM(noiseCancelMode, "audio/noiseCancelMode"); -#ifndef USE_RENAMENOISE +#ifndef USE_RNNOISE if (noiseCancelMode == NoiseCancelRNN || noiseCancelMode == NoiseCancelBoth) { - // Use Speex instead as this Mumble build was built without support for ReNameNoise + // Use Speex instead as this Mumble build was built without support for RNNoise noiseCancelMode = NoiseCancelSpeex; } #endif diff --git a/src/tests/TestSettingsJSONSerialization/generate_test_case.py b/src/tests/TestSettingsJSONSerialization/generate_test_case.py index 7c77b7c0792..479909dff65 100755 --- a/src/tests/TestSettingsJSONSerialization/generate_test_case.py +++ b/src/tests/TestSettingsJSONSerialization/generate_test_case.py @@ -139,7 +139,7 @@ def getDefaultValueForType(dataType): elif dataType in ["IdleAction"]: return "Settings::Deafen" elif dataType in ["NoiseCancel"]: - return "Settings::NoiseCancelBoth" + return "Settings::NoiseCancelOff" elif dataType in ["EchoCancelOptionID"]: return "EchoCancelOptionID::SPEEX_MULTICHANNEL" elif dataType in ["QuitBehavior"]: