RedstartWindow.cpp 44.5 KB
Newer Older
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 *  --------------------------------------------------------------------------------------------
 *
 *    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
 *
 *  --------------------------------------------------------------------------------------------
 */

14
#include <QErrorMessage>
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
15
#include <QUrl>
16
17
#include <QDesktopServices>
#include <QHash>
Dipl.-Ing. Jonas Stienen's avatar
Mooore    
Dipl.-Ing. Jonas Stienen committed
18
#include <QShortcut>
19
#include <QFileDialog>
20

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
21
22
23
#include "RedstartWindow.h"
#include <ui_RedstartWindow.h>

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
24
25
#include "RedstartRunSimpleExample.h"
#include "RedstartSessionBinauralHeadphonesDialog.h"
26
#include "RedstartSessionExperimentalTalkthroughDialog.h"
27
#include "RedstartSessionImportDialog.h"
28
#include "RedstartSessionWizardDialog.h"
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
29
#include "RedstartUtils.h"
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
30
#include "RedstartCoreOutputPlainTextEdit.h"
31
#include "RedstartRunCirculatingSourceDialog.h"
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
32

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
33
34
35
36
#include <VA.h>
#include <VACore.h>
#include <VANet.h>

37
#include <ITAAsioInterface.h>
38
#include <ITAPortaudioInterface.h>
39
#include <ITAException.h>
40
#include <ITANumericUtils.h>
41
42


43
RedstartWindow::RedstartWindow( bool bFailSafeMode, bool bAutoStart, bool bSkipConfig, QWidget* pParent )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
44
45
	: QMainWindow( pParent )
	, ui( new Ui::RedstartWindow )
46
	, m_pVAInterface( NULL )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
47
48
49
{
	ui->setupUi( this );

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
50
51
	ui->statusBar->showMessage( "Welcome to VA." );

Dipl.-Ing. Jonas Stienen's avatar
Mooore    
Dipl.-Ing. Jonas Stienen committed
52
53
54
55
56
57
58
59
60
61
62
	// Shortcuts
	QShortcut* start_b = new QShortcut( this );
	start_b->setKey( Qt::Key_F5 );
	start_b->setContext( Qt::WindowShortcut );
	QShortcut* start_c = new QShortcut( this );
	start_c->setKey( QKeySequence( tr( "CTRL+R" ) ) );
	start_c->setContext( Qt::WindowShortcut );

	connect( start_b, SIGNAL( activated() ), this, SLOT( on_pushButton_start_stop_clicked() ) );
	connect( start_c, SIGNAL( activated() ), this, SLOT( on_pushButton_start_stop_clicked() ) );

63
64
65
	m_pVANetServer = IVANetServer::Create();
	m_pVANetClient = IVANetClient::Create();

66
67
68
	ui->comboBox_audio_driver->addItem( "ASIO" );
	ui->comboBox_audio_driver->addItem( "Portaudio" );

69
70
71
72
73
74
	ui->comboBox_audio_iface_sampling_rate->addItem( "44.1 kHz", AudioSamplingRate::FS_44kHz );
	ui->comboBox_audio_iface_sampling_rate->addItem( "48 kHz", AudioSamplingRate::FS_48kHz );
	//ui->comboBox_audio_iface_sampling_rate->addItem( "96 kHz", AudioSamplingRate::FS_96kHz );

	ui->comboBox_audio_iface_buffer_size->addItem( "AUTO", AudioBufferSize::AUTO );

75
76
77
78
79
80
81
82
83
	m_pPathsModel = new QStringListModel( ui->listView_paths );
	ui->listView_paths->setModel( m_pPathsModel );

	m_pMacrosModel = new QStringListModel( ui->listView_macros );
	ui->listView_macros->setModel( m_pMacrosModel );

	m_pNetServerClientsModel = new QStringListModel( ui->listView_server_connected_clients );
	ui->listView_server_connected_clients->setModel( m_pNetServerClientsModel );

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
84
	m_iPortaudioDefaultDevice = -1;
85

86
87
88
89
90
91
	if( !m_qSettings.contains( "first_start" ) || m_qSettings.value( "first_start" ) == true )
	{
		m_qSettings.setValue( "first_start", false );
		ui->comboBox_audio_driver->setCurrentIndex( 1 );
	}

92
93
	if( !bSkipConfig )
		LoadConfiguration();
94

95
	// Signals & slots
96
	ConnectSignalsAndSlots();
97

98
99
	ui->menuRun->setEnabled( false );

100
101
	if( ui->checkBox_redstart_network_connect_as_client->isChecked() )
		ui->groupBox_redstart_audio_iface->setEnabled( false );
102

103
104
105
	if( ( ui->checkBox_redstart_auto_start->isChecked() || bAutoStart ) && !bFailSafeMode )
		on_pushButton_start_stop_clicked();

106
107
	m_pCirculatingSourceDialog = new RedstartRunCirculatingSourceDialog( this );

108
109
110
	m_qSporadicTimer.setTimerType( Qt::TimerType::VeryCoarseTimer );
	m_qSporadicTimer.setInterval( m_qSettings.value( "sporadic_timeout_interval", 200 ).toInt() );
	m_qSporadicTimer.start();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
111
112
113
114
}

RedstartWindow::~RedstartWindow()
{
115
116
	m_qSporadicTimer.stop();

117
	StoreConfiguration();
118

119
120
121
122
123
124
125
126
127
128
	if( m_pVANetServer->IsClientConnected() )
	{
		m_pVANetServer->Finalize();
		delete m_pVAInterface;
	}
	delete m_pVANetServer;

	if( m_pVANetClient->IsConnected() )
		m_pVANetClient->Disconnect();
	delete m_pVANetClient;
129
130
131

	delete m_pPathsModel;
	delete m_pMacrosModel;
132
133
}

134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
void RedstartWindow::ConnectSignalsAndSlots()
{
	// Input control
	connect( ui->doubleSpinBox_input_gain, SIGNAL( valueChanged( double ) ), this, SLOT( CoreChangeInputSignalDecibel( double ) ) );
	connect( this, SIGNAL( InputSignalChangedDecibel( double ) ), ui->doubleSpinBox_input_gain, SLOT( setValue( double ) ) );
	connect( ui->dial_core_control_input_gain, SIGNAL( valueChanged( int ) ), this, SLOT( CoreChangeInputSignalDecibel( int ) ) );
	connect( this, SIGNAL( InputSignalChangedDecibel( int ) ), ui->dial_core_control_input_gain, SLOT( setValue( int ) ) );
	connect( this, SIGNAL( InputIsMutedChanged( bool ) ), ui->checkBox_core_control_input_mute, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_core_control_input_mute, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeInputIsMuted( int ) ) );

	// Output control
	connect( ui->doubleSpinBox_output_gain, SIGNAL( valueChanged( double ) ), this, SLOT( CoreChangeOutputSignalDecibel( double ) ) );
	connect( this, SIGNAL( OutputSignalChangedDecibel( double ) ), ui->doubleSpinBox_output_gain, SLOT( setValue( double ) ) );
	connect( ui->dial_core_control_output_gain, SIGNAL( valueChanged( int ) ), this, SLOT( CoreChangeOutputSignalDecibel( int ) ) );
	connect( this, SIGNAL( OutputSignalChangedDecibel( int ) ), ui->dial_core_control_output_gain, SLOT( setValue( int ) ) );
	connect( this, SIGNAL( OutputIsMutedChanged( bool ) ), ui->checkBox_core_control_output_mute, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_core_control_output_mute, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeOutputIsMuted( int ) ) );

