Progress

parent a2b5910e
/*
* --------------------------------------------------------------------------------------------
*
* 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_DEFAULT_CORE_CONFIG
#define IW_REDSTART_DEFAULT_CORE_CONFIG
#include <QHash>
#include <VAStruct.h>
inline QVariantHash DefaultMacroSection()
{
QVariantHash oHash;
oHash[ "ProjectName" ] = "MyRedstartProject";
return oHash;
};
inline QVariantHash DefaultDebugSection()
{
QVariantHash oHash;
oHash[ "OutputRecordEnabled" ] = false;
oHash[ "OutputRecordFilePath" ] = "$(ProjectName)_out.wav";
oHash[ "LogLevel" ] = 2;
return oHash;
};
inline QVariantHash DefaultCalibrationSection()
{
QVariantHash oHash;
oHash[ "DefaultSoundSpeed" ] = 344.0;
oHash[ "DefaultStaticPressure" ] = 101125.0;
oHash[ "DefaultTemperature" ] = 20.0;
oHash[ "DefaultRelativeHumidity" ] = 20.0;
//oHash[ "DefaultShiftSpeed" ] = QVariantList( 0.0, 0.0, 0.0 );
return oHash;
};
inline QVariantHash DefaultHeadphoneSetup( const QString& sChannels = "1,2" )
{
QVariantHash oSetup;
QVariantHash oDevice;
oDevice[ "Type" ] = "HP";
oDevice[ "Channels" ] = sChannels;
oSetup[ "OutputDevice:MyHP" ] = oDevice;
QVariantHash oOutput;
oOutput[ "Devices" ] = "MyHP";
oSetup[ "Output:MyDesktopHP" ] = oOutput;
return oSetup;
};
#endif // IW_REDSTART_DEFAULT_CORE_CONFIG
\ No newline at end of file
......@@ -14,21 +14,156 @@
#include "RedstartSessionBinauralHeadphonesDialog.h"
#include <ui_RedstartSessionBinauralHeadphonesDialog.h>
#include <QFileDialog>
#include <QSettings>
#include "RedstartDefaultCoreConfig.h"
RedstartSessionBinauralHeadphonesDialog::RedstartSessionBinauralHeadphonesDialog( QWidget *parent )
: QDialog( parent ),
ui( new Ui::RedstartDialogSessionBinauralHeadphones )
{
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 );
}
RedstartSessionBinauralHeadphonesDialog::~RedstartSessionBinauralHeadphonesDialog()
{
//m_qSettings.setValue( "Redstart/Sessions/", ui->checkBox_IncludeAllChannels->checkState() );
if( m_oLastBasePath.exists() )
m_qSettings.setValue( "Redstart/last_browse_folder", m_oLastBasePath.absolutePath() );
delete ui;
}
QVariantHash RedstartSessionBinauralHeadphonesDialog::GetCoreConfig() const
{
QVariantHash oHash;
//ui->line
return oHash;
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 sHRIRMacro = ui->lineEdit_macro_DefaultHRIR->text();
if( ui->checkBox_folders_as_search_path->isChecked() )
{
QFileInfo oHRIR( sHRIRMacro );
sHRIRMacro = oHRIR.fileName();
}
QString sDemoSoundMacro = ui->lineEdit_macro_DemoSound->text();
if( ui->checkBox_folders_as_search_path->isChecked() )
{
QFileInfo oDemoSound( sHRIRMacro );
sDemoSoundMacro = oDemoSound.fileName();
}
QVariantHash oMacros;
oMacros[ "DefaultHRIR" ] = sHRIRMacro;
oMacros[ "DemoSound" ] = sDemoSoundMacro;
oFinalCoreConfig[ "Macros" ] = oMacros;
QVariantHash oSetup;
QVariantHash oDevice;
oDevice[ "Type" ] = "HP";
oDevice[ "Channels" ] = ui->lineEdit_headphone_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 RedstartSessionBinauralHeadphonesDialog::on_pushButton_CreateSession_clicked()
{
accept();
close();
}
void RedstartSessionBinauralHeadphonesDialog::on_pushButton_BrowseDemoSound_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_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 );
}
}
}
......@@ -33,9 +33,16 @@ public:
~RedstartSessionBinauralHeadphonesDialog();
QVariantHash GetCoreConfig() const;
private slots:
void on_pushButton_CreateSession_clicked();
void on_pushButton_BrowseDemoSound_clicked();
void on_pushButton_BrowseHRIR_clicked();
private:
Ui::RedstartDialogSessionBinauralHeadphones* ui;
QDir m_oBasePath;
QDir m_oLastBasePath;
QDir m_oHRIRBasePath;
QDir m_oDemoSoundBasePath;
QString m_sFileBaseName;
QSettings m_qSettings;
};
......
......@@ -561,8 +561,9 @@ void RedstartWindow::on_actionBinauralHeadphones_triggered()
RedstartSessionBinauralHeadphonesDialog d( this );
if( d.exec() )
{
d.GetCoreConfig();
QVariantHash oCoreConfig = d.GetCoreConfig();
// add session
return;
}
}
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>609</width>
<height>240</height>
<width>576</width>
<height>209</height>
</rect>
</property>
<property name="windowTitle">
......@@ -16,41 +16,30 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Headphone channels</string>
<string>Demo sound</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<item row="6" column="1" colspan="2">
<widget class="QCheckBox" name="checkBox_folders_as_search_path">
<property name="text">
<string>DefaultHRIR macro value</string>
<string>Add all base folders as search paths (instead of using absolute paths)</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="lineEdit_macro_DemoSound">
<property name="text">
<string>WelcomeToVA.wav</string>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="pushButton_BrowseDemoSound">
<item row="2" column="3">
<widget class="QPushButton" name="pushButton_BrowseHRIR">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>DemoSound macro label</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="lineEdit_macro_DefaultHRIR">
<property name="sizePolicy">
......@@ -64,27 +53,17 @@
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButton_BrowseHRIR">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QCheckBox" name="checkBox_folders_as_search_path">
<widget class="QLineEdit" name="lineEdit_headphone_channels">
<property name="text">
<string>Add all base folders as search paths (instead of using absolute paths)</string>
</property>
<property name="checked">
<bool>true</bool>
<string>1,2</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QLineEdit" name="lineEdit_headphone_channels">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>1,2</string>
<string>Session name</string>
</property>
</widget>
</item>
......@@ -95,13 +74,6 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Session name</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="toolTip">
......@@ -115,8 +87,8 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_hrir_filter_length">
<item row="3" column="2">
<widget class="QLabel" name="label_6">
<property name="toolTip">
<string>The filter length is only used to define the convolution engine length. Use a power of 2 and at least the filter length of your HRIR.</string>
</property>
......@@ -124,20 +96,48 @@
<string/>
</property>
<property name="text">
<string>256</string>
<string>Samples</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_6">
<property name="toolTip">
<string>The filter length is only used to define the convolution engine length. Use a power of 2 and at least the filter length of your HRIR.</string>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Default HRIR</string>
</property>
<property name="statusTip">
<string/>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="lineEdit_macro_DemoSound">
<property name="text">
<string>WelcomeToVA.wav</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="pushButton_BrowseDemoSound">
<property name="text">
<string>Samples</string>
<string>Select</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Headphone channels</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="spinBox_hrir_filter_length">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>99999999</number>
</property>
<property name="value">
<number>256</number>
</property>
</widget>
</item>
......
......@@ -65,8 +65,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1023</width>
<height>661</height>
<width>1025</width>
<height>658</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,0,0,0,1">
......@@ -865,6 +865,9 @@ background-color: rgb(208, 255, 188);</string>
<property name="text">
<string>Import session from file</string>
</property>
<property name="shortcut">
<string>N, I</string>
</property>
</action>
<action name="actionClose_session">
<property name="enabled">
......@@ -873,6 +876,9 @@ background-color: rgb(208, 255, 188);</string>
<property name="text">
<string>Close session</string>
</property>
<property name="shortcut">
<string>S, C</string>
</property>
</action>
<action name="actionSave_sesion_as">
<property name="enabled">
......@@ -881,6 +887,9 @@ background-color: rgb(208, 255, 188);</string>
<property name="text">
<string>Save session as ...</string>
</property>
<property name="shortcut">
<string>S, S</string>
</property>
</action>
<action name="actionQuit">
<property name="text">
......@@ -891,76 +900,142 @@ background-color: rgb(208, 255, 188);</string>
<property name="text">
<string>Session wizard</string>
</property>
<property name="shortcut">
<string>N, W</string>
</property>
</action>
<action name="actionRunSimpleExample">
<property name="text">
<string>Simple example</string>
</property>
<property name="toolTip">
<string>Run a simple example scene</string>
</property>
<property name="shortcut">
<string>R, S</string>
</property>
</action>
<action name="actionWebsite">
<property name="text">
<string>Official website</string>
</property>
<property name="toolTip">
<string>Open the official VirtualAcoustics website</string>
</property>
<property name="shortcut">
<string>H, W</string>
</property>
</action>
<action name="actionAbout_Redstart">
<property name="text">
<string>About</string>
</property>
<property name="shortcut">
<string>?</string>
</property>
</action>
<action name="actionEmpty_session">
<property name="text">
<string>Empty session</string>
</property>
<property name="toolTip">
<string>Create an empty session</string>
</property>
<property name="shortcut">
<string>N, N</string>
</property>
</action>
<action name="actionBinauralHeadphones">
<property name="text">
<string>Binaural headphones</string>
</property>
<property name="toolTip">
<string>Create a new binaural session for headphones</string>
</property>
<property name="shortcut">
<string>N, B</string>
</property>
</action>
<action name="actionDefault_experimental_session">
<property name="text">
<string>Experimental</string>
</property>
<property name="toolTip">
<string>Create an experimental session for an arbitrary number of channels</string>
</property>
<property name="shortcut">
<string>N, E</string>
</property>
</action>
<action name="actionExport_to_file">
<property name="text">
<string>Export session to file</string>
</property>
<property name="toolTip">
<string>Export current session to file</string>
</property>
<property name="shortcut">
<string>S, F</string>
</property>
</action>
<action name="actionRemove">
<property name="text">
<string>Remove session</string>
</property>
<property name="shortcut">
<string>S, R</string>
</property>
</action>
<action name="actionPreferences">
<property name="text">
<string>Preferences</string>
</property>
<property name="shortcut">
<string>P</string>
</property>
</action>
<action name="actionGet_started">
<property name="text">
<string>Get started</string>
</property>
<property name="shortcut">
<string>H, S</string>
</property>
</action>
<action name="actionDocumentation">
<property name="text">
<string>Documentation</string>
</property>
<property name="shortcut">
<string>H, D</string>
</property>
</action>
<action name="actionGet_help">
<property name="text">
<string>Get help</string>
</property>
<property name="shortcut">
<string>H, H</string>
</property>
</action>
<action name="actionEdit_session">
<property name="text">
<string>Edit session</string>
</property>
<property name="shortcut">
<string>S, E</string>
</property>
</action>
<action name="actionExport_VA_core_configuration">
<property name="text">
<string>Export VA configuration</string>
</property>
<property name="toolTip">
<string>Export VA configuration from current session</string>
</property>
<property name="shortcut">
<string>S, C</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
......
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