1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-01-19 12:05:41 -05:00

Denoiser: disable for Mac and fix audio mute

This commit is contained in:
f4exb 2026-01-11 00:43:39 +01:00
parent 28c3a4da9c
commit 499b7bb0fe
4 changed files with 11 additions and 16 deletions

View File

@ -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)
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()

View File

@ -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(
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(
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(
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(
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(
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;

View File

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

View File

@ -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>