Commit 8df117ae authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Adding experimental talkthrough session class

parent 6d5ed2f0
/*
* --------------------------------------------------------------------------------------------
*
* VVV VVV A Virtual Acoustics (VA) | http://www.virtualacoustics.org
* VVV VVV AAA Licensed under the Apache License, Version 2.0
* VVV VVV AAA
* VVV VVV AAA Copyright 2015-2017
* VVVVVV AAA Institute of Technical Acoustics (ITA)
* VVVV AAA RWTH Aachen University
*
* --------------------------------------------------------------------------------------------
*/
#include "RedstartSessionExperimentalTalkthroughDialog.h"
#include <ui_RedstartSessionExperimentalTalkthroughDialog.h>
#include <QFileDialog>
#include <QSettings>
RedstartSessionExperimentalTalkthroughDialog::RedstartSessionExperimentalTalkthroughDialog( QWidget *parent )
: QDialog( parent ),
ui( new Ui::RedstartSessionExperimentalTalkthroughDialog )
{
ui->setupUi( this );
QDialog::setWindowTitle( "Experimental talkthrough 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 );
}
RedstartSessionExperimentalTalkthroughDialog::~RedstartSessionExperimentalTalkthroughDialog()
{
if( m_oLastBasePath.exists() )
m_qSettings.setValue( "Redstart/last_browse_folder", m_oLastBasePath.absolutePath() );
delete ui;
}
QVariantHash RedstartSessionExperimentalTalkthroughDialog::GetCoreConfig() const
{
QVariantHash oFinalCoreConfig;
QVariantHash oPaths;
if( m_oDemoSoundBasePath.exists() )
oPaths[ "DemoSoundBasePath" ] = m_oDemoSoundBasePath.absolutePath();
if( m_oHRIRBasePath.exists() )
oPaths[ "DefaultHRIRBasePath" ] = m_oHRIRBasePath.absolutePath();
oFinalCoreConfig[ "Paths" ] = oPaths;
QString sDemoSoundMacro = ui->lineEdit_macro_DemoSound->text();
if( ui->checkBox_folders_as_search_path->isChecked() )
{
QFileInfo oDemoSound( sDemoSoundMacro );
sDemoSoundMacro = oDemoSound.fileName();
}
QVariantHash oMacros;
oMacros[ "DefaultHRIR" ] = "$(DefaultHRIR)";
oMacros[ "DemoSound" ] = sDemoSoundMacro;
oFinalCoreConfig[ "Macros" ] = oMacros;
QVariantHash oSetup;
QVariantHash oDevice;
oDevice[ "Type" ] = "LSS";
oDevice[ "Channels" ] = ui->lineEdit_output_channels->text();
oSetup[ "OutputDevice:MyHP" ] = oDevice;
QVariantHash oOutput;
oOutput[ "Devices" ] = "MyHP";
oSetup[ "Output:MyDesktopHP" ] = oOutput;
QVariantHash oReproduction;
oReproduction[ "Class" ] = "Talktrough";
oReproduction[ "Outputs" ] = "MyDesktopHP";
oFinalCoreConfig[ "Reproduction:MyTalkthroughHeadphones" ] = oReproduction;
QVariantHash oRenderer;
oRenderer[ "Class" ] = "BinauralFreeField";
oRenderer[ "Outputs" ] = "MyTalkthroughHeadphones";
oFinalCoreConfig[ QString( "Renderer:" + ui->lineEdit_session_name->text() ) ] = oRenderer;
return oFinalCoreConfig;
}
void RedstartSessionExperimentalTalkthroughDialog::on_pushButton_CreateSession_clicked()
{
accept();
close();
}
void RedstartSessionExperimentalTalkthroughDialog::on_pushButton_select_demo_sound()
{
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_oDemoSoundBasePath = fd.directory();
m_oLastBasePath = m_oDemoSoundBasePath;
}
ui->lineEdit_macro_DemoSound->setText( oFile.fileName() );
}
}
}
/*
void RedstartSessionBinauralHeadphonesDialog::on_pushButton_BrowseHRIR_clicked()
{
QFileDialog fd;
fd.setNameFilter( "DAFF files (*.daff)" );
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_macro_DefaultHRIR->setText( sFilePath );
}
}
}
*/
\ No newline at end of file
/*
* --------------------------------------------------------------------------------------------
*
* VVV VVV A Virtual Acoustics (VA) | http://www.virtualacoustics.org
* VVV VVV AAA Licensed under the Apache License, Version 2.0
* VVV VVV AAA
* VVV VVV AAA Copyright 2015-2017
* VVVVVV AAA Institute of Technical Acoustics (ITA)
* VVVV AAA RWTH Aachen University
*
* --------------------------------------------------------------------------------------------
*/
#ifndef IW_REDSTART_SESSION_EXPERIMENTAL_TALKTHROUGH_DIALOG
#define IW_REDSTART_SESSION_EXPERIMENTAL_TALKTHROUGH_DIALOG
#include <QDialog>
#include <QDir>
#include <QString>
#include <QSettings>
#include <QHash>
namespace Ui
{
class RedstartSessionExperimentalTalkthroughDialog;
}
class RedstartSessionExperimentalTalkthroughDialog : public QDialog
{
Q_OBJECT
public:
explicit RedstartSessionExperimentalTalkthroughDialog( QWidget *parent );
~RedstartSessionExperimentalTalkthroughDialog();
QVariantHash GetCoreConfig() const;
private slots:
void on_pushButton_CreateSession_clicked();
void on_pushButton_select_demo_sound();
private:
Ui::RedstartSessionExperimentalTalkthroughDialog* ui;
QDir m_oLastBasePath;
QDir m_oHRIRBasePath;
QDir m_oDemoSoundBasePath;
QString m_sFileBaseName;
QSettings m_qSettings;
};
#endif // IW_REDSTART_SESSION_EXPERIMENTAL_TALKTHROUGH_DIALOG
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