Gain Structure Optimization Option added

pull/4/head
Alexander Diamadis 4 years ago
parent deb7278a36
commit 48df7e77d7

@ -254,7 +254,6 @@ void library::printAllAmps()
void library::on_listWidget_ampView_currentRowChanged(int currentRow)
{
if (initAmps){
if (currentRow>=0){
ui->lineEdit_ampName->setText(QString::fromStdString(m_pCamp[currentRow].getName()));
ui->comboBox_sensUnit->setCurrentIndex(m_pCamp[currentRow].getSensivityUnit());
@ -274,9 +273,6 @@ void library::on_listWidget_ampView_currentRowChanged(int currentRow)
ui->lineEdit_ampName->setEnabled(false);
ui->doubleSpinBox_inputSensitivity->setEnabled(false);
}
}else {
initAmps =true;
}
}
@ -436,7 +432,6 @@ void library::on_pushButton_addSpeaker_clicked()
void library::on_listWidget_speakerView_currentRowChanged(int currentRow)
{
if (initSpeaker){
if (currentRow>=0){
ui->lineEdit_speakerName->setText(QString::fromStdString(m_pSpeaker[currentRow].getName()));
ui->spinBox_speakerImp->setValue(m_pSpeaker[currentRow].getImpedance());
@ -457,9 +452,6 @@ void library::on_listWidget_speakerView_currentRowChanged(int currentRow)
//ui->spinBox_speakerPeakPower->setEnabled(false);
//ui->spinBox_speakerHPF->setEnabled(false);
}
}else{
initSpeaker=true;
}
}
@ -579,7 +571,6 @@ void library::on_pushButton_Apply_clicked()
void library::on_listWidget_dacView_currentRowChanged(int currentRow)
{
if (initDacs){
if (currentRow>=0){
ui->lineEdit_dacName->setText(QString::fromStdString(m_pDac[currentRow].name()));
ui->spinBox_dacOutputLevel->setValue(m_pDac[currentRow].outputLevel());
@ -588,9 +579,6 @@ void library::on_listWidget_dacView_currentRowChanged(int currentRow)
}else{
ui->lineEdit_dacName->setEnabled(false);
}
}else{
initDacs=true;
}
}

@ -68,6 +68,7 @@ void MainWindow::on_pushButton_requestLimiter_clicked()
return;
}
qreal vMaxSpeakerInRMS=20*std::log10(qSqrt(speakerImp*speakerRMS)/0.7746);
qreal vMaxSpeakerInPeak=20*std::log10(qSqrt(speakerImp*speakerPeak)/0.7746);
@ -91,6 +92,7 @@ void MainWindow::on_pushButton_requestLimiter_clicked()
qreal releaseTimeRMS=attackTimeRMS*8;
qreal releaseTimePeak=attackTimeRMS;
bool rmsRequired=true;
@ -98,6 +100,7 @@ void MainWindow::on_pushButton_requestLimiter_clicked()
QMessageBox msgBox(QMessageBox::Warning,"Amplifier can't deliver maximum RMS power","The maximum power level of the amplifier is below the maximum RMS power level of the speaker. To protect the speaker from a distorted signal the amplifier might deliver, a peak limiter is required with the amplifiers input sensitivty set as its threshold.");
msgBox.exec();
ui->label_thresholdRMS->setText(QString("not required"));
rmsRequired=false;
ui->label_attackTimeRMS->setText(QString::number(attackTimeRMS,'f',2)+QString(" ms"));
ui->label_releaseTimeRMS->setText(QString::number(releaseTimeRMS,'f',2)+QString(" ms"));
ui->label_UMaxSpeakerInRMS->setText(QString::number(vMaxSpeakerInRMS,'f',2)+QString(" dBU (")+QString::number(qSqrt(speakerImp*speakerRMS),'f',2)+QString(" V)"));
@ -137,7 +140,20 @@ void MainWindow::on_pushButton_requestLimiter_clicked()
ui->label_UMaxAmpInPeak->setText(QString::number(vMaxAmpInPeak,'f',2)+QString(" dBU (")+QString::number(qPow(10,vMaxAmpInPeak/20)*0.7746,'f',2)+QString(" V)"));
}
if (ui->checkBox_optimizeGain->checkState()){
qreal diff=0;
qreal digitalHeadroom=ui->spinBox_digitalHeadroom->value();
while (thresholdPeak+diff+1<=-digitalHeadroom){
diff++;
}
ui->label_thresholdPeak->setText(QString::number(thresholdPeak+diff,'f',1)+QString(" dBFS"));
if (rmsRequired){
ui->label_thresholdRMS->setText(QString::number(thresholdRMS+diff,'f',1)+QString(" dBFS"));
}
ui->label_inputVolumeControl->setText(QString::number(-diff)+QString(" dB"));
}else {
ui->label_inputVolumeControl->setText(QString("0 dB"));
}
}
@ -351,3 +367,13 @@ void MainWindow::on_actionOpen_Loudness_Analyzer_triggered()
analyzerWindow.exec();
}
void MainWindow::on_checkBox_optimizeGain_stateChanged(int arg1)
{
if (ui->checkBox_optimizeGain->checkState()){
ui->spinBox_digitalHeadroom->setEnabled(true);
}else{
ui->spinBox_digitalHeadroom->setEnabled(false);
}
}

@ -42,6 +42,8 @@ private slots:
void on_actionOpen_Loudness_Analyzer_triggered();
void on_checkBox_optimizeGain_stateChanged(int arg1);
private:
Ui::MainWindow *ui;
cAmp* m_pCAmp;

@ -51,6 +51,9 @@
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@ -226,6 +229,9 @@
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
@ -407,6 +413,9 @@
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QFormLayout" name="formLayout_3">
<property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
@ -427,16 +436,6 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Load DAC from library</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboBox_dacPreset"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
@ -444,6 +443,23 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_25">
<property name="text">
<string>Output Gain Structure</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBox_optimizeGain">
<property name="text">
<string>Optimize</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<spacer name="verticalSpacer_5">
<property name="orientation">
@ -460,6 +476,16 @@
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Load DAC from library</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboBox_dacPreset"/>
</item>
<item row="6" column="0" colspan="2">
<widget class="QPushButton" name="pushButton_loadDac">
<property name="font">
@ -472,31 +498,34 @@
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
<widget class="QSpinBox" name="spinBox_digitalHeadroom">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
<property name="suffix">
<string> dB</string>
</property>
</spacer>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>30</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_26">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Digital Headroom</string>
</property>
</widget>
</item>
</layout>
</item>
@ -538,6 +567,12 @@
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QFormLayout" name="formLayout_4">
<property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="formAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<item row="4" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
@ -568,9 +603,15 @@
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_11">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Threshold:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
@ -655,6 +696,9 @@
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QFormLayout" name="formLayout_5">
<property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<item row="4" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
@ -759,6 +803,41 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_6">
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
<property name="title">
<string>Amplifier</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QFormLayout" name="formLayout_6">
<property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_27">
<property name="text">
<string>Input Volume Control:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_inputVolumeControl">
<property name="text">
<string>0 dB</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>

Loading…
Cancel
Save