152
153
154
155
	// Auralization modes
	connect( this, SIGNAL( GlobalAuralizationModeChanged( int ) ), this, SLOT( CoreChangeGlobalAuralizationMode( int ) ) );
	connect( this, SIGNAL( AuralizationModeDSChanged( bool ) ), ui->checkBox_am_ds, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_am_ds, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeAuralizationModeDS( int ) ) );
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
	connect( this, SIGNAL( AuralizationModeERChanged( bool ) ), ui->checkBox_am_er, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_am_er, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeAuralizationModeER( int ) ) );
	connect( this, SIGNAL( AuralizationModeDDChanged( bool ) ), ui->checkBox_am_dd, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_am_dd, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeAuralizationModeDD( int ) ) );
	connect( this, SIGNAL( AuralizationModeDIRChanged( bool ) ), ui->checkBox_am_dir, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_am_dir, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeAuralizationModeDIR( int ) ) );
	connect( this, SIGNAL( AuralizationModeDPChanged( bool ) ), ui->checkBox_am_dp, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_am_dp, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeAuralizationModeDP( int ) ) );
	connect( this, SIGNAL( AuralizationModeSLChanged( bool ) ), ui->checkBox_am_sl, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_am_sl, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeAuralizationModeSL( int ) ) );
	connect( this, SIGNAL( AuralizationModeDIFChanged( bool ) ), ui->checkBox_am_dif, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_am_dif, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeAuralizationModeDIF( int ) ) );
	connect( this, SIGNAL( AuralizationModeSCChanged( bool ) ), ui->checkBox_am_sca, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_am_sca, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeAuralizationModeSC( int ) ) );
	connect( this, SIGNAL( AuralizationModeNFChanged( bool ) ), ui->checkBox_am_nf, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_am_nf, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeAuralizationModeNF( int ) ) );
	connect( this, SIGNAL( AuralizationModeTVChanged( bool ) ), ui->checkBox_am_tv, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_am_tv, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeAuralizationModeTV( int ) ) );
	connect( this, SIGNAL( AuralizationModeMAChanged( bool ) ), ui->checkBox_am_ma, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_am_ma, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeAuralizationModeMA( int ) ) );
	connect( this, SIGNAL( AuralizationModeABChanged( bool ) ), ui->checkBox_am_ab, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_am_ab, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeAuralizationModeAB( int ) ) );
	connect( this, SIGNAL( AuralizationModeTRChanged( bool ) ), ui->checkBox_am_tr, SLOT( setChecked( bool ) ) );
	connect( ui->checkBox_am_tr, SIGNAL( stateChanged( int ) ), this, SLOT( CoreChangeAuralizationModeTR( int ) ) );
180
181
182
183

	connect( ui->comboBox_core_settings_log_level, SIGNAL( currentIndexChanged( int ) ), this, SLOT( CoreChangeLogLevel( int ) ) );

	connect( &m_qSporadicTimer, SIGNAL( timeout() ), this, SLOT( SporadicTimeout() ) );
184
185
	connect( &m_qSporadicTimer, SIGNAL( timeout() ), ui->graphicsView_input_levels, SLOT( UpdateLevels() ) );
	connect( &m_qSporadicTimer, SIGNAL( timeout() ), ui->graphicsView_output_levels, SLOT( UpdateLevels() ) );
186
187
188

}

189
190
191
192
void RedstartWindow::LoadConfiguration()
{
	RestoreWindowSize();

193
194
	bool bValOK;
	int iAudioBackend = m_qSettings.value( "Redstart/audio/backend_idx" ).toInt( &bValOK );
195
196
197
	if( !bValOK )
		iAudioBackend = AudioBackend::ASIO;
	ui->comboBox_audio_driver->setCurrentIndex( iAudioBackend );
198

199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
	const int iBufferSizeIndex = m_qSettings.value( "Redstart/audio/buffersize_idx" ).toInt( &bValOK );
	if( bValOK && iBufferSizeIndex < ui->comboBox_audio_iface_buffer_size->count() )
		ui->comboBox_audio_iface_buffer_size->setCurrentIndex( iBufferSizeIndex );

	const int iSamplingRateIndex = m_qSettings.value( "Redstart/audio/fs_idx" ).toInt( &bValOK );
	if( bValOK && iSamplingRateIndex < ui->comboBox_audio_iface_sampling_rate->count() )
		ui->comboBox_audio_iface_sampling_rate->setCurrentIndex( iSamplingRateIndex );

	if( m_qSettings.contains( "Redstart/network/address" ) )
		ui->lineEdit_redstart_network_address->setText( m_qSettings.value( "Redstart/network/address" ).toString() );
	if( m_qSettings.contains( "Redstart/network/port" ) )
		ui->lineEdit_redstart_network_address->setText( m_qSettings.value( "Redstart/network/port" ).toString() );
	ui->checkBox_redstart_network_connect_as_client->setChecked( m_qSettings.value( "Redstart/network/client_mode" ).toBool() );

	if( m_qSettings.contains( "Redstart/autostart" ) )
214
215
216
217
	{
		bool bAutostart = m_qSettings.value( "Redstart/autostart" ).toBool();
		ui->checkBox_redstart_auto_start->setChecked( bAutostart );
	}
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
218

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
219
220
221
	m_iPortaudioDefaultDevice = m_qSettings.value( "Redstart/audio/portaudio_default_device", -1 ).toInt();

	ui->checkBox_portaudio_default_device->setChecked( m_qSettings.value( "Redstart/audio/portaudio_use_default_device", true ).toBool() );
222

223
224
225
226
227
228
229
	QVariantList voAudioDevices;
	voAudioDevices = m_qSettings.value( "Redstart/audio/devicelist" ).toList();

	for( const QVariant oAudioDevice : voAudioDevices )
		m_voAudioDevices.push_back( CAudioDeviceSpecs( oAudioDevice.toHash() ) );

	PopulateAudioDevices();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
230
231
232
233

	int iLastDevice = m_qSettings.value( "Redstart/audio/current_device", 0 ).toInt( &bValOK );
	if( bValOK && ui->comboBox_audio_iface_device->count() >= iLastDevice )
		ui->comboBox_audio_iface_device->setCurrentIndex( iLastDevice );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
234

235
236
237
238
239
240
241
	// Core control
	ui->comboBox_core_settings_log_level->addItem( QString::fromStdString( m_pVAInterface->GetLogLevelStr( IVAInterface::VA_LOG_LEVEL_QUIET ) ) );
	ui->comboBox_core_settings_log_level->addItem( QString::fromStdString( m_pVAInterface->GetLogLevelStr( IVAInterface::VA_LOG_LEVEL_ERROR ) ) );
	ui->comboBox_core_settings_log_level->addItem( QString::fromStdString( m_pVAInterface->GetLogLevelStr( IVAInterface::VA_LOG_LEVEL_WARNING ) ) );
	ui->comboBox_core_settings_log_level->addItem( QString::fromStdString( m_pVAInterface->GetLogLevelStr( IVAInterface::VA_LOG_LEVEL_INFO ) ) );
	ui->comboBox_core_settings_log_level->addItem( QString::fromStdString( m_pVAInterface->GetLogLevelStr( IVAInterface::VA_LOG_LEVEL_VERBOSE ) ) );
	ui->comboBox_core_settings_log_level->addItem( QString::fromStdString( m_pVAInterface->GetLogLevelStr( IVAInterface::VA_LOG_LEVEL_TRACE ) ) );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
242

Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
243
244
	if( ui->listView_redstart_session_list->GetCurrentSessionID().isEmpty() == false )
		ui->treeView_session_details->SetStruct( ui->listView_redstart_session_list->GetCurrentConfig() );
245
246
247
248
249
250
251
}

