RedstartWindow.h 6.56 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 14 15 16
/*
 *  --------------------------------------------------------------------------------------------
 *
 *    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_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 55 56
	enum AudioBackend
	{
		ASIO = 0,
		PORTAUDIO = 1,
	};

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

	enum AudioBufferSize
	{
		AUTO = 0
	};

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

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

		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();
99
		};
100 101 102 103 104 105 106 107 108 109 110 111 112 113

		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;
		};

114 115
	};

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

119
	void on_pushButton_start_stop_clicked();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
120

121
	void on_pushButton_refresh_clicked();
122

123
	void on_comboBox_audio_driver_currentIndexChanged( int index );
124

125
	void on_comboBox_audio_iface_device_currentIndexChanged( int index );
126

127
	void on_actionWebsite_triggered();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
128

129
	void on_actionGet_started_triggered();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
130

131
	void on_actionDocumentation_triggered();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
132

133
	void on_actionGet_help_triggered();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
134

135 136 137 138
	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 );

139
	void on_actionBinauralHeadphones_triggered();
140
	void on_actionImport_session_triggered();
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
141

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

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

147
	void on_pushButton_core_control_reset_clicked();
148

149
	void on_actionAmbisonics_triggered();
150

151
	void on_actionExport_to_file_triggered();
Dipl.-Ing. Jonas Stienen's avatar
WIP  
Dipl.-Ing. Jonas Stienen committed
152 153
	void on_actionRemove_triggered();
	void on_actionEdit_session_triggered();
154
	void on_actionSession_wizard_triggered();
155 156 157 158
	void on_actionDuplicate_current_session_triggered();

	void CoreChangeInputSignalDecibel( int );
	void CoreChangeInputSignalDecibel( double );
159 160 161 162 163
	void CoreChangeInputIsMuted( int );

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

165
	void CoreChangeAuralizationModeDS( int );
166 167 168 169 170 171 172 173 174 175 176 177
	void CoreChangeAuralizationModeER( int );
	void CoreChangeAuralizationModeDD( int );
	void CoreChangeAuralizationModeDIR( int );
	void CoreChangeAuralizationModeDP( int );
	void CoreChangeAuralizationModeSL( int );
	void CoreChangeAuralizationModeDIF( int );
	void CoreChangeAuralizationModeSC( int );;
	void CoreChangeAuralizationModeNF( int );
	void CoreChangeAuralizationModeTV( int );
	void CoreChangeAuralizationModeMA( int );
	void CoreChangeAuralizationModeAB( int );
	void CoreChangeAuralizationModeTR( int );
178 179 180 181 182 183
	void CoreChangeGlobalAuralizationMode( int );

	void CoreChangeLogLevel( int );

	void SporadicTimeout();

184 185
    void on_actionReset_triggered();

186 187 188
signals:
	void InputSignalChangedDecibel( int );
	void InputSignalChangedDecibel( double );
189 190 191 192
	void OutputSignalChangedDecibel( int );
	void OutputSignalChangedDecibel( double );
	void InputIsMutedChanged( bool );
	void OutputIsMutedChanged( bool );
193

194
	void AuralizationModeDSChanged( bool );
195 196 197 198 199 200 201 202 203 204 205 206
	void AuralizationModeERChanged( bool );
	void AuralizationModeDDChanged( bool );
	void AuralizationModeDIRChanged( bool );
	void AuralizationModeDPChanged( bool );
	void AuralizationModeSLChanged( bool );
	void AuralizationModeDIFChanged( bool );
	void AuralizationModeSCChanged( bool );
	void AuralizationModeNFChanged( bool );
	void AuralizationModeTVChanged( bool );
	void AuralizationModeMAChanged( bool );
	void AuralizationModeABChanged( bool );
	void AuralizationModeTRChanged( bool );
207 208
	void GlobalAuralizationModeChanged( int );

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
209 210
private:

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
211
	Ui::RedstartWindow* ui;
212 213 214
	IVAInterface* m_pVAInterface;
	IVANetClient* m_pVANetClient;
	IVANetServer* m_pVANetServer;
215

216
	std::vector< CAudioDeviceSpecs > m_voAudioDevices;
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
217
	int m_iPortaudioDefaultDevice;
218

219 220 221 222
	QStringListModel* m_pPathsModel;
	QStringListModel* m_pMacrosModel;
	QStringListModel* m_pNetServerClientsModel;

223
	QSettings m_qSettings;
224
	QTimer m_qSporadicTimer;
225

226 227
	RedstartSessionListView* pSessionListModel;

228 229
	RedstartRunCirculatingSourceDialog* m_pCirculatingSourceDialog;

230 231
	void LoadConfiguration();
	void StoreConfiguration();
232

233 234
	void RestoreWindowSize();
	void ConnectSignalsAndSlots();
235

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
236
	void PopulateAudioDevices();
237 238
	void AcquireAsioDevices();
	void AcquirePortaudioDevices();
239

240 241
	void PostCoreStart();
	void PostCoreStop();
242

243 244 245
	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 );

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

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
248 249 250
};

#endif // IW_REDSTART_WINDOW