Browse Source

Denoiser: disable for Mac and fix audio mute

chirpmodem-v8.0.0
f4exb 11 months ago
parent
commit
499b7bb0fe
  1. 11
      external/CMakeLists.txt
  2. 12
      plugins/feature/denoiser/denoiserworker.cpp
  3. 2
      plugins/feature/denoiser/denoiserworker.h
  4. 2
      plugins/feature/denoiser/readme.md

11
external/CMakeLists.txt vendored

@ -916,15 +916,13 @@ if(ENABLE_FEATURE_MORSEDECODER) @@ -916,15 +916,13 @@ if(ENABLE_FEATURE_MORSEDECODER)
endif()
# For denoiser feature
if(ENABLE_FEATURE_DENOISER)
if(NOT APPLE AND ENABLE_FEATURE_DENOISER)
if (WIN32)
set(RNNOISE_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/rnnoise.lib" CACHE INTERNAL "")
set(RNNOISE_ARGS "-DRNN_ENABLE_X86_RTCD=ON")
set(RNNOISE_ARGS "-DRNN_ENABLE_X86_RTCD=OFF")
elseif (LINUX)
set(RNNOISE_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/lib${LIB_SUFFIX}/librnnoise${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
set(RNNOISE_ARGS "-DRNN_ENABLE_X86_RTCD=ON")
elseif (APPLE)
set(RNNOISE_ARGS "")
endif()
ExternalProject_Add(rnnoise
GIT_REPOSITORY https://github.com/f4exb/rnnoise.git
@ -944,11 +942,6 @@ if(ENABLE_FEATURE_DENOISER) @@ -944,11 +942,6 @@ if(ENABLE_FEATURE_DENOISER)
set(RNNOISE_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/rnnoise/src/rnnoise/include" CACHE INTERNAL "")
if (WIN32)
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/rnnoise${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif (APPLE)
set(RNNOISE_LIBRARIES "${binary_dir}/src/librnnoise${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
install(DIRECTORY "${binary_dir}/src" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "librnnoise*${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}/src")
endif ()
endif()

12
plugins/feature/denoiser/denoiserworker.cpp

@ -350,7 +350,7 @@ void DenoiserWorker::processSample( @@ -350,7 +350,7 @@ void DenoiserWorker::processSample(
m_magsq = re*re;
m_channelPowerAvg(m_magsq);
if (!m_settings.m_enableDenoiser || m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_None)
if ((!m_settings.m_enableDenoiser || m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_None) && !m_settings.m_audioMute)
{
// if ((s_dbgCount % 48000) == 1) {
// qDebug() << "DenoiserWorker::processSample[I16]: passthrough branch";
@ -371,7 +371,7 @@ void DenoiserWorker::processSample( @@ -371,7 +371,7 @@ void DenoiserWorker::processSample(
m_audioBufferFill = 0;
}
}
else if (m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_RNnoise)
else if ((m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_RNnoise) && !m_settings.m_audioMute)
{
// if ((s_dbgCount % 48000) == 1) {
// qDebug() << "DenoiserWorker::processSample[I16]: RNNoise branch";
@ -389,7 +389,7 @@ void DenoiserWorker::processSample( @@ -389,7 +389,7 @@ void DenoiserWorker::processSample(
for (int j = 0; j < 480; j++)
{
float outSample = m_rnnoiseOut[j];
m_sampleBuffer.push_back(Sample(outSample, 0));
m_sampleBuffer.push_back(Sample(outSample * 181, 0)); // 181 = sqrt(32768)
int16_t audioSample = static_cast<int16_t>(outSample);
m_audioBuffer[m_audioBufferFill].l = audioSample;
m_audioBuffer[m_audioBufferFill].r = audioSample;
@ -420,7 +420,7 @@ void DenoiserWorker::processSample( @@ -420,7 +420,7 @@ void DenoiserWorker::processSample(
m_magsq = re*re + im*im;
m_channelPowerAvg(m_magsq);
if (!m_settings.m_enableDenoiser || m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_None)
if ((!m_settings.m_enableDenoiser || m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_None) && !m_settings.m_audioMute)
{
// if ((s_dbgCount % 48000) == 1) {
// qDebug() << "DenoiserWorker::processSample[CI16]: passthrough branch";
@ -441,7 +441,7 @@ void DenoiserWorker::processSample( @@ -441,7 +441,7 @@ void DenoiserWorker::processSample(
m_audioBufferFill = 0;
}
}
else if (m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_RNnoise)
else if ((m_settings.m_denoiserType == DenoiserSettings::DenoiserType::DenoiserType_RNnoise) && !m_settings.m_audioMute)
{
// if ((s_dbgCount % 48000) == 1) {
// qDebug() << "DenoiserWorker::processSample[CI16]: RNNoise branch";
@ -459,7 +459,7 @@ void DenoiserWorker::processSample( @@ -459,7 +459,7 @@ void DenoiserWorker::processSample(
for (int j = 0; j < 480; j++)
{
float outSample = m_rnnoiseOut[j];
m_sampleBuffer.push_back(Sample(outSample, outSample));
m_sampleBuffer.push_back(Sample(outSample * 181, outSample * 181)); // 181 = sqrt(32768)
int16_t audioSample = static_cast<int16_t>(outSample);
m_audioBuffer[m_audioBufferFill].l = audioSample;
m_audioBuffer[m_audioBufferFill].r = audioSample;

2
plugins/feature/denoiser/denoiserworker.h

@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
#include "denoisersettings.h"
class WavFileRecord;
class DenoiseState;
struct DenoiseState;
class DenoiserWorker : public QObject {
Q_OBJECT

2
plugins/feature/denoiser/readme.md

@ -13,6 +13,8 @@ It connects to the "demod" stream of Rx channels similarly to the Demod analyzer @@ -13,6 +13,8 @@ It connects to the "demod" stream of Rx channels similarly to the Demod analyzer
- WFM demodulator
- WDSP plugin (multimode)
Note that this plugin is not available on Mac O/S
The following noise reduction schemes are covered. It can be selected via the (6) combo box:
<h3>RNNoise</h3>

Loading…
Cancel
Save