void RedstartWindow::StoreConfiguration()
{
	m_qSettings.setValue( "Redstart/gui/WindowGeometry", saveGeometry() );
	m_qSettings.setValue( "Redstart/gui/WindowState", saveState() );

252
253
254
255
256
257
258
259
260
261
262
263
264
	m_qSettings.setValue( "Redstart/audio/backend_idx", ui->comboBox_audio_driver->currentIndex() );

	m_qSettings.setValue( "Redstart/audio/buffersize_idx", ui->comboBox_audio_iface_buffer_size->currentIndex() );
	m_qSettings.setValue( "Redstart/audio/fs_idx", ui->comboBox_audio_iface_sampling_rate->currentIndex() );

	m_qSettings.setValue( "Redstart/network/address", ui->lineEdit_redstart_network_address->text() );

	bool bValOK;
	int iPort = ui->lineEdit_redstart_network_address->text().toInt( &bValOK );
	if( bValOK )
		m_qSettings.setValue( "Redstart/network/port", iPort );

	m_qSettings.setValue( "Redstart/network/client_mode", ui->checkBox_redstart_network_connect_as_client->isChecked() );
265

266
267
	bool bAutostart = ui->checkBox_redstart_auto_start->isChecked();
	m_qSettings.setValue( "Redstart/autostart", bAutostart );
268

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
269
270
271
	m_qSettings.setValue( "Redstart/audio/portaudio_default_device", m_iPortaudioDefaultDevice );
	int iLastDevice = ui->comboBox_audio_iface_device->currentIndex();
	m_qSettings.setValue( "Redstart/audio/current_device", iLastDevice );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
272

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
273
	m_qSettings.setValue( "Redstart/audio/portaudio_use_default_device", ui->checkBox_portaudio_default_device->isChecked() );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
274

275
276
277
	QVariantList voAudioDevices;
	for( const CAudioDeviceSpecs& oDevice : m_voAudioDevices )
		voAudioDevices.push_back( oDevice.asHash() );
278

279
	m_qSettings.setValue( "Redstart/audio/devicelist", voAudioDevices );
280
281

	m_qSettings.setValue( "sporadic_timeout_interval", m_qSporadicTimer.interval() );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
282
}
283

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
284
285
286
void RedstartWindow::on_actionQuit_triggered()
{
	close();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
287
288
289
290
291
292
293
}

void RedstartWindow::PostCoreStart()
{
	ui->pushButton_start_stop->setText( "Stop" );

	// Switch UI elements enabled
294
	ui->groupBox_redstart_audio_iface->setEnabled( false );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
295
	ui->groupBox_redstart_network->setEnabled( false );
296
297
	ui->groupBox_session_list->setEnabled( false );
	ui->groupBox_session_details->setEnabled( false );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
298
299
300
	ui->groupBox_core->setEnabled( true );
	ui->groupBox_paths->setEnabled( true );
	ui->groupBox_macros->setEnabled( true );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
301
	ui->menuRun->setEnabled( true );
302
	ui->menuNew_session->setEnabled( false );
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
303
	ui->groupBox_core_control->setEnabled( true );
304
305
306
	ui->graphicsView_input_levels->setEnabled( true );
	ui->graphicsView_output_levels->setEnabled( true );
	ui->groupBox_global_am->setEnabled( true );
307
	ui->groupBox_clients->setEnabled( true );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
308
309

	CVAVersionInfo oVersion;
310
	m_pVAInterface->GetVersionInfo( &oVersion );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
311
312
313
314
	ui->lineEdit_core_settings_version->setText( QString::fromStdString( oVersion.ToString() ) );

	CVAStruct oArgs;
	oArgs[ "getloglevel" ] = true;
315
	oArgs[ "getmacros" ] = true;
316
	const CVAStruct oReturn = m_pVAInterface->CallModule( "VACore", oArgs );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
317
	const int iCurrentLogLevel = oReturn[ "loglevel" ];
318
	ui->comboBox_core_settings_log_level->setCurrentIndex( iCurrentLogLevel );
319
320
321
322
323
324
325
326
327
328

	CVAStruct oSearchPaths = m_pVAInterface->GetSearchPaths();
	QStringList sPathList;
	CVAStruct::const_iterator cit = oSearchPaths.Begin();
	while( cit != oSearchPaths.End() )
	{
		const CVAStructValue& oValue( cit++->second );
		if( oValue.IsString() )
			sPathList << std::string( oValue ).c_str();
	}
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346

	m_pPathsModel->setStringList( sPathList );

	if( oReturn.HasKey( "macros" ) )
	{
		CVAStruct oMacros = oReturn[ "macros" ];
		QStringList sMacrosList;
		CVAStruct::const_iterator cit = oMacros.Begin();
		while( cit != oMacros.End() )
		{
			std::string sName( cit->first );
			const CVAStructValue& oValue( cit++->second );
			if( oValue.IsString() )
				sMacrosList << ( sName + " = " + std::string( oValue ) ).c_str();
		}

		m_pMacrosModel->setStringList( sMacrosList );
	}
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
347
348
349
350
351
352
353
}

void RedstartWindow::PostCoreStop()
{
	ui->pushButton_start_stop->setText( "Start" );

	// Switch UI elements enabled
354
	ui->groupBox_redstart_audio_iface->setEnabled( true );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
355
	ui->groupBox_redstart_network->setEnabled( true );
356
357
	ui->groupBox_session_list->setEnabled( true );
	ui->groupBox_session_details->setEnabled( true );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
358
359
360
	ui->groupBox_core->setEnabled( false );
	ui->groupBox_paths->setEnabled( false );
	ui->groupBox_macros->setEnabled( false );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
361
	ui->menuRun->setEnabled( false );
362
	ui->menuNew_session->setEnabled( true );
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
363
	ui->groupBox_core_control->setEnabled( false );
364
365
366
	ui->graphicsView_input_levels->setEnabled( false );
	ui->graphicsView_output_levels->setEnabled( false );
	ui->groupBox_global_am->setEnabled( false );
367
368
	ui->groupBox_clients->setEnabled( false );
	ui->pushButton_add_local_path->setEnabled( false );
369

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
370

371
372
373
374
375
376
377
378
379
380
381
382
383
	// Clear
	ui->lineEdit_core_settings_version->clear();
	ui->listView_paths->reset();

	// Reset elements
	bool bPreserveCoreControlValues = m_qSettings.value( "PreserveCoreControlValues", true ).toBool(); // @todo control this setting via preferences dialog
	if( !bPreserveCoreControlValues )
	{
		emit InputSignalChangedDecibel( 0.0f );
		emit OutputSignalChangedDecibel( 0.0f );
		emit InputIsMutedChanged( false );
		emit OutputIsMutedChanged( false );
	}
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
384
}
385
386
387
388
389
390
391

