|
|
|
|
@ -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", |
|
|
|
|
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() { |
|
|
|
|
|