Added impedance match check and icons

pull/4/head
Alexander Diamadis 5 years ago
parent d5d0815ca9
commit efdc56cc85
Signed by: alex
GPG Key ID: 6A1609EFA141FD70

Binary file not shown.

@ -3,7 +3,7 @@ QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11 CONFIG += c++11
CONFIG+=sdk_no_version_check
# You can make your code fail to compile if it uses deprecated APIs. # You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line. # In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
@ -29,9 +29,16 @@ FORMS += \
library.ui \ library.ui \
mainwindow.ui mainwindow.ui
CONFIG += lrelease TARGET = "PA Calculator"
CONFIG += embed_translations
macx {
ICON = PA_Calculator.icns
}
win32 {
RC_ICONS = PA_Calculator.ico
}
# Default rules for deployment. # Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Library Editor</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="0"> <item row="1" column="0">
@ -27,7 +27,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="amps"> <widget class="QWidget" name="amps">
<attribute name="title"> <attribute name="title">

@ -1,14 +1,10 @@
#include "mainwindow.h" #include "mainwindow.h"
#include <QApplication> #include <QApplication>
#include <QLocale>
#include <QTranslator>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
MainWindow w; MainWindow w;
w.show(); w.show();
return a.exec(); return a.exec();

@ -54,8 +54,20 @@ void MainWindow::on_ComboBox_selectSensUnit_currentIndexChanged(int index)
void MainWindow::on_pushButton_requestLimiter_clicked() void MainWindow::on_pushButton_requestLimiter_clicked()
{ {
qreal vMaxSpeakerInRMS=20*std::log10(qSqrt(ui->spinBox_speakerImp->value()*ui->spinBox_speakerRMSPower->value())/0.7746); qreal speakerCount=ui->spinBox_speakerCount->value();
qreal vMaxSpeakerInPeak=20*std::log10(qSqrt(ui->spinBox_speakerImp->value()*ui->spinBox_speakerPeakPower->value())/0.7746); qreal speakerImp=ui->spinBox_speakerImp->value()/speakerCount;
qreal speakerRMS=ui->spinBox_speakerRMSPower->value()*speakerCount;
qreal speakerPeak=ui->spinBox_speakerPeakPower->value()*speakerCount;
qreal ampImp=ui->spinBox_AmpImp->value();
if (speakerImp!=ampImp){
QMessageBox msgBox(QMessageBox::Critical,"Impedance Mismatch",QString("The speaker impedance (")+QString::number(speakerImp)+QString(" Ohm) doesn't match with the amplifier impedance (")+QString::number(ampImp)+QString(" Ohm). Maybe you can change the amplifier mode?"));
msgBox.exec();
return;
}
qreal vMaxSpeakerInRMS=20*std::log10(qSqrt(speakerImp*speakerRMS)/0.7746);
qreal vMaxSpeakerInPeak=20*std::log10(qSqrt(speakerImp*speakerPeak)/0.7746);
qreal vAmpSens_volt=0; qreal vAmpSens_volt=0;
qreal vAmpsens_dBu=0; qreal vAmpsens_dBu=0;
@ -77,20 +89,23 @@ void MainWindow::on_pushButton_requestLimiter_clicked()
qreal releaseTimeRMS=attackTimeRMS*8; qreal releaseTimeRMS=attackTimeRMS*8;
qreal releaseTimePeak=attackTimeRMS; qreal releaseTimePeak=attackTimeRMS;
if (vAmpsens_dBu<vMaxAmpInRMS){ if (vAmpsens_dBu<vMaxAmpInRMS){
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."); 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(); msgBox.exec();
ui->label_thresholdRMS->setText(QString("not required")); ui->label_thresholdRMS->setText(QString("not required"));
ui->label_attackTimeRMS->setText(QString::number(attackTimeRMS,'f',2)+QString(" ms")); ui->label_attackTimeRMS->setText(QString::number(attackTimeRMS,'f',2)+QString(" ms"));
ui->label_releaseTimeRMS->setText(QString::number(releaseTimeRMS,'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(ui->spinBox_speakerImp->value()*ui->spinBox_speakerRMSPower->value()),'f',2)+QString(" V)")); ui->label_UMaxSpeakerInRMS->setText(QString::number(vMaxSpeakerInRMS,'f',2)+QString(" dBU (")+QString::number(qSqrt(speakerImp*speakerRMS),'f',2)+QString(" V)"));
ui->label_UMaxAmpInRMS->setText(QString("not applicable")); ui->label_UMaxAmpInRMS->setText(QString("not applicable"));
thresholdPeak=-18-(ui->spinBox_digitalNominalLevel->value()-vAmpsens_dBu); thresholdPeak=-18-(ui->spinBox_digitalNominalLevel->value()-vAmpsens_dBu);
ui->label_thresholdPeak->setText(QString::number(thresholdPeak,'f',1)+QString(" dBFS")); ui->label_thresholdPeak->setText(QString::number(thresholdPeak,'f',1)+QString(" dBFS"));
ui->label_releaseTimePeak->setText(QString::number(releaseTimePeak,'f',2)+QString(" ms")); ui->label_releaseTimePeak->setText(QString::number(releaseTimePeak,'f',2)+QString(" ms"));
ui->label_UMaxSpeakerInPeak->setText(QString::number(vMaxSpeakerInPeak,'f',2)+QString(" dBU (")+QString::number(qSqrt(ui->spinBox_speakerImp->value()*ui->spinBox_speakerPeakPower->value()),'f',2)+QString(" V)")); ui->label_UMaxSpeakerInPeak->setText(QString::number(vMaxSpeakerInPeak,'f',2)+QString(" dBU (")+QString::number(qSqrt(speakerImp*speakerPeak),'f',2)+QString(" V)"));
ui->label_UMaxAmpInPeak->setText(QString::number(vAmpSens_volt,'f',2)+QString(" V (= input sensitivity)")); ui->label_UMaxAmpInPeak->setText(QString::number(vAmpSens_volt,'f',2)+QString(" V (= input sensitivity)"));
}else if (vAmpsens_dBu<vMaxAmpInPeak){ }else if (vAmpsens_dBu<vMaxAmpInPeak){
QMessageBox msgBox(QMessageBox::Warning,"Amplifier can't deliver maximum peak power","The maximum power level of the amplifier is below the maximum peak 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."); QMessageBox msgBox(QMessageBox::Warning,"Amplifier can't deliver maximum peak power","The maximum power level of the amplifier is below the maximum peak 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.");
@ -99,24 +114,24 @@ void MainWindow::on_pushButton_requestLimiter_clicked()
ui->label_thresholdRMS->setText(QString::number(thresholdRMS,'f',1)+QString(" dBFS")); ui->label_thresholdRMS->setText(QString::number(thresholdRMS,'f',1)+QString(" dBFS"));
ui->label_attackTimeRMS->setText(QString::number(attackTimeRMS,'f',2)+QString(" ms")); ui->label_attackTimeRMS->setText(QString::number(attackTimeRMS,'f',2)+QString(" ms"));
ui->label_releaseTimeRMS->setText(QString::number(releaseTimeRMS,'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(ui->spinBox_speakerImp->value()*ui->spinBox_speakerRMSPower->value()),'f',2)+QString(" V)")); ui->label_UMaxSpeakerInRMS->setText(QString::number(vMaxSpeakerInRMS,'f',2)+QString(" dBU (")+QString::number(qSqrt(speakerImp*speakerRMS),'f',2)+QString(" V)"));
ui->label_UMaxAmpInRMS->setText(QString::number(vMaxAmpInRMS,'f',2)+QString(" dBU (")+QString::number(qPow(10,vMaxAmpInRMS/20)*0.7746,'f',2)+QString(" V)")); ui->label_UMaxAmpInRMS->setText(QString::number(vMaxAmpInRMS,'f',2)+QString(" dBU (")+QString::number(qPow(10,vMaxAmpInRMS/20)*0.7746,'f',2)+QString(" V)"));
thresholdPeak=-18-(ui->spinBox_digitalNominalLevel->value()-vAmpsens_dBu); thresholdPeak=-18-(ui->spinBox_digitalNominalLevel->value()-vAmpsens_dBu);
ui->label_thresholdPeak->setText(QString::number(thresholdPeak,'f',1)+QString(" dBFS")); ui->label_thresholdPeak->setText(QString::number(thresholdPeak,'f',1)+QString(" dBFS"));
ui->label_releaseTimePeak->setText(QString::number(releaseTimePeak,'f',2)+QString(" ms")); ui->label_releaseTimePeak->setText(QString::number(releaseTimePeak,'f',2)+QString(" ms"));
ui->label_UMaxSpeakerInPeak->setText(QString::number(vMaxSpeakerInPeak,'f',2)+QString(" dBU (")+QString::number(qSqrt(ui->spinBox_speakerImp->value()*ui->spinBox_speakerPeakPower->value()),'f',2)+QString(" V)")); ui->label_UMaxSpeakerInPeak->setText(QString::number(vMaxSpeakerInPeak,'f',2)+QString(" dBU (")+QString::number(qSqrt(speakerImp*speakerPeak),'f',2)+QString(" V)"));
ui->label_UMaxAmpInPeak->setText(QString::number(vAmpSens_volt,'f',2)+QString(" V (= input sensitivity)")); ui->label_UMaxAmpInPeak->setText(QString::number(vAmpSens_volt,'f',2)+QString(" V (= input sensitivity)"));
}else{ }else{
ui->label_thresholdRMS->setText(QString::number(thresholdRMS,'f',1)+QString(" dBFS")); ui->label_thresholdRMS->setText(QString::number(thresholdRMS,'f',1)+QString(" dBFS"));
ui->label_attackTimeRMS->setText(QString::number(attackTimeRMS,'f',2)+QString(" ms")); ui->label_attackTimeRMS->setText(QString::number(attackTimeRMS,'f',2)+QString(" ms"));
ui->label_releaseTimeRMS->setText(QString::number(releaseTimeRMS,'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(ui->spinBox_speakerImp->value()*ui->spinBox_speakerRMSPower->value()),'f',2)+QString(" V)")); ui->label_UMaxSpeakerInRMS->setText(QString::number(vMaxSpeakerInRMS,'f',2)+QString(" dBU (")+QString::number(qSqrt(speakerImp*speakerRMS),'f',2)+QString(" V)"));
ui->label_UMaxAmpInRMS->setText(QString::number(vMaxAmpInRMS,'f',2)+QString(" dBU (")+QString::number(qPow(10,vMaxAmpInRMS/20)*0.7746,'f',2)+QString(" V)")); ui->label_UMaxAmpInRMS->setText(QString::number(vMaxAmpInRMS,'f',2)+QString(" dBU (")+QString::number(qPow(10,vMaxAmpInRMS/20)*0.7746,'f',2)+QString(" V)"));
ui->label_thresholdPeak->setText(QString::number(thresholdPeak,'f',1)+QString(" dBFS")); ui->label_thresholdPeak->setText(QString::number(thresholdPeak,'f',1)+QString(" dBFS"));
ui->label_releaseTimePeak->setText(QString::number(releaseTimePeak,'f',2)+QString(" ms")); ui->label_releaseTimePeak->setText(QString::number(releaseTimePeak,'f',2)+QString(" ms"));
ui->label_UMaxSpeakerInPeak->setText(QString::number(vMaxSpeakerInPeak,'f',2)+QString(" dBU (")+QString::number(qSqrt(ui->spinBox_speakerImp->value()*ui->spinBox_speakerPeakPower->value()),'f',2)+QString(" V)")); ui->label_UMaxSpeakerInPeak->setText(QString::number(vMaxSpeakerInPeak,'f',2)+QString(" dBU (")+QString::number(qSqrt(speakerImp*speakerPeak),'f',2)+QString(" V)"));
ui->label_UMaxAmpInPeak->setText(QString::number(vMaxAmpInPeak,'f',2)+QString(" dBU (")+QString::number(qPow(10,vMaxAmpInPeak/20)*0.7746,'f',2)+QString(" V)")); ui->label_UMaxAmpInPeak->setText(QString::number(vMaxAmpInPeak,'f',2)+QString(" dBU (")+QString::number(qPow(10,vMaxAmpInPeak/20)*0.7746,'f',2)+QString(" V)"));
} }

@ -6,13 +6,16 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1230</width> <width>1141</width>
<height>611</height> <height>611</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>PA Calculator</string> <string>PA Calculator</string>
</property> </property>
<property name="locale">
<locale language="English" country="Germany"/>
</property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
@ -289,17 +292,17 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="7" column="0">
<widget class="QLabel" name="label_21"> <widget class="QLabel" name="label_21">
<property name="text"> <property name="text">
<string>Load Speaker from library</string> <string>Load Speaker from library</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="7" column="1">
<widget class="QComboBox" name="comboBox_librarySpeaker"/> <widget class="QComboBox" name="comboBox_librarySpeaker"/>
</item> </item>
<item row="4" column="1"> <item row="6" column="1">
<spacer name="verticalSpacer_4"> <spacer name="verticalSpacer_4">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -312,7 +315,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="6" column="1"> <item row="8" column="1">
<widget class="QPushButton" name="pushButton_loadSpeaker"> <widget class="QPushButton" name="pushButton_loadSpeaker">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -325,6 +328,36 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1">
<widget class="QSpinBox" name="spinBox_speakerCount">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>2</number>
</property>
</widget>
</item>
<item row="4" column="1">
<spacer name="verticalSpacer_6">
<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="5" column="0">
<widget class="QLabel" name="label_24">
<property name="text">
<string>Number of speaker in parallel</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
@ -672,7 +705,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1230</width> <width>1141</width>
<height>24</height> <height>24</height>
</rect> </rect>
</property> </property>
@ -686,7 +719,6 @@
</widget> </widget>
<addaction name="menuLibrary"/> <addaction name="menuLibrary"/>
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionEditLibrary"> <action name="actionEditLibrary">
<property name="text"> <property name="text">
<string>Edit Library</string> <string>Edit Library</string>

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/Icons">
<file>PA_Calculator.icns</file>
</qresource>
</RCC>
Loading…
Cancel
Save