void RedstartWindow::RestoreWindowSize()
{
	restoreGeometry( m_qSettings.value( "Redstart/gui/WindowGeometry" ).toByteArray() );
	restoreState( m_qSettings.value( "Redstart/gui/WindowState" ).toByteArray() );
}

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
392
393
394
395
396
void RedstartWindow::HandleVAEvent( const CVAEvent* pEvent )
{
	// Handle pushable events
	switch( pEvent->iEventType )
	{
397
	case CVAEvent::PROGRESS_UPDATE:
398
		//ui->statusBar->showMessage( pEvent->sParam.c_str() );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
399
		break;
400
	case CVAEvent::MEASURES_UPDATE:
401
402
403
404
405
406
		if( pEvent->sParam == "RenderingModule" )
			; // @todo update rendering module GUI for sObjectID
		else if( pEvent->sParam == "ReproductionModule" )
			; // @todo update reproduction module GUI for sObjectID
		else if( pEvent->sParam.empty() )
			UpdateMeasures( pEvent->vfInputRMSs, pEvent->vfInputPeaks, pEvent->vfOutputRMSs, pEvent->vfOutputPeaks ); // Core i/o
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
407
408
409
		break;
	}

410
	/* Don't handle events that have been triggered from this interface connection
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
411
	if( pEvent->pSender == m_pVAInterface )
412
413
	return;
	*/
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
414

415
416
	switch( pEvent->iEventType )
	{
417
	case CVAEvent::GLOBAL_AURALIZATION_MODE_CHANGED:
418
419
420
421
		emit GlobalAuralizationModeChanged( pEvent->iAuralizationMode );
		break;
	}

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
422
423
	switch( pEvent->iEventType )
	{
424
	case CVAEvent::INPUT_GAIN_CHANGED:
425
		emit InputSignalChangedDecibel( ratio_to_db20( pEvent->dVolume ) );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
426
		break;
427
	case CVAEvent::OUTPUT_GAIN_CHANGED:
428
		emit OutputSignalChangedDecibel( ratio_to_db20( pEvent->dVolume ) );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
429
		break;
430
	case CVAEvent::INPUT_MUTING_CHANGED:
431
		emit InputIsMutedChanged( pEvent->bMuted );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
432
		break;
433
	case CVAEvent::OUTPUT_MUTING_CHANGED:
434
		emit OutputIsMutedChanged( pEvent->bMuted );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
435
436
437
438
439
440
		break;
	}
}

void RedstartWindow::UpdateMeasures( const std::vector< float >& vfInputRMSs, const std::vector< float >& vfInputPeaks, const std::vector< float >& vfOutputRMSs, const std::vector< float >& vfOutputPeaks )
{
441
	int iNumInputChannels = ( int ) vfInputRMSs.size();
442
443
444
445
446
447
448
449
450
451
452
453
	assert( vfInputRMSs.size() == vfInputPeaks.size() );
	if( ui->graphicsView_input_levels->GetNumChannels() != iNumInputChannels )
		ui->graphicsView_input_levels->SetNumChannels( iNumInputChannels );

	ui->graphicsView_input_levels->SetRMSs( vfInputRMSs );
	ui->graphicsView_input_levels->SetPeaks( vfInputPeaks );

	int iNumOutputChannels = ( int ) vfOutputRMSs.size();
	assert( vfOutputRMSs.size() == vfOutputPeaks.size() );
	if( ui->graphicsView_output_levels->GetNumChannels() != iNumOutputChannels )
		ui->graphicsView_output_levels->SetNumChannels( iNumOutputChannels );

454
455
	ui->graphicsView_output_levels->SetRMSs( vfOutputRMSs );
	ui->graphicsView_output_levels->SetPeaks( vfOutputPeaks );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
456
457
}

458
459
void RedstartWindow::AcquireAsioDevices()
{
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
460
461
	std::vector< CAudioDeviceSpecs > voAudioDevices = m_voAudioDevices;

462
463
464
465
466
467
468
469
	try
	{
		ITAsioInitializeLibrary();

		long lDrivers = ITAsioGetNumDrivers();
		if( lDrivers <= 0 )
			ITA_EXCEPT1( INVALID_PARAMETER, "No ASIO-compatibel drivers could be found on this system." );

470
		m_voAudioDevices.clear();
471
472
473
474
475

		for( long i = 0; i < lDrivers; i++ )
		{
			CAudioDeviceSpecs oDeviceSpecs;
			oDeviceSpecs.iDriverNumber = i;
476
			oDeviceSpecs.iBackend = AudioBackend::ASIO;
477
478
479
480
481
482
			oDeviceSpecs.sName = ITAsioGetDriverName( i );

			try
			{
				ITAsioInitializeDriver( i );

483
484
				long in = 0;
				long out = 0;
485
486
				ITAsioGetChannels( &in, &out );
				oDeviceSpecs.iNumInputChannels = int( in );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
487
				oDeviceSpecs.iNumOutputChannels = int( out );
488
489
490
491
492
493
494
495
496
497
498
499
500

				ITAsioFinalizeDriver();

				oDeviceSpecs.bInitializable = true;

			}
			catch( const ITAException& )
			{
				oDeviceSpecs.bInitializable = false;
				continue;
			}

			if( oDeviceSpecs.bInitializable )
501
				m_voAudioDevices.push_back( oDeviceSpecs );
502
503
504
505
506
507
508
509
510
511
512
513
		}

		ITAsioFinalizeLibrary();
	}
	catch( const ITAException& e )
	{
		QString sErrorMessage = QString( "Error during ASIO device acquisition: %1" ).arg( QString::fromStdString( e.ToString() ) );
		QErrorMessage oErrMsg;
		oErrMsg.showMessage( sErrorMessage );
		oErrMsg.exec();
	}

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
514
515
516
	for( const CAudioDeviceSpecs oDevice : voAudioDevices )
		if( oDevice.iBackend != AudioBackend::ASIO )
			m_voAudioDevices.push_back( oDevice );
517
518
}

519
520
521
void RedstartWindow::PopulateAudioDevices()
{
	ui->comboBox_audio_iface_device->clear();
522
	int iCurrentBackend = ui->comboBox_audio_driver->currentIndex();
523
524
	for( const CAudioDeviceSpecs& oDevice : m_voAudioDevices )
	{
525
526
527
528
529
530
531
532
533
		if( oDevice.iBackend == iCurrentBackend )
			ui->comboBox_audio_iface_device->addItem( oDevice.sName, QVariant( oDevice.iDriverNumber ) );
	}

	if( ui->comboBox_audio_driver->currentIndex() == AudioBackend::PORTAUDIO )
	{
		ui->checkBox_portaudio_default_device->setEnabled( true );
		if( ui->checkBox_portaudio_default_device->isChecked() )
			ui->comboBox_audio_iface_device->setEnabled( false );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
534
535
		else
			ui->comboBox_audio_iface_device->setEnabled( true );
536
537
538
539
540
	}
	else
	{
		ui->checkBox_portaudio_default_device->setEnabled( false );
		ui->comboBox_audio_iface_device->setEnabled( true );
541
542
543
	}
}

544
545
void RedstartWindow::AcquirePortaudioDevices()
{
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
	std::vector< CAudioDeviceSpecs > voAudioDevices = m_voAudioDevices;

	try
	{
		ITAPortaudioInterface oPortaudio( 44100, 1024 );
		oPortaudio.Initialize();
		int lDrivers = oPortaudio.GetNumDevices();

		if( lDrivers <= 0 )
			ITA_EXCEPT1( INVALID_PARAMETER, "No Portaudio output devices could be found on this system." );

		m_iPortaudioDefaultDevice = oPortaudio.GetDefaultOutputDevice();

		m_voAudioDevices.clear();

		for( long i = 0; i < lDrivers; i++ )
		{
			CAudioDeviceSpecs oDeviceSpecs;
			oDeviceSpecs.iDriverNumber = i;
			oDeviceSpecs.iBackend = AudioBackend::PORTAUDIO;
			oDeviceSpecs.sName = oPortaudio.GetDeviceName( i ).c_str();
567

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
568
569
570
571
572
573
574
575
576
577
			try
			{
				oPortaudio.GetNumChannels( i, oDeviceSpecs.iNumInputChannels, oDeviceSpecs.iNumOutputChannels );

				oDeviceSpecs.bInitializable = true; // only a guess

				if( i == oPortaudio.GetDefaultOutputDevice() )
					oDeviceSpecs.bDefaultDevice = true;
				else
					oDeviceSpecs.bDefaultDevice = false;
578

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
			}
			catch( const ITAException& )
			{
				oDeviceSpecs.bInitializable = false;
				continue;
			}

			if( oDeviceSpecs.bInitializable )
				m_voAudioDevices.push_back( oDeviceSpecs );
		}

		oPortaudio.Finalize();
	}
	catch( const ITAException& e )
	{
		QString sErrorMessage = QString( "Error during Portaudio device acquisition: %1" ).arg( QString::fromStdString( e.ToString() ) );
		QErrorMessage oErrMsg;
		oErrMsg.showMessage( sErrorMessage );
		oErrMsg.exec();
	}

	for( const CAudioDeviceSpecs oDevice : voAudioDevices )
		if( oDevice.iBackend != AudioBackend::ASIO )
			m_voAudioDevices.push_back( oDevice );
603
604
}

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
605
void RedstartWindow::on_pushButton_start_stop_clicked()
606
{
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
607
608
	try
	{
609
		if( ui->checkBox_redstart_network_connect_as_client->isChecked() == false )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
610
611
612
613
		{
			if( m_pVAInterface )
			{
				m_pVANetServer->Finalize();
614

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
615
616
617
618
619
620
621
622
623
624
625
				if( m_pVAInterface->GetState() == IVAInterface::VA_CORESTATE_READY )
					m_pVAInterface->Finalize();

				delete m_pVAInterface;
				m_pVAInterface = nullptr;

				ui->statusBar->showMessage( "VA core has been stopped." );
				PostCoreStop();
			}
			else
			{
626
				CVAStruct oVAConfigArgs = ui->listView_redstart_session_list->GetCurrentConfig();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652

				// Override configs
				std::string sBackend, sDevice;
				switch( ui->comboBox_audio_driver->currentIndex() )
				{
				case AudioBackend::ASIO:
				{
					sBackend = "ASIO";
					sDevice = ui->comboBox_audio_iface_device->currentText().toStdString();
					break;
				}
				case AudioBackend::PORTAUDIO:
				default:
				{
					sBackend = "Portaudio";
					if( ui->checkBox_portaudio_default_device->isChecked() )
						sDevice = "default";
					else
						sDevice = ui->comboBox_audio_iface_device->currentIndex();
				}
				}

				oVAConfigArgs[ "Audio driver" ] = CVAStruct();
				oVAConfigArgs[ "Audio driver" ][ "Driver" ] = sBackend;
				oVAConfigArgs[ "Audio driver" ][ "Device" ] = sDevice;

653
654
655
656
				if( !oVAConfigArgs.HasKey( "Paths" ) )
					oVAConfigArgs[ "Paths" ] = CVAStruct();
				oVAConfigArgs[ "Paths" ][ "redstart_data" ] = "data";
				oVAConfigArgs[ "Paths" ][ "redstart_data_dev" ] = "../VACore/data";
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
657

658
				m_pVAInterface = VACore::CreateCoreInstance( oVAConfigArgs, ui->plainTextEdit_core_output->GetOutputStream() );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
659

660
				m_pVAInterface->Initialize();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
661
				m_pVAInterface->AttachEventHandler( this );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
662
663
664
665
666
667
668
669
670
671
672
673
				m_pVANetServer->SetCoreInstance( m_pVAInterface );

				bool bOK;
				int iPort = ui->lineEdit_redstart_network_port->text().toInt( &bOK );
				int iStatus = -1;
				if( bOK )
					iStatus = m_pVANetServer->Initialize( ui->lineEdit_redstart_network_address->text().toStdString(), iPort );
				else
					iStatus = m_pVANetServer->Initialize( ui->lineEdit_redstart_network_address->text().toStdString() );

				if( m_pVAInterface->GetState() == IVAInterface::VA_CORESTATE_READY && iStatus == IVANetServer::VA_NO_ERROR )
				{
674
					ui->statusBar->showMessage( "VA core successfully initialized and network server started. Running session " + ui->listView_redstart_session_list->GetCurrentSessionID() + "." );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
675

676
677
					ui->pushButton_add_local_path->setEnabled( true );

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
					PostCoreStart();
				}
				else
				{
					ui->statusBar->showMessage( "VA core initialization failed." );
					m_pVANetServer->Finalize();

					delete m_pVAInterface;
					m_pVAInterface = NULL;
				}
			}
		}
		else
		{
			// Client mode
			if( m_pVANetClient->IsConnected() )
				m_pVANetClient->Disconnect();

			bool bOK;
			int iPort = ui->lineEdit_redstart_network_port->text().toInt( &bOK );
			int iStatus = -1;
			if( bOK )
				iStatus = m_pVANetClient->Initialize( ui->lineEdit_redstart_network_address->text().toStdString(), iPort );
			else
				iStatus = m_pVANetClient->Initialize( ui->lineEdit_redstart_network_address->text().toStdString() );
703

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
704
705
706
707
708
709
710
			if( iStatus != IVANetClient::VA_NO_ERROR )
			{
				VA_EXCEPT2( INVALID_PARAMETER, "Could not initialize client, connection failed." );
			}

			m_pVAInterface = m_pVANetClient->GetCoreInstance();

711
712
			ui->pushButton_add_local_path->setEnabled( false );

Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
713
			// @todo attach network event handler to detect server connection loss or abortion
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
714
715
716
717
718
			//m_pVANetClient->AttachEventHandler( this );
		}
	}
	catch( const CVAException& ex )
	{
Dipl.-Ing. Jonas Stienen's avatar
Mooore    
Dipl.-Ing. Jonas Stienen committed
719
720
721
722
723
724
725

		if( m_pVAInterface )
		{
			delete m_pVAInterface;
			m_pVAInterface = NULL;
		}

726
		ui->statusBar->showMessage( QString::fromStdString( ex.ToString() ) + ". Will deactivate auto-start checkbox." );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
727
728
		ui->checkBox_redstart_auto_start->setChecked( false );
	}
729
}
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745

void RedstartWindow::on_pushButton_refresh_clicked()
{
	const int iAudioBackend = ui->comboBox_audio_driver->currentIndex();
	if( iAudioBackend == AudioBackend::PORTAUDIO )
	{
		AcquirePortaudioDevices();
	}
	else
	{
		AcquireAsioDevices();
	}

	PopulateAudioDevices();
}

Dipl.-Ing. Jonas Stienen's avatar
Mooore    
Dipl.-Ing. Jonas Stienen committed
746
void RedstartWindow::on_comboBox_audio_driver_currentIndexChanged( int )
747
748
749
750
{
	PopulateAudioDevices();
}

Dipl.-Ing. Jonas Stienen's avatar
Mooore    
Dipl.-Ing. Jonas Stienen committed
751
void RedstartWindow::on_comboBox_audio_iface_device_currentIndexChanged( int )
752
753
754
{

}
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
755
756
757

void RedstartWindow::on_actionWebsite_triggered()
{
758
759
	QUrl urlVAWebsite( "http://www.virtualacoustics.org/work" );
	QDesktopServices::openUrl( urlVAWebsite );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
760
761
762
763
}

void RedstartWindow::on_actionGet_started_triggered()
{
764
765
	QUrl urlVAWebsiteGetStarted( "http://www.virtualacoustics.org/work/start.html" );
	QDesktopServices::openUrl( urlVAWebsiteGetStarted );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
766
767
768
769
}

