RedstartWindow.h 6.67 KB
Newer Older
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
1
2
3
4
5
6
/*
 *  --------------------------------------------------------------------------------------------
 *
 *    VVV        VVV A           Virtual Acoustics (VA) | http://www.virtualacoustics.org
 *     VVV      VVV AAA          Licensed under the Apache License, Version 2.0
 *      VVV    VVV   AAA
7
 *       VVV  VVV     AAA        Copyright 2015-2020
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
8
9
10
11
12
13
14
15
16
 *        VVVVVV       AAA       Institute of Technical Acoustics (ITA)
 *         VVVV         AAA      RWTH Aachen University
 *
 *  --------------------------------------------------------------------------------------------
 */
#ifndef IW_REDSTART_WINDOW
#define IW_REDSTART_WINDOW

#include <QMainWindow>
17
#include <QSettings>
18
#include <QStringList>
19
#include <QTimer>
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
20

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
21
22
#include "RedstartSessionList.h"

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
23
24
#include <VAEvent.h>

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
25
26
27
28
29
30
31
#include <ITAPortaudioInterface.h>
#ifdef WIN32
#include <ITAAsioInterface.h>
#else
#include <ITAJACKInterface.h>
#endif

32

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
33
class IVAInterface;
34
35
class IVANetClient;
class IVANetServer;
36
class RedstartRunCirculatingSourceDialog;
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
37

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
38
39
40
41
42
namespace Ui
{
	class RedstartWindow;
}

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
43
class RedstartWindow : public QMainWindow, public IVAEventHandler
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
44
45
46
47
{
	Q_OBJECT

public:
48
	explicit RedstartWindow( bool bFailSafeMode = false, bool bAutoStart = false, bool bSkipConfig = false, QWidget* pParent = 0 );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
49
50
	~RedstartWindow();

51
52
53
54
	enum AudioBackend
	{
		ASIO = 0,
		PORTAUDIO = 1,
55
		VIRTUAL = 2,
56
57
	};

58
59
60
61
62
63
64
65
66
67
68
69
	enum AudioSamplingRate
	{
		FS_44kHz = 0,
		FS_48kHz = 1,
		FS_96kHz = 2,
	};

	enum AudioBufferSize
	{
		AUTO = 0
	};

70
71
72
73
74
75
76
77
	struct CAudioDeviceSpecs
	{
		int iDriverNumber;
		QString sName;
		int iNumInputChannels;
		int iNumOutputChannels;
		bool bInitializable;
		bool bDefaultDevice;
78
		int iBackend;
79
80
81

		inline CAudioDeviceSpecs()
		{
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
82
83
84
85
86
87
			iDriverNumber = -1;
			iNumInputChannels = -1;
			iNumOutputChannels = -1;
			bInitializable = false;
			bDefaultDevice = false;
			iBackend = -1;
88
89
90
91
92
93
94
95
96
97
98
99
		};

		inline CAudioDeviceSpecs( const QVariantHash& oHash )
			: CAudioDeviceSpecs()
		{
			iDriverNumber = oHash[ "DriverNumber" ].toInt();
			sName = oHash[ "Name" ].toString();
			iNumInputChannels = oHash[ "NumInputChannels" ].toInt();
			iNumOutputChannels = oHash[ "NumOutputChannels" ].toInt();
			bInitializable = oHash[ "Initializable" ].toBool();
			bDefaultDevice = oHash[ "DefaultDevice" ].toBool();
			iBackend = oHash[ "Backend" ].toInt();
100
		};
101
102
103
104
105
106
107
108
109
110
111
112
113
114

		inline QVariantHash asHash() const
		{
			QVariantHash oHash;
			oHash[ "DriverNumber" ] = iDriverNumber;
			oHash[ "Name" ] = sName;
			oHash[ "NumInputChannels" ] = iNumInputChannels;
			oHash[ "NumOutputChannels" ] = iNumOutputChannels;
			oHash[ "Initializable" ] = bInitializable;
			oHash[ "DefaultDevice" ] = bDefaultDevice;
			oHash[ "Backend" ] = iBackend;
			return oHash;
		};

115
116
	};

117
118
	private slots:
	void on_actionQuit_triggered();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
119

120
121
122
	void on_pushButton_start_clicked();
	void on_pushButton_stop_clicked();
	void on_shortcut_start_stop();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
123

124
	void on_pushButton_refresh_clicked();
125

126
	void on_comboBox_audio_driver_currentIndexChanged( int index );
127

128
	void on_comboBox_audio_iface_device_currentIndexChanged( int index );
129

130
	void on_actionWebsite_triggered();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
131

132
	void on_actionGet_started_triggered();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
133

134
	void on_actionDocumentation_triggered();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
135

136
	void on_actionGet_help_triggered();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
137

138
139
140
141
	void on_checkBox_redstart_network_connect_as_client_clicked();
	void on_checkBox_portaudio_default_device_clicked();
	void on_listView_redstart_session_list_clicked( const QModelIndex &index );

142
	void on_actionBinauralHeadphones_triggered();
143
	void on_actionImport_session_triggered();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
144

145
	void on_actionDefault_experimental_session_triggered();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
146

147
	void on_actionRunSimpleExample_triggered();
148
	void on_actionCirculating_source_triggered();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
149

150
	void on_pushButton_core_control_reset_clicked();
151

152
	void on_actionAmbisonics_triggered();
153

154
	void on_actionExport_to_file_triggered();
Dipl.-Ing. Jonas Stienen's avatar
WIP    
Dipl.-Ing. Jonas Stienen committed
155
156
	void on_actionRemove_triggered();
	void on_actionEdit_session_triggered();
157
	void on_actionSession_wizard_triggered();
158
	void on_actionDuplicate_current_session_triggered();
159
	void on_actionAbout_Redstart_triggered();
160
161
162

	void CoreChangeInputSignalDecibel( int );
	void CoreChangeInputSignalDecibel( double );
163
164
165
166
167
	void CoreChangeInputIsMuted( int );

	void CoreChangeOutputSignalDecibel( int );
	void CoreChangeOutputSignalDecibel( double );
	void CoreChangeOutputIsMuted( int );
168

169
	void CoreChangeAuralizationModeDS( int );
170
171
172
173
174
	void CoreChangeAuralizationModeER( int );
	void CoreChangeAuralizationModeDD( int );
	void CoreChangeAuralizationModeDIR( int );
	void CoreChangeAuralizationModeDP( int );
	void CoreChangeAuralizationModeSL( int );
175
	void CoreChangeAuralizationModeDF( int );
176
177
178
179
180
181
	void CoreChangeAuralizationModeSC( int );;
	void CoreChangeAuralizationModeNF( int );
	void CoreChangeAuralizationModeTV( int );
	void CoreChangeAuralizationModeMA( int );
	void CoreChangeAuralizationModeAB( int );
	void CoreChangeAuralizationModeTR( int );
182
183
184
185
186
187
	void CoreChangeGlobalAuralizationMode( int );

	void CoreChangeLogLevel( int );

	void SporadicTimeout();

188
189
    void on_actionReset_triggered();

190
191
192
signals:
	void InputSignalChangedDecibel( int );
	void InputSignalChangedDecibel( double );
193
194
195
196
	void OutputSignalChangedDecibel( int );
	void OutputSignalChangedDecibel( double );
	void InputIsMutedChanged( bool );
	void OutputIsMutedChanged( bool );
197

198
	void AuralizationModeDSChanged( bool );
199
200
201
202
203
	void AuralizationModeERChanged( bool );
	void AuralizationModeDDChanged( bool );
	void AuralizationModeDIRChanged( bool );
	void AuralizationModeDPChanged( bool );
	void AuralizationModeSLChanged( bool );
204
	void AuralizationModeDFChanged( bool );
205
206
207
208
209
210
	void AuralizationModeSCChanged( bool );
	void AuralizationModeNFChanged( bool );
	void AuralizationModeTVChanged( bool );
	void AuralizationModeMAChanged( bool );
	void AuralizationModeABChanged( bool );
	void AuralizationModeTRChanged( bool );
211
212
	void GlobalAuralizationModeChanged( int );

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
213
214
private:

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
215
	Ui::RedstartWindow* ui;
216
217
218
	IVAInterface* m_pVAInterface;
	IVANetClient* m_pVANetClient;
	IVANetServer* m_pVANetServer;
219

220
	std::vector< CAudioDeviceSpecs > m_voAudioDevices;
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
221
	int m_iPortaudioDefaultDevice;
222

223
224
225
226
	QStringListModel* m_pPathsModel;
	QStringListModel* m_pMacrosModel;
	QStringListModel* m_pNetServerClientsModel;

227
	QSettings m_qSettings;
228
	QTimer m_qSporadicTimer;
229

230
231
	RedstartSessionListView* pSessionListModel;

232
233
	RedstartRunCirculatingSourceDialog* m_pCirculatingSourceDialog;

234
235
	void LoadConfiguration();
	void StoreConfiguration();
236

237
238
	void RestoreWindowSize();
	void ConnectSignalsAndSlots();
239

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
240
	void PopulateAudioDevices();
241
242
	void AcquireAsioDevices();
	void AcquirePortaudioDevices();
243

244
245
	void PostCoreStart();
	void PostCoreStop();
246

247
248
249
	void HandleVAEvent( const CVAEvent* );
	void UpdateMeasures( const std::vector< float >& vfInputRMSs, const std::vector< float >& vfInputPeaks, const std::vector< float >& vfOutputRMSs, const std::vector< float >& vfOutputPeaks );

250
	void CoreChangeAuralizationMode( bool, int );
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
251

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
252
253
254
};

#endif // IW_REDSTART_WINDOW