Lets test preprocessors

This commit is contained in:
Joao Mesquita 2010-04-08 23:15:29 -03:00
parent bec8d75ef6
commit 2666a40a12
7 changed files with 1173 additions and 973 deletions

View File

@ -179,10 +179,26 @@ void MainWindow::debugConsoleTriggered()
}
void MainWindow::applyPreprocessors(QStringList cmds)
{
if (g_FSHost.getCurrentActiveCall().isNull()) return;
QString uuid = g_FSHost.getCurrentActiveCall().data()->getUuid();
foreach(QString cmd, cmds)
{
switch_stream_handle_t stream = { 0 };
SWITCH_STANDARD_STREAM(stream);
switch_api_execute("uuid_preprocess", QString("%1 %2").arg(uuid, cmd).toAscii().data(), NULL, &stream);
switch_safe_free(stream.data);
}
}
void MainWindow::prefTriggered()
{
if (!preferences)
{
preferences = new PrefDialog();
connect(preferences, SIGNAL(preprocessorsApplied(QStringList)), this, SLOT(applyPreprocessors(QStringList)));
}
preferences->raise();
preferences->show();

View File

@ -85,6 +85,7 @@ private slots:
void updateCallTimers();
void debugConsoleTriggered();
void debugEventsTriggered();
void applyPreprocessors(QStringList);
private:
Ui::MainWindow *ui;

View File

@ -15,6 +15,7 @@ PrefDialog::PrefDialog(QWidget *parent) :
_pref_accounts = new PrefAccounts(ui);
_mod_portaudio = new PrefPortaudio(ui, this);
connect(_mod_portaudio, SIGNAL(preprocessorsApplied(QStringList)), this, SIGNAL(preprocessorsApplied(QStringList)));
_mod_sofia = new PrefSofia(ui, this);
readConfig();
}

View File

@ -26,6 +26,9 @@ protected:
private slots:
void writeConfig();
signals:
void preprocessorsApplied(QStringList);
private:
void readConfig();
QSettings *_settings;

View File

@ -6,15 +6,17 @@
<rect>
<x>0</x>
<y>0</y>
<width>839</width>
<height>613</height>
<width>803</width>
<height>667</height>
</rect>
</property>
<property name="windowTitle">
<string>Preferences</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QListWidget" name="listSections">
<property name="minimumSize">
<size>
@ -84,7 +86,7 @@
</item>
<item>
<property name="text">
<string>PortAudio</string>
<string>Audio</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
@ -93,7 +95,7 @@
</item>
</widget>
</item>
<item row="0" column="1">
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
@ -791,6 +793,16 @@
</widget>
<widget class="QWidget" name="portaudioPage">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget_2">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="tab_5">
<attribute name="title">
<string>General</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
@ -1003,9 +1015,149 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_6">
<attribute name="title">
<string>Preprocessor</string>
</attribute>
<layout class="QFormLayout" name="formLayout_9">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Echo canceller</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkAECRead">
<property name="text">
<string>read</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkAECWrite">
<property name="text">
<string>write</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_45">
<property name="text">
<string>Tail</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="spinAECTail"/>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="label_43">
<property name="text">
<string>Echo Suppressor</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="checkESRead">
<property name="text">
<string>read</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QCheckBox" name="checkESWrite">
<property name="text">
<string>write</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLabel" name="label_46">
<property name="text">
<string>Db</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QSpinBox" name="spinESDb"/>
</item>
<item row="10" column="0" colspan="2">
<widget class="QLabel" name="label_47">
<property name="text">
<string>Noise Supressor</string>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QCheckBox" name="checkNSRead">
<property name="text">
<string>read</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QCheckBox" name="checkNSWrite">
<property name="text">
<string>write</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLabel" name="label_48">
<property name="text">
<string>Db</string>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QSpinBox" name="spinNSDb"/>
</item>
<item row="16" column="1">
<widget class="QCheckBox" name="checkAGCRead">
<property name="text">
<string>read</string>
</property>
</widget>
</item>
<item row="17" column="1">
<widget class="QCheckBox" name="checkAGCWrite">
<property name="text">
<string>write</string>
</property>
</widget>
</item>
<item row="18" column="1">
<widget class="QSpinBox" name="spinAGC"/>
</item>
<item row="15" column="0">
<widget class="QLabel" name="label_44">
<property name="text">
<string>AGC</string>
</property>
</widget>
</item>
<item row="19" column="1">
<widget class="QPushButton" name="btnApplyPreprocessor">
<property name="text">
<string>Apply</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>

View File

@ -15,6 +15,28 @@ PrefPortaudio::PrefPortaudio(Ui::PrefDialog *ui, QObject *parent) :
connect(_ui->PaRingdevTestBtn, SIGNAL(clicked()), this, SLOT(ringdevTest()));
connect(_ui->PaLoopTestBtn, SIGNAL(clicked()), this, SLOT(loopTest()));
connect(_ui->PaRefreshDevListBtn, SIGNAL(clicked()), this, SLOT(refreshDevList()));
connect(_ui->btnApplyPreprocessor, SIGNAL(toggled(bool)), this, SLOT(applyPreprocessors(bool)));
}
void PrefPortaudio::applyPreprocessors(bool state)
{
QStringList cmds;
if (!state)
{
cmds.append("stop");
}
else
{
if (_ui->checkAECRead->isChecked()) cmds.append(QString("recho_cancel=%1").arg(_ui->spinAECTail->value()));
if (_ui->checkAECWrite->isChecked()) cmds.append(QString("wecho_cancel=%1").arg(_ui->spinAECTail->value()));
if (_ui->checkESRead->isChecked()) cmds.append(QString("recho_suppress=%1").arg(_ui->spinESDb->value()));
if (_ui->checkESWrite->isChecked()) cmds.append(QString("wecho_suppress=%1").arg(_ui->spinESDb->value()));
if (_ui->checkNSRead->isChecked()) cmds.append(QString("rnoise_suppress=%1").arg(_ui->spinNSDb->value()));
if (_ui->checkNSWrite->isChecked()) cmds.append(QString("wnoise_suppress=%1").arg(_ui->spinNSDb->value()));
if (_ui->checkAGCRead->isChecked()) cmds.append(QString("ragc=%1").arg(_ui->spinAGC->value()));
if (_ui->checkAGCWrite->isChecked()) cmds.append(QString("wagc=%1").arg(_ui->spinAGC->value()));
}
emit preprocessorsApplied(cmds);
}
void PrefPortaudio::ringdevTest()

View File

@ -24,6 +24,11 @@ private slots:
void ringdevTest();
void loopTest();
void refreshDevList();
void applyPreprocessors(bool);
signals:
void preprocessorsApplied(QStringList);
private:
void getPaDevlist(void);
QSettings *_settings;