void RedstartWindow::on_actionDocumentation_triggered()
{
770
771
	QUrl urlVAWebsiteDocumentation( "http://www.virtualacoustics.org/work/documentation.html" );
	QDesktopServices::openUrl( urlVAWebsiteDocumentation );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
772
773
774
775
}

void RedstartWindow::on_actionGet_help_triggered()
{
776
777
	QUrl urlVAWebsiteGetHelp( "http://www.virtualacoustics.org/work/help.html" );
	QDesktopServices::openUrl( urlVAWebsiteGetHelp );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
778
}
779
780
781
782
783
784
785
786
787
788
789
790

void RedstartWindow::on_checkBox_redstart_network_connect_as_client_clicked()
{
	if( ui->checkBox_redstart_network_connect_as_client->isChecked() )
		ui->groupBox_redstart_audio_iface->setEnabled( false );
	else
		ui->groupBox_redstart_audio_iface->setEnabled( true );
}

void RedstartWindow::on_checkBox_portaudio_default_device_clicked()
{
	if( ui->checkBox_portaudio_default_device->isChecked() )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
791
	{
792
		ui->comboBox_audio_iface_device->setEnabled( false );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
793
794
795
		if( ui->comboBox_audio_iface_device->count() >= m_iPortaudioDefaultDevice )
			ui->comboBox_audio_iface_device->setCurrentIndex( m_iPortaudioDefaultDevice );
	}
796
797
798
799
	else
		ui->comboBox_audio_iface_device->setEnabled( true );
}

800
void RedstartWindow::on_listView_redstart_session_list_clicked( const QModelIndex &index )
801
{
Dipl.-Ing. Jonas Stienen's avatar
Mooore    
Dipl.-Ing. Jonas Stienen committed
802
803
804
805
806
807
	if( ui->listView_redstart_session_list->model()->data( index ).isValid() )
	{
		std::string sSessionName = ui->listView_redstart_session_list->model()->data( index ).toString().toStdString();
		CVAStruct oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
		ui->treeView_session_details->SetStruct( oStruct );
	}
808
}
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
809
810
811
812
813

void RedstartWindow::on_actionBinauralHeadphones_triggered()
{
	RedstartSessionBinauralHeadphonesDialog d( this );
	if( d.exec() )
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
814
	{
815
816
817
818
819
820
		// Enforce unique session id if id is already existing
		QString sNewID = d.GetSessionName();
		while( ui->listView_redstart_session_list->SessionNameExists( sNewID ) )
			sNewID += "_new";
		ui->listView_redstart_session_list->AddSession( sNewID, d.GetCoreConfig() ); // In any case save the session so no data is lost

Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
821
822
		CVAStruct oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
		ui->treeView_session_details->SetStruct( oStruct );
823
824
825

		if( d.GetStartImmediately() )
			on_pushButton_start_stop_clicked();
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
826
	}
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
827
828
}

829
830
831
832
833
void RedstartWindow::on_actionImport_session_triggered()
{
	RedstartSessionImportDialog d( this );
	if( d.exec() )
	{
834
835
836
837
838
839
840
		// Enforce unique session id if id is already existing
		QString sNewID = d.GetSessionName();
		while( ui->listView_redstart_session_list->SessionNameExists( sNewID ) )
			sNewID += "_new";
		ui->listView_redstart_session_list->AddSession( sNewID, d.GetCoreConfig() ); // In any case save the session so no data is lost
		CVAStruct oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
		ui->treeView_session_details->SetStruct( oStruct );
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
841

842
843
		if( d.GetStartImmediately() )
			on_pushButton_start_stop_clicked();
844
845
846
	}
}

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
847
848
void RedstartWindow::on_actionDefault_experimental_session_triggered()
{
849
850
	RedstartSessionExperimentalTalkthroughDialog d( this );
	if( d.exec() )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
851
	{
852
853
854
855
856
857
		// Enforce unique session id if id is already existing
		QString sNewID = d.GetSessionName();
		while( ui->listView_redstart_session_list->SessionNameExists( sNewID ) )
			sNewID += "_new";
		ui->listView_redstart_session_list->AddSession( sNewID, d.GetCoreConfig() ); // In any case save the session so no data is lost

Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
858
859
		CVAStruct oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
		ui->treeView_session_details->SetStruct( oStruct );
860
861
862

		if( d.GetStartImmediately() )
			on_pushButton_start_stop_clicked();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
863
864
	}
}
865
866
867

void RedstartWindow::on_actionCirculating_source_triggered()
{
868
869
	if( !m_pVAInterface )
		return;
870

871
872
873
	m_pCirculatingSourceDialog->SetVAInterface( m_pVAInterface );
	m_pCirculatingSourceDialog->exec();
	m_pCirculatingSourceDialog->hide();
874
}
875
876
877
878
879

void RedstartWindow::on_actionAmbisonics_triggered()
{

}
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921

void RedstartWindow::on_actionExport_to_file_triggered()
{
	QFileDialog fd;
	fd.setNameFilters( QStringList() << "INI files (*.ini)" << "Any file (*.*)" );
	fd.setViewMode( QFileDialog::Detail );
	fd.setAcceptMode( QFileDialog::AcceptSave );

	QDir oLastDir( m_qSettings.value( "Redstart/last_browse_folder" ).toString() );
	if( oLastDir.exists() )
		fd.setDirectory( oLastDir );
	else
		fd.setDirectory( QDir( QApplication::applicationDirPath() ) );

	QString sFileName = ui->listView_redstart_session_list->GetCurrentSessionID();
	if( sFileName.isEmpty() == false )
		fd.selectFile( sFileName + ".ini" );

	if( fd.exec() )
	{
		QStringList lFiles = fd.selectedFiles();
		if( lFiles.empty() == false )
		{
			QString sFilePath = lFiles[ 0 ];
			QFileInfo oFile( sFilePath );
			if( fd.directory().exists() )
				m_qSettings.setValue( "Redstart/last_browse_folder", oFile.absolutePath() );

			try
			{
				CVAStruct oConfig = ui->listView_redstart_session_list->GetCurrentConfig();
				VACore::StoreCoreConfigToFile( oConfig, sFilePath.toStdString() );
			}
			catch( CVAException& e )
			{
				QString sErrorMessage = QString( "Could not export session configuration: %1" ).arg( QString::fromStdString( e.ToString() ) );
				QErrorMessage oErrMsg;
				oErrMsg.showMessage( sErrorMessage );
				oErrMsg.exec();
			}
		}
	}
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
922
923
924
925
926
}

void RedstartWindow::on_actionRemove_triggered()
{
	ui->listView_redstart_session_list->RemoveCurrentSession();
927

Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
928
929
930
	CVAStruct oStruct;
	if( !ui->listView_redstart_session_list->GetCurrentSessionID().isEmpty() )
		oStruct = ui->listView_redstart_session_list->GetCurrentConfig();
931

Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
932
	ui->treeView_session_details->SetStruct( oStruct );
933
}
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
934
935
936
937
938
939
940

