Commit 1731e5ed authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen

Merge branch 'master' of http://git.rwth-aachen.de/ita/Redstart

parents 3071933c 0c518bbb
......@@ -43,6 +43,7 @@ RedstartRunCirculatingSourceDialog::RedstartRunCirculatingSourceDialog( QWidget
m_dElevationDEG = 0.0f;
m_qVAUpdateTimer = new QTimer( this );
m_qVAUpdateTimer->setTimerType( Qt::TimerType::PreciseTimer );
connect( m_qVAUpdateTimer, SIGNAL( timeout() ), this, SLOT( UpdateScene() ) );
}
......@@ -148,20 +149,35 @@ void RedstartRunCirculatingSourceDialog::UpdateScene()
v3Pos.x = -std::sin( grad2rad( m_dAzimuthDEG ) ) * ui->doubleSpinBox_radius->value();
v3Pos.y = std::sin( grad2rad( m_dElevationDEG ) ) * ui->doubleSpinBox_radius->value();
v3Pos.z = -std::cos( grad2rad( m_dAzimuthDEG ) ) * ui->doubleSpinBox_radius->value();
VAVec3 v3NewPos;
try
{
m_pVAInterface->SetSoundSourcePosition( m_iSourceID, v3Pos );
v3NewPos = m_pVAInterface->GetSoundSourcePosition( m_iSourceID );
}
catch( CVAException& e )
{
Stop();
}
ui->doubleSpinBox_azimuth->setValue( m_dAzimuthDEG );
ui->doubleSpinBox_elevation->setValue( m_dElevationDEG );
ui->doubleSpinBox_source_pos_x->setValue( v3NewPos.x );
ui->doubleSpinBox_source_pos_y->setValue( v3NewPos.y );
ui->doubleSpinBox_source_pos_z->setValue( v3NewPos.z );
ui->doubleSpinBox_runtime_tracker->setValue( m_dRuntimeSeconds );
m_dAzimuthDEG += ui->doubleSpinBox_azi_inc->value();
m_dAzimuthDEG = anglef_proj_0_360_DEG( m_dAzimuthDEG );
m_dElevationDEG += ui->doubleSpinBox_ele_inc->value();
m_dRuntime += ui->doubleSpinBox_timeout->value();
m_dElevationDEG = anglef_proj_N90_90_DEG( m_dElevationDEG );
m_dRuntimeSeconds += ui->doubleSpinBox_timeout->value();
if( m_dRuntime > ui->doubleSpinBox_runtime->value() )
if( m_dRuntimeSeconds > ui->doubleSpinBox_runtime->value() )
Stop();
}
......@@ -171,13 +187,13 @@ void RedstartRunCirculatingSourceDialog::StartUpdateTimer()
const int iIntervalMS = ceil( dTimeout * 1000.0f );
m_qVAUpdateTimer->setInterval( iIntervalMS );
m_qVAUpdateTimer->start();
m_dRuntime = 0.0f;
m_dRuntimeSeconds = 0.0f;
}
void RedstartRunCirculatingSourceDialog::StopUpdateTimer()
{
m_qVAUpdateTimer->stop();
m_dRuntime = 0.0f;
m_dRuntimeSeconds = 0.0f;
m_dAzimuthDEG = 0.0f;
m_dElevationDEG = 0.0f;
......
......@@ -62,7 +62,7 @@ private:
QString m_sSignalID;
double m_dAzimuthDEG, m_dElevationDEG;
double m_dRuntime;
double m_dRuntimeSeconds;
void StartUpdateTimer();
void StopUpdateTimer();
......
......@@ -26,13 +26,16 @@ RedstartSessionBinauralHeadphonesDialog::RedstartSessionBinauralHeadphonesDialog
ui->setupUi( this );
QDialog::setWindowTitle( "Binaural headphones session" );
QSettings qSettings;
QString sLastBrowseFolder = qSettings.value( "Redstart/last_browse_folder" ).toString();
std::string s = sLastBrowseFolder.toStdString();
if( QDir( sLastBrowseFolder ).exists() )
m_oLastBasePath.setCurrent( sLastBrowseFolder );
if( ui->checkBox_hpir_auto_filter_length->isChecked() )
ui->spinBox_inverse_hpir_filter_length->setEnabled( false );
}
RedstartSessionBinauralHeadphonesDialog::~RedstartSessionBinauralHeadphonesDialog()
......@@ -51,11 +54,13 @@ QVariantHash RedstartSessionBinauralHeadphonesDialog::GetCoreConfig() const
oPaths[ "DemoSoundBasePath" ] = m_oDemoSoundBasePath.absolutePath();
if( m_oHRIRBasePath.exists() && m_oHRIRBasePath != m_oDemoSoundBasePath )
oPaths[ "DefaultHRIRBasePath" ] = m_oHRIRBasePath.absolutePath();
if( m_oInverseHPIRBasePath.exists() && m_oInverseHPIRBasePath != m_oHRIRBasePath )
oPaths[ "HPIRBaseFolder" ] = m_oInverseHPIRBasePath.absolutePath();
oFinalCoreConfig[ "Paths" ] = oPaths;
QString sHRIRMacro = ui->lineEdit_macro_DefaultHRIR->text();
QString sHRIRMacro = ui->lineEdit_macro_DefaultHRIR->text();
if( ui->checkBox_folders_as_search_path->isChecked() )
{
QFileInfo oHRIR( sHRIRMacro );
......@@ -75,8 +80,6 @@ QVariantHash RedstartSessionBinauralHeadphonesDialog::GetCoreConfig() const
oFinalCoreConfig[ "Macros" ] = oMacros;
// @todo switch between talkthrough and headphone reproduction with equalization
QVariantHash oDevice;
oDevice[ "Type" ] = "HP";
......@@ -90,17 +93,50 @@ QVariantHash RedstartSessionBinauralHeadphonesDialog::GetCoreConfig() const
oFinalCoreConfig[ "Output:MyDesktopHP" ] = oOutput;
QVariantHash oReproduction;
oReproduction[ "Class" ] = "Talkthrough";
oReproduction[ "Outputs" ] = "MyDesktopHP";
if( ui->groupBox_headphone_equalization->isChecked() )
{
QVariantHash oReproduction;
oReproduction[ "Class" ] = "Headphones";
oReproduction[ "Outputs" ] = "MyDesktopHP";
if( ui->checkBox_inverse_hpir_calibration_gain_db->isChecked() )
oReproduction[ "HpIRInvCalibrationGainDecibel" ] = ui->doubleSpinBox_InvHPIRCalibrationGain->value();
else
oReproduction[ "HpIRInvCalibrationGain" ] = ui->doubleSpinBox_InvHPIRCalibrationGain->value(); // no decibel
QString sHPIRFile = ui->lineEdit_inverse_hpir_file->text();
if( ui->checkBox_folders_as_search_path->isChecked() )
{
QFileInfo oHRIR( sHPIRFile );
sHPIRFile = oHRIR.fileName();
}
oReproduction[ "HpIRInvFile" ] = sHPIRFile;
if( !ui->checkBox_hpir_auto_filter_length->isChecked() )
oReproduction[ "HpIRInvFilterLength" ] = ui->spinBox_inverse_hpir_filter_length->value();
oFinalCoreConfig[ "Reproduction:MyEqualizedHeadphones" ] = oReproduction;
QVariantHash oRenderer;
oRenderer[ "Class" ] = "BinauralFreeField";
oRenderer[ "Reproductions" ] = "MyEqualizedHeadphones";
oFinalCoreConfig[ "Renderer:MyBinauralRenderer" ] = oRenderer;
}
else
{
QVariantHash oReproduction;
oReproduction[ "Class" ] = "Talkthrough";
oReproduction[ "Outputs" ] = "MyDesktopHP";
oFinalCoreConfig[ "Reproduction:MyTalkthroughHeadphones" ] = oReproduction;
oFinalCoreConfig[ "Reproduction:MyTalkthroughHeadphones" ] = oReproduction;
QVariantHash oRenderer;
oRenderer[ "Class" ] = "BinauralFreeField";
oRenderer[ "Reproductions" ] = "MyTalkthroughHeadphones";
QVariantHash oRenderer;
oRenderer[ "Class" ] = "BinauralFreeField";
oRenderer[ "Reproductions" ] = "MyTalkthroughHeadphones";
oFinalCoreConfig[ "Renderer:MyBinauralRenderer" ] = oRenderer;
oFinalCoreConfig[ "Renderer:MyBinauralRenderer" ] = oRenderer;
}
return oFinalCoreConfig;
}
......@@ -173,3 +209,36 @@ void RedstartSessionBinauralHeadphonesDialog::on_pushButton_BrowseHRIR_clicked()
}
}
}
void RedstartSessionBinauralHeadphonesDialog::on_pushButton_inverse_hpir_file_select_clicked()
{
QFileDialog fd;
fd.setNameFilter( "WAV files (*.wav)" );
fd.setViewMode( QFileDialog::Detail );
if( m_oLastBasePath.exists() )
fd.setDirectory( m_oLastBasePath );
else
fd.setDirectory( QDir( QApplication::applicationDirPath() ) );
if( fd.exec() )
{
QStringList lFiles = fd.selectedFiles();
if( lFiles.empty() == false )
{
QString sFilePath = lFiles[ 0 ];
QFile oFile( sFilePath );
if( oFile.exists() )
{
m_oHRIRBasePath = fd.directory();
m_oLastBasePath = m_oHRIRBasePath;
}
ui->lineEdit_inverse_hpir_file->setText( oFile.fileName() );
}
}
}
void RedstartSessionBinauralHeadphonesDialog::on_checkBox_hpir_auto_filter_length_clicked( bool bEnabled )
{
ui->spinBox_inverse_hpir_filter_length->setEnabled( !bEnabled );
}
......@@ -38,13 +38,15 @@ private slots:
void on_pushButton_CreateSession_clicked();
void on_pushButton_BrowseDemoSound_clicked();
void on_pushButton_BrowseHRIR_clicked();
void on_pushButton_inverse_hpir_file_select_clicked();
void on_checkBox_hpir_auto_filter_length_clicked( bool );
private:
Ui::RedstartDialogSessionBinauralHeadphones* ui;
QDir m_oLastBasePath;
QDir m_oHRIRBasePath;
QDir m_oInverseHPIRBasePath;
QDir m_oDemoSoundBasePath;
QString m_sFileBaseName;
QSettings m_qSettings;
};
......
......@@ -717,7 +717,7 @@ void RedstartWindow::on_pushButton_start_stop_clicked()
m_pVAInterface = NULL;
}
ui->statusBar->showMessage( QString::fromStdString( ex.ToString() ) );
ui->statusBar->showMessage( QString::fromStdString( ex.ToString() ) + ". Will deactivate auto-start checkbox." );
ui->checkBox_redstart_auto_start->setChecked( false );
}
}
......
This diff is collapsed.
......@@ -157,9 +157,9 @@
</widget>
</item>
<item row="7" column="0" colspan="4">
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="groupBox_headphone_equalization">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="title">
<string>Headphone equalization</string>
......@@ -172,10 +172,20 @@
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_InvHPIRCalibrationGain"/>
<widget class="QDoubleSpinBox" name="doubleSpinBox_InvHPIRCalibrationGain">
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>-999.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<widget class="QLabel" name="lineEdit_inverse_hpir_calibration_gain_db">
<property name="text">
<string>Inverse HPIR calibration gain</string>
</property>
......@@ -185,7 +195,7 @@
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="checkBox">
<widget class="QCheckBox" name="checkBox_inverse_hpir_calibration_gain_db">
<property name="text">
<string>dB</string>
</property>
......@@ -200,39 +210,29 @@
<string>Inverse HPIR file</string>
</property>
<property name="buddy">
<cstring>lineEdit</cstring>
<cstring>lineEdit_inverse_hpir_file</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit"/>
<widget class="QLineEdit" name="lineEdit_inverse_hpir_file"/>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton">
<widget class="QPushButton" name="pushButton_inverse_hpir_file_select">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_2">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>HPIR filter length</string>
</property>
<property name="buddy">
<cstring>lineEdit_2</cstring>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="checkBox_2">
<widget class="QCheckBox" name="checkBox_hpir_auto_filter_length">
<property name="text">
<string>auto</string>
</property>
......@@ -241,6 +241,19 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinBox_inverse_hpir_filter_length">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>99999</number>
</property>
<property name="value">
<number>128</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......@@ -264,13 +277,12 @@
<tabstop>checkBox_folders_as_search_path</tabstop>
<tabstop>spinBox_hrir_filter_length</tabstop>
<tabstop>lineEdit_headphone_channels</tabstop>
<tabstop>groupBox</tabstop>
<tabstop>pushButton</tabstop>
<tabstop>lineEdit</tabstop>
<tabstop>groupBox_headphone_equalization</tabstop>
<tabstop>pushButton_inverse_hpir_file_select</tabstop>
<tabstop>lineEdit_inverse_hpir_file</tabstop>
<tabstop>doubleSpinBox_InvHPIRCalibrationGain</tabstop>
<tabstop>checkBox</tabstop>
<tabstop>lineEdit_2</tabstop>
<tabstop>checkBox_2</tabstop>
<tabstop>checkBox_inverse_hpir_calibration_gain_db</tabstop>
<tabstop>checkBox_hpir_auto_filter_length</tabstop>
<tabstop>pushButton_BrowseHRIR</tabstop>
</tabstops>
<resources/>
......
......@@ -1281,7 +1281,7 @@ background-color: rgb(208, 255, 188);</string>
<string>Reset</string>
</property>
<property name="shortcut">
<string>R, R</string>
<string>R, Esc</string>
</property>
</action>
</widget>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment