support mindeps build without rnnoise
This commit is contained in:
@@ -35,7 +35,7 @@ DerivePointerAlignment: 'false'
|
|||||||
FixNamespaceComments: 'true'
|
FixNamespaceComments: 'true'
|
||||||
IncludeBlocks: Merge
|
IncludeBlocks: Merge
|
||||||
IndentCaseLabels: 'true'
|
IndentCaseLabels: 'true'
|
||||||
IndentPPDirectives: BeforeHash
|
IndentPPDirectives: None
|
||||||
IndentWidth: '4'
|
IndentWidth: '4'
|
||||||
IndentWrappedFunctionNames: 'false'
|
IndentWrappedFunctionNames: 'false'
|
||||||
JavaScriptQuotes: Double
|
JavaScriptQuotes: Double
|
||||||
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -67,7 +67,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
cond: ${{ matrix.mindeps == true }}
|
cond: ${{ matrix.mindeps == true }}
|
||||||
if_true: |
|
if_true: |
|
||||||
cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} -DUSE_LIBHANDY=OFF -DENABLE_VOICE=OFF -DENABLE_NOTIFICATION_SOUNDS=OFF -DENABLE_QRCODE_LOGIN=OFF
|
cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} -DUSE_LIBHANDY=OFF -DENABLE_VOICE=OFF -DENABLE_NOTIFICATION_SOUNDS=OFF -DENABLE_QRCODE_LOGIN=OFF -DENABLE_RNNOISE=OFF
|
||||||
cmake --build build
|
cmake --build build
|
||||||
if_false: |
|
if_false: |
|
||||||
cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} -DCMAKE_CXX_FLAGS="-Wl,--default-image-base-low"
|
cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} -DCMAKE_CXX_FLAGS="-Wl,--default-image-base-low"
|
||||||
|
@@ -163,6 +163,8 @@ if (ENABLE_VOICE)
|
|||||||
target_link_libraries(abaddon ${CMAKE_DL_LIBS})
|
target_link_libraries(abaddon ${CMAKE_DL_LIBS})
|
||||||
|
|
||||||
if (ENABLE_RNNOISE)
|
if (ENABLE_RNNOISE)
|
||||||
|
target_compile_definitions(abaddon PRIVATE WITH_RNNOISE)
|
||||||
|
|
||||||
find_package(rnnoise QUIET)
|
find_package(rnnoise QUIET)
|
||||||
if (NOT rnnoise_FOUND)
|
if (NOT rnnoise_FOUND)
|
||||||
message("rnnoise was not found and will be included as a submodule")
|
message("rnnoise was not found and will be included as a submodule")
|
||||||
|
@@ -82,7 +82,12 @@ AudioManager::AudioManager() {
|
|||||||
spdlog::get("audio")->info("Audio backend: {}", ma_get_backend_name(m_context.backend));
|
spdlog::get("audio")->info("Audio backend: {}", ma_get_backend_name(m_context.backend));
|
||||||
|
|
||||||
Enumerate();
|
Enumerate();
|
||||||
|
|
||||||
|
#ifdef WITH_RNNOISE
|
||||||
SetVADMethod(VADMethod::RNNoise);
|
SetVADMethod(VADMethod::RNNoise);
|
||||||
|
#else
|
||||||
|
SetVADMethod(VADMethod::Gate);
|
||||||
|
#endif
|
||||||
|
|
||||||
m_playback_config = ma_device_config_init(ma_device_type_playback);
|
m_playback_config = ma_device_config_init(ma_device_type_playback);
|
||||||
m_playback_config.playback.format = ma_format_f32;
|
m_playback_config.playback.format = ma_format_f32;
|
||||||
@@ -144,7 +149,10 @@ AudioManager::~AudioManager() {
|
|||||||
ma_device_uninit(&m_capture_device);
|
ma_device_uninit(&m_capture_device);
|
||||||
ma_context_uninit(&m_context);
|
ma_context_uninit(&m_context);
|
||||||
RemoveAllSSRCs();
|
RemoveAllSSRCs();
|
||||||
|
|
||||||
|
#ifdef WITH_RNNOISE
|
||||||
RNNoiseUninitialize();
|
RNNoiseUninitialize();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioManager::AddSSRC(uint32_t ssrc) {
|
void AudioManager::AddSSRC(uint32_t ssrc) {
|
||||||
@@ -425,9 +433,11 @@ void AudioManager::OnCapturedPCM(const int16_t *pcm, ma_uint32 frames) {
|
|||||||
case VADMethod::Gate:
|
case VADMethod::Gate:
|
||||||
if (!CheckVADVoiceGate()) return;
|
if (!CheckVADVoiceGate()) return;
|
||||||
break;
|
break;
|
||||||
|
#ifdef WITH_RNNOISE
|
||||||
case VADMethod::RNNoise:
|
case VADMethod::RNNoise:
|
||||||
if (!CheckVADRNNoise(pcm)) return;
|
if (!CheckVADRNNoise(pcm)) return;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
m_enc_mutex.lock();
|
m_enc_mutex.lock();
|
||||||
@@ -475,6 +485,7 @@ bool AudioManager::CheckVADVoiceGate() {
|
|||||||
return m_capture_peak_meter / 32768.0 > m_capture_gate;
|
return m_capture_peak_meter / 32768.0 > m_capture_gate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_RNNOISE
|
||||||
bool AudioManager::CheckVADRNNoise(const int16_t *pcm) {
|
bool AudioManager::CheckVADRNNoise(const int16_t *pcm) {
|
||||||
static float denoised[480];
|
static float denoised[480];
|
||||||
static float rnnoise_input[480];
|
static float rnnoise_input[480];
|
||||||
@@ -503,6 +514,7 @@ void AudioManager::RNNoiseUninitialize() {
|
|||||||
m_rnnoise = nullptr;
|
m_rnnoise = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool AudioManager::OK() const {
|
bool AudioManager::OK() const {
|
||||||
return m_ok;
|
return m_ok;
|
||||||
@@ -531,11 +543,13 @@ uint32_t AudioManager::GetRTPTimestamp() const noexcept {
|
|||||||
void AudioManager::SetVADMethod(VADMethod method) {
|
void AudioManager::SetVADMethod(VADMethod method) {
|
||||||
m_vad_method = method;
|
m_vad_method = method;
|
||||||
|
|
||||||
|
#ifdef WITH_RNNOISE
|
||||||
if (method == VADMethod::RNNoise) {
|
if (method == VADMethod::RNNoise) {
|
||||||
RNNoiseInitialize();
|
RNNoiseInitialize();
|
||||||
} else {
|
} else {
|
||||||
RNNoiseUninitialize();
|
RNNoiseUninitialize();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioManager::type_signal_opus_packet AudioManager::signal_opus_packet() {
|
AudioManager::type_signal_opus_packet AudioManager::signal_opus_packet() {
|
||||||
|
@@ -14,7 +14,10 @@
|
|||||||
#include <miniaudio.h>
|
#include <miniaudio.h>
|
||||||
#include <opus.h>
|
#include <opus.h>
|
||||||
#include <sigc++/sigc++.h>
|
#include <sigc++/sigc++.h>
|
||||||
|
|
||||||
|
#ifdef WITH_RNNOISE
|
||||||
#include <rnnoise.h>
|
#include <rnnoise.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "devices.hpp"
|
#include "devices.hpp"
|
||||||
// clang-format on
|
// clang-format on
|
||||||
@@ -84,10 +87,13 @@ private:
|
|||||||
bool DecayVolumeMeters();
|
bool DecayVolumeMeters();
|
||||||
|
|
||||||
bool CheckVADVoiceGate();
|
bool CheckVADVoiceGate();
|
||||||
|
|
||||||
|
#ifdef WITH_RNNOISE
|
||||||
bool CheckVADRNNoise(const int16_t *pcm);
|
bool CheckVADRNNoise(const int16_t *pcm);
|
||||||
|
|
||||||
void RNNoiseInitialize();
|
void RNNoiseInitialize();
|
||||||
void RNNoiseUninitialize();
|
void RNNoiseUninitialize();
|
||||||
|
#endif
|
||||||
|
|
||||||
friend void data_callback(ma_device *, void *, const void *, ma_uint32);
|
friend void data_callback(ma_device *, void *, const void *, ma_uint32);
|
||||||
friend void capture_data_callback(ma_device *, void *, const void *, ma_uint32);
|
friend void capture_data_callback(ma_device *, void *, const void *, ma_uint32);
|
||||||
@@ -132,7 +138,9 @@ private:
|
|||||||
AudioDevices m_devices;
|
AudioDevices m_devices;
|
||||||
|
|
||||||
VADMethod m_vad_method;
|
VADMethod m_vad_method;
|
||||||
|
#ifdef WITH_RNNOISE
|
||||||
DenoiseState *m_rnnoise;
|
DenoiseState *m_rnnoise;
|
||||||
|
#endif
|
||||||
std::atomic<uint32_t> m_rtp_timestamp = 0;
|
std::atomic<uint32_t> m_rtp_timestamp = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@@ -138,8 +138,12 @@ VoiceWindow::VoiceWindow(Snowflake channel_id)
|
|||||||
m_vad_combo.set_hexpand(true);
|
m_vad_combo.set_hexpand(true);
|
||||||
m_vad_combo.set_halign(Gtk::ALIGN_FILL);
|
m_vad_combo.set_halign(Gtk::ALIGN_FILL);
|
||||||
m_vad_combo.append("gate", "Gate");
|
m_vad_combo.append("gate", "Gate");
|
||||||
|
#ifdef WITH_RNNOISE
|
||||||
m_vad_combo.append("rnnoise", "RNNoise");
|
m_vad_combo.append("rnnoise", "RNNoise");
|
||||||
m_vad_combo.set_active_id("rnnoise");
|
m_vad_combo.set_active_id("rnnoise");
|
||||||
|
#else
|
||||||
|
m_vad_combo.set_active_id("gate");
|
||||||
|
#endif
|
||||||
m_vad_combo.signal_changed().connect([this]() {
|
m_vad_combo.signal_changed().connect([this]() {
|
||||||
const auto id = m_vad_combo.get_active_id();
|
const auto id = m_vad_combo.get_active_id();
|
||||||
if (id == "gate") {
|
if (id == "gate") {
|
||||||
|
Reference in New Issue
Block a user