fix: immediate compressor apply + dead code removal + qDebug→DEBUG_* conversion
This commit is contained in:
1 parent
5ec1cb78be
commit
d5b97ff104
6 files changed
+33
-14
No files matched your search
@@ -3,6 +3,7 @@
|
||||
#include "audiorecorder.h"
|
||||
#include "audiocompressor.h"
|
||||
#include "voicemessageencoder.h"
|
||||
#include "../../lib/debug_config.h"
|
||||
#include "../db/db_manager.h"
|
||||
#include "../transport/gui_bridge.h"
|
||||
#include "../../lib/mem.h"
|
||||
@@ -17,8 +18,8 @@ extern "C" {
|
||||
#include <QDebug>
|
||||
#include <cmath>
|
||||
|
||||
AudioDeviceSettingsPage::AudioDeviceSettingsPage(DbManager* db, QWidget* parent)
|
||||
: QWidget(parent), m_db(db)
|
||||
AudioDeviceSettingsPage::AudioDeviceSettingsPage(DbManager* db, AudioRecorder* recorder, QWidget* parent)
|
||||
: QWidget(parent), m_db(db), m_recorder(recorder)
|
||||
{
|
||||
auto* layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(0, 12, 0, 0);
|
||||
@@ -232,9 +233,24 @@ void AudioDeviceSettingsPage::applyAndSave() {
|
||||
m_savedCompressorLookaheadMs = compLookahead;
|
||||
m_savedCompressorRiseRateTenths = compRiseRateTenths;
|
||||
m_savedCompressorTargetLevelDb = compTargetLevel;
|
||||
qDebug("AudioDeviceSettings: saved output=%d input=%d codec=%d compressor=%d gain=%ddB lookback=%d lookahead=%d rise=%.1fx target=%ddB",
|
||||
outIdx, inIdx, codecPreset, compEnabled, compMaxGain, compLookback, compLookahead,
|
||||
(float)compRiseRateTenths / 10.0f, compTargetLevel);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "saved output=%d input=%d codec=%d compressor=%d gain=%ddB lookback=%d lookahead=%d rise=%.1fx target=%ddB",
|
||||
outIdx, inIdx, codecPreset, compEnabled, compMaxGain, compLookback, compLookahead,
|
||||
(float)compRiseRateTenths / 10.0f, compTargetLevel);
|
||||
|
||||
if (m_recorder) {
|
||||
m_recorder->setCompressorEnabled(compEnabled != 0);
|
||||
if (m_recorder->compressor() && compEnabled) {
|
||||
AudioCompressor::Config compCfg;
|
||||
compCfg.sampleRate = 48000;
|
||||
compCfg.channels = 1;
|
||||
compCfg.maxGainDb = (float)compMaxGain;
|
||||
compCfg.lookbackMs = compLookback;
|
||||
compCfg.lookaheadMs = compLookahead;
|
||||
compCfg.riseRatePer500ms = (float)compRiseRateTenths / 10.0f;
|
||||
compCfg.targetLevel = powf(10.0f, (float)compTargetLevel / 20.0f);
|
||||
m_recorder->compressor()->configure(compCfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AudioDeviceSettingsPage::onTestMicToggled() {
|
||||
|
||||
Reference in new issue
Block a user