void RedstartWindow::on_actionEdit_session_triggered()
{
	RedstartSessionWizardDialog d( this );

	QString sCurrentSessionID = ui->listView_redstart_session_list->GetCurrentSessionID();
	CVAStruct oCurrentConfig;
941
942
943
944
945
946
947
	if( sCurrentSessionID.isEmpty() )
		return;

	oCurrentConfig = ui->listView_redstart_session_list->GetCurrentConfig();
	d.SetSession( sCurrentSessionID, ConvertVAStructToQHash( oCurrentConfig ) );

	if( d.exec() )
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
948
	{
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
		bool bEnforceDuplicate = true;
		if( sCurrentSessionID != d.GetSessionName() && !ui->listView_redstart_session_list->SessionNameExists( d.GetSessionName() ) )
		{
			ui->listView_redstart_session_list->RenameSession( sCurrentSessionID, d.GetSessionName() );
			bEnforceDuplicate = false;
		}

		QVariantHash oNewConfig = d.GetCoreConfig();
		if( d.GetDuplicationRequested() || bEnforceDuplicate )
		{
			// Enforce unique session id if duplicate requested or session should be renamed to an already existing session
			QString sNewID = d.GetSessionName();
			while( ui->listView_redstart_session_list->SessionNameExists( sNewID ) )
				sNewID += "_copy";

			ui->listView_redstart_session_list->AddSession( sNewID, oNewConfig );
		}
		else
		{
			ui->listView_redstart_session_list->UpdateSession( d.GetSessionName(), oNewConfig );
		}

		ui->treeView_session_details->SetStruct( ConvertQHashToVAStruct( oNewConfig ) );
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
972
	}
973
974
975
976
977
978
979
}

void RedstartWindow::on_actionSession_wizard_triggered()
{
	RedstartSessionWizardDialog d( this );

	d.SetDuplicationOptionDeactivated();
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
980
981
982
983

	if( d.exec() )
	{
		QVariantHash oNewConfig = d.GetCoreConfig();
984
985
986
987
988
989
990
991
		if( ui->listView_redstart_session_list->SessionNameExists( d.GetSessionName() ) )
		{
			// Enforce unique session id if id is already existing
			QString sNewID = d.GetSessionName();
			while( ui->listView_redstart_session_list->SessionNameExists( sNewID ) )
				sNewID += "_new";
			ui->listView_redstart_session_list->AddSession( sNewID, oNewConfig ); // In any case save the session so no data is lost
		}
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
992
		else
993
994
995
996
		{
			ui->listView_redstart_session_list->AddSession( d.GetSessionName(), oNewConfig );
		}

Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
997
998
999
1000
		ui->treeView_session_details->SetStruct( ConvertQHashToVAStruct( oNewConfig ) );
	}
}

1001
void RedstartWindow::on_actionDuplicate_current_session_triggered()
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
1002
{
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
	RedstartSessionWizardDialog d( this );

	QString sCurrentSessionID = ui->listView_redstart_session_list->GetCurrentSessionID();
	CVAStruct oCurrentConfig;
	if( sCurrentSessionID.isEmpty() )
		return;

	oCurrentConfig = ui->listView_redstart_session_list->GetCurrentConfig();
	d.SetSession( sCurrentSessionID, ConvertVAStructToQHash( oCurrentConfig ) );

	d.SetDuplicationOptionActivated();

Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
1015
1016
	if( d.exec() )
	{
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
		QVariantHash oNewConfig = d.GetCoreConfig();
		if( ui->listView_redstart_session_list->SessionNameExists( d.GetSessionName() ) )
		{
			// Enforce unique session id if id is already existing
			QString sNewID = d.GetSessionName();
			while( ui->listView_redstart_session_list->SessionNameExists( sNewID ) )
				sNewID += "_copy";
			ui->listView_redstart_session_list->AddSession( sNewID, oNewConfig ); // In any case save the session so no data is lost
		}
		else
		{
			ui->listView_redstart_session_list->AddSession( d.GetSessionName(), oNewConfig );
		}

		ui->treeView_session_details->SetStruct( ConvertQHashToVAStruct( oNewConfig ) );
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
1032
1033
1034
	}
}

1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
void RedstartWindow::CoreChangeInputSignalDecibel( int iLevelDB )
{
	emit InputSignalChangedDecibel( iLevelDB );
	emit InputSignalChangedDecibel( ( double ) iLevelDB );
}

void RedstartWindow::CoreChangeInputSignalDecibel( double dLevelDB )
{
	emit InputSignalChangedDecibel( dLevelDB );
	emit InputSignalChangedDecibel( ( int ) dLevelDB );

	if( m_pVAInterface )
	{
		const double dGain = db20_to_ratio( dLevelDB );
		m_pVAInterface->SetInputGain( dGain );
	}
}

1053
void RedstartWindow::CoreChangeInputIsMuted( int iMuted )
1054
{
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
	emit InputIsMutedChanged( ( bool ) iMuted );

	if( m_pVAInterface )
		m_pVAInterface->SetInputMuted( ( bool ) iMuted );
}

void RedstartWindow::CoreChangeOutputSignalDecibel( int iLevelDB )
{
	emit OutputSignalChangedDecibel( iLevelDB );
	emit OutputSignalChangedDecibel( ( double ) iLevelDB );
1065
}
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086

void RedstartWindow::CoreChangeOutputSignalDecibel( double dLevelDB )
{
	emit OutputSignalChangedDecibel( dLevelDB );
	emit OutputSignalChangedDecibel( ( int ) dLevelDB );

	if( m_pVAInterface )
	{
		const double dGain = db20_to_ratio( dLevelDB );
		m_pVAInterface->SetOutputGain( dGain );
	}
}

void RedstartWindow::CoreChangeOutputIsMuted( int iMuted )
{
	emit OutputIsMutedChanged( ( bool ) iMuted );

	if( m_pVAInterface )
		m_pVAInterface->SetOutputMuted( ( bool ) iMuted );
}

1087
void RedstartWindow::CoreChangeAuralizationMode( bool bActivateMode, int iMode )
1088
1089
1090
1091
1092
1093
{
	if( !m_pVAInterface )
		return;

	int iAM = m_pVAInterface->GetGlobalAuralizationMode();

1094
1095
	if( bActivateMode == true )
		iAM |= iMode;
1096
	else
1097
		iAM &= ~iMode;
1098
1099
1100
1101

	m_pVAInterface->SetGlobalAuralizationMode( iAM );
}

1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
void RedstartWindow::CoreChangeAuralizationModeDS( int iState )
{
	emit AuralizationModeDSChanged( ( bool ) iState );
	CoreChangeAuralizationMode( ( iState > 0 ), IVAInterface::VA_AURAMODE_DIRECT_SOUND );
}

void RedstartWindow::CoreChangeAuralizationModeAB( int iState )
{
	emit AuralizationModeABChanged( ( bool ) iState );
	CoreChangeAuralizationMode( ( iState > 0 ), IVAInterface::VA_AURAMODE_ABSORPTION );
}

void RedstartWindow::CoreChangeAuralizationModeDIF( int iState )
{
	emit AuralizationModeDIFChanged( ( bool ) iState );
	CoreChangeAuralizationMode( ( iState > 0 ), IVAInterface::VA_AURAMODE_DIFFRACTION );
}

void RedstartWindow::CoreChangeAuralizationModeDD( int iState )
{
	emit AuralizationModeDDChanged( ( bool ) iState );
	CoreChangeAuralizationMode( ( iState > 0 ), IVAInterface::VA_AURAMODE_DIFFUSE_DECAY );
}

void RedstartWindow::CoreChangeAuralizationModeDP( int iState )
{
	emit AuralizationModeDPChanged( ( bool ) iState );
	CoreChangeAuralizationMode( ( iState > 0 ), IVAInterface::VA_AURAMODE_DOPPLER );
}

void RedstartWindow::CoreChangeAuralizationModeER( int iState )
{
	emit AuralizationModeERChanged( ( bool ) iState );
	CoreChangeAuralizationMode( ( iState > 0 ), IVAInterface::VA_AURAMODE_EARLY_REFLECTIONS );
}

void RedstartWindow::CoreChangeAuralizationModeMA( int iState )
{
	emit AuralizationModeMAChanged( ( bool ) iState );
	CoreChangeAuralizationMode( ( iState > 0 ), IVAInterface::VA_AURAMODE_MEDIUM_ABSORPTION );
}

void RedstartWindow::CoreChangeAuralizationModeNF( int iState )
{
	emit AuralizationModeNFChanged( ( bool ) iState );
	CoreChangeAuralizationMode( ( iState > 0 ), IVAInterface::VA_AURAMODE_NEARFIELD );
}

void RedstartWindow::CoreChangeAuralizationModeSC( int iState )
{
	emit AuralizationModeSCChanged( ( bool ) iState );
	CoreChangeAuralizationMode( ( iState > 0 ), IVAInterface::VA_AURAMODE_SCATTERING );
}

void RedstartWindow::CoreChangeAuralizationModeDIR( int iState )
{
	emit AuralizationModeDIRChanged( ( bool ) iState );
	CoreChangeAuralizationMode( ( iState > 0 ), IVAInterface::VA_AURAMODE_SOURCE_DIRECTIVITY );
}

void RedstartWindow::CoreChangeAuralizationModeSL( int iState )
{
	emit AuralizationModeSLChanged( ( bool ) iState );
	CoreChangeAuralizationMode( ( iState > 0 ), IVAInterface::VA_AURAMODE_SPREADING_LOSS );
}

void RedstartWindow::CoreChangeAuralizationModeTV( int iState )
{
	emit AuralizationModeTVChanged( ( bool ) iState );
	CoreChangeAuralizationMode( ( iState > 0 ), IVAInterface::VA_AURAMODE_TEMP_VAR );
}

void RedstartWindow::CoreChangeAuralizationModeTR( int iState )
{
	emit AuralizationModeTRChanged( ( bool ) iState );
	CoreChangeAuralizationMode( ( iState > 0 ), IVAInterface::VA_AURAMODE_TRANSMISSION );
}

1180
1181
1182
void RedstartWindow::CoreChangeGlobalAuralizationMode( int iAM )
{
	// Only emit update when not matching UI state - in that case toggle
1183
	if( ( ( iAM & IVAInterface::VA_AURAMODE_DIRECT_SOUND ) > 0 ) != ui->checkBox_am_ds->isChecked() )
1184
		emit AuralizationModeDSChanged( !ui->checkBox_am_ds->isChecked() );
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
	if( ( ( iAM & IVAInterface::VA_AURAMODE_ABSORPTION ) > 0 ) != ui->checkBox_am_ab->isChecked() )
		emit AuralizationModeABChanged( !ui->checkBox_am_ab->isChecked() );
	if( ( ( iAM & IVAInterface::VA_AURAMODE_DIFFRACTION ) > 0 ) != ui->checkBox_am_dif->isChecked() )
		emit AuralizationModeDIFChanged( !ui->checkBox_am_dif->isChecked() );
	if( ( ( iAM & IVAInterface::VA_AURAMODE_DIFFUSE_DECAY ) > 0 ) != ui->checkBox_am_dd->isChecked() )
		emit AuralizationModeDDChanged( !ui->checkBox_am_dd->isChecked() );
	if( ( ( iAM & IVAInterface::VA_AURAMODE_DOPPLER ) > 0 ) != ui->checkBox_am_dp->isChecked() )
		emit AuralizationModeDPChanged( !ui->checkBox_am_dp->isChecked() );
	if( ( ( iAM & IVAInterface::VA_AURAMODE_EARLY_REFLECTIONS ) > 0 ) != ui->checkBox_am_er->isChecked() )
		emit AuralizationModeERChanged( !ui->checkBox_am_er->isChecked() );
	if( ( ( iAM & IVAInterface::VA_AURAMODE_MEDIUM_ABSORPTION ) > 0 ) != ui->checkBox_am_ma->isChecked() )
		emit AuralizationModeMAChanged( !ui->checkBox_am_ma->isChecked() );
	if( ( ( iAM & IVAInterface::VA_AURAMODE_NEARFIELD ) > 0 ) != ui->checkBox_am_nf->isChecked() )
		emit AuralizationModeNFChanged( !ui->checkBox_am_nf->isChecked() );
	if( ( ( iAM & IVAInterface::VA_AURAMODE_SCATTERING ) > 0 ) && !ui->checkBox_am_sca->isChecked() )
		emit AuralizationModeSCChanged( !ui->checkBox_am_sca->isChecked() );
	if( ( ( iAM & IVAInterface::VA_AURAMODE_SOURCE_DIRECTIVITY ) > 0 ) != ui->checkBox_am_dir->isChecked() )
		emit AuralizationModeDIRChanged( !ui->checkBox_am_dir->isChecked() );
	if( ( ( iAM & IVAInterface::VA_AURAMODE_SPREADING_LOSS ) > 0 ) != ui->checkBox_am_sl->isChecked() )
		emit AuralizationModeSLChanged( !ui->checkBox_am_sl->isChecked() );
	if( ( ( iAM & IVAInterface::VA_AURAMODE_TEMP_VAR ) > 0 ) != ui->checkBox_am_tv->isChecked() )
		emit AuralizationModeTVChanged( !ui->checkBox_am_tv->isChecked() );
	if( ( ( iAM & IVAInterface::VA_AURAMODE_TRANSMISSION ) > 0 ) != ui->checkBox_am_tr->isChecked() )
		emit AuralizationModeTRChanged( !ui->checkBox_am_tr->isChecked() );
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
}

void RedstartWindow::CoreChangeLogLevel( int iLogLevel )
{
	if( !m_pVAInterface )
		return;

	CVAStruct oArgs;
	oArgs[ "setloglevel" ] = iLogLevel;
	m_pVAInterface->CallModule( "VACore", oArgs );
}

void RedstartWindow::SporadicTimeout()
{
	if( m_pVANetServer->GetNumConnectedClients() != m_pNetServerClientsModel->rowCount() )
	{
		QStringList sHosts;
		for( int n = 0; n < m_pVANetServer->GetNumConnectedClients(); n++ )
			sHosts << m_pVANetServer->GetClientHostname( n ).c_str();
		m_pNetServerClientsModel->setStringList( sHosts );
	}

	if( m_pVAInterface )
	{
		ui->lineEdit_core_settings_core_clock->setText( QString::number( m_pVAInterface->GetCoreClock(), 'f', 1 ) );
	}
}

Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
void RedstartWindow::on_actionRunSimpleExample_triggered()
{
	try
	{
		if( !m_pVAInterface )
			VA_EXCEPT2( INVALID_PARAMETER, "No VA interface available. Please start a session, first." );

		RunSimpleExample( m_pVAInterface );
	}
	catch( CVAException& e )
	{
		QString sErrorMessage = QString( "Could not run simple example scene: %1" ).arg( QString::fromStdString( e.ToString() ) );
		QErrorMessage oErrMsg;
		oErrMsg.showMessage( sErrorMessage );
		oErrMsg.exec();
	}
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
1253
1254
1255
1256
}
void RedstartWindow::on_pushButton_core_control_reset_clicked()
{
	if( m_pVAInterface )
1257
		m_pVAInterface->Reset();
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
1258
}
1259
1260
1261

void RedstartWindow::on_actionReset_triggered()
{
1262
1263
	if( m_pVAInterface )
		m_pVAInterface->Reset();
1264
}