| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2015 F4EXB                                                      //
 | 
					
						
							|  |  |  | // written by Edouard Griffiths                                                  //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is free software; you can redistribute it and/or modify          //
 | 
					
						
							|  |  |  | // it under the terms of the GNU General Public License as published by          //
 | 
					
						
							|  |  |  | // the Free Software Foundation as version 3 of the License, or                  //
 | 
					
						
							| 
									
										
										
										
											2019-04-11 14:32:15 +02:00
										 |  |  | // (at your option) any later version.                                           //
 | 
					
						
							| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is distributed in the hope that it will be useful,               //
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of                //
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                  //
 | 
					
						
							|  |  |  | // GNU General Public License V3 for more details.                               //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU General Public License             //
 | 
					
						
							|  |  |  | // along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef INCLUDE_DSPENGINE_H
 | 
					
						
							|  |  |  | #define INCLUDE_DSPENGINE_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QObject>
 | 
					
						
							| 
									
										
										
										
											2017-10-24 16:45:47 +02:00
										 |  |  | #include <QTimer>
 | 
					
						
							| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  | #include <vector>
 | 
					
						
							| 
									
										
										
										
											2018-03-26 11:55:45 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "audio/audiodevicemanager.h"
 | 
					
						
							| 
									
										
										
										
											2020-11-12 22:13:44 +01:00
										 |  |  | #include "audio/audiooutputdevice.h"
 | 
					
						
							| 
									
										
										
										
											2018-03-20 13:49:21 +01:00
										 |  |  | #include "export.h"
 | 
					
						
							| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | class DSPDeviceSourceEngine; | 
					
						
							| 
									
										
										
										
											2016-10-19 14:29:23 +02:00
										 |  |  | class DSPDeviceSinkEngine; | 
					
						
							| 
									
										
										
										
											2019-05-18 11:59:56 +02:00
										 |  |  | class DSPDeviceMIMOEngine; | 
					
						
							| 
									
										
										
										
											2020-03-12 06:27:38 +01:00
										 |  |  | class FFTFactory; | 
					
						
							| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-03 20:23:38 +01:00
										 |  |  | class SDRBASE_API DSPEngine : public QObject { | 
					
						
							| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	DSPEngine(); | 
					
						
							|  |  |  | 	~DSPEngine(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	static DSPEngine *instance(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-25 01:47:22 +01:00
										 |  |  | 	unsigned int getDefaultAudioSampleRate() const { return AudioDeviceManager::m_defaultAudioSampleRate; } | 
					
						
							| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-11 01:11:32 +02:00
										 |  |  | 	DSPDeviceSourceEngine *addDeviceSourceEngine(); | 
					
						
							|  |  |  | 	void removeLastDeviceSourceEngine(); | 
					
						
							| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-19 14:29:23 +02:00
										 |  |  | 	DSPDeviceSinkEngine *addDeviceSinkEngine(); | 
					
						
							|  |  |  | 	void removeLastDeviceSinkEngine(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-18 11:59:56 +02:00
										 |  |  | 	DSPDeviceMIMOEngine *addDeviceMIMOEngine(); | 
					
						
							|  |  |  | 	void removeLastDeviceMIMOEngine(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-12 16:20:45 +02:00
										 |  |  |     void removeDeviceEngineAt(int deviceIndex); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-23 18:08:38 +01:00
										 |  |  | 	AudioDeviceManager *getAudioDeviceManager() { return &m_audioDeviceManager; } | 
					
						
							| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-02 04:02:40 +02:00
										 |  |  |     uint32_t getDeviceSourceEnginesNumber() const { return m_deviceSourceEngines.size(); } | 
					
						
							| 
									
										
										
										
											2022-04-12 16:20:45 +02:00
										 |  |  |     DSPDeviceSourceEngine *getDeviceSourceEngineByIndex(unsigned int deviceIndex) { return m_deviceSourceEngines[deviceIndex]; } | 
					
						
							| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-02 04:02:40 +02:00
										 |  |  |     uint32_t getDeviceSinkEnginesNumber() const { return m_deviceSinkEngines.size(); } | 
					
						
							| 
									
										
										
										
											2022-04-12 16:20:45 +02:00
										 |  |  |     DSPDeviceSinkEngine *getDeviceSinkEngineByIndex(unsigned int deviceIndex) { return m_deviceSinkEngines[deviceIndex]; } | 
					
						
							| 
									
										
										
										
											2016-10-19 14:29:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-18 11:59:56 +02:00
										 |  |  |     uint32_t getDeviceMIMOEnginesNumber() const { return m_deviceMIMOEngines.size(); } | 
					
						
							| 
									
										
										
										
											2022-04-12 16:20:45 +02:00
										 |  |  |     DSPDeviceMIMOEngine *getDeviceMIMOEngineByIndex(unsigned int deviceIndex) { return m_deviceMIMOEngines[deviceIndex]; } | 
					
						
							| 
									
										
										
										
											2019-05-18 11:59:56 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-24 16:45:47 +02:00
										 |  |  |     const QTimer& getMasterTimer() const { return m_masterTimer; } | 
					
						
							| 
									
										
										
										
											2019-05-12 10:25:55 +02:00
										 |  |  |     void setMIMOSupport(bool mimoSupport) { m_mimoSupport = mimoSupport; } | 
					
						
							|  |  |  |     bool getMIMOSupport() const { return m_mimoSupport; } | 
					
						
							| 
									
										
										
										
											2020-03-12 06:27:38 +01:00
										 |  |  |     void createFFTFactory(const QString& fftWisdomFileName); | 
					
						
							|  |  |  |     void preAllocateFFTs(); | 
					
						
							|  |  |  |     FFTFactory *getFFTFactory() { return m_fftFactory; } | 
					
						
							| 
									
										
										
										
											2017-10-24 16:45:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2022-04-12 16:20:45 +02:00
										 |  |  |     struct DeviceEngineReference | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2022-04-25 01:18:07 +02:00
										 |  |  |         int m_deviceEngineType; //!< 0: Rx, 1: Tx, 2: MIMO
 | 
					
						
							|  |  |  |         DSPDeviceSourceEngine *m_deviceSourceEngine; | 
					
						
							|  |  |  |         DSPDeviceSinkEngine *m_deviceSinkEngine; | 
					
						
							|  |  |  |         DSPDeviceMIMOEngine *m_deviceMIMOEngine; | 
					
						
							| 
									
										
										
										
											2022-04-12 16:20:45 +02:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	QList<DSPDeviceSourceEngine*> m_deviceSourceEngines; | 
					
						
							|  |  |  | 	unsigned int m_deviceSourceEnginesUIDSequence; | 
					
						
							|  |  |  | 	QList<DSPDeviceSinkEngine*> m_deviceSinkEngines; | 
					
						
							|  |  |  | 	unsigned int m_deviceSinkEnginesUIDSequence; | 
					
						
							|  |  |  | 	QList<DSPDeviceMIMOEngine*> m_deviceMIMOEngines; | 
					
						
							|  |  |  | 	unsigned int m_deviceMIMOEnginesUIDSequence; | 
					
						
							|  |  |  |     QList<DeviceEngineReference> m_deviceEngineReferences; | 
					
						
							| 
									
										
										
										
											2018-03-23 18:08:38 +01:00
										 |  |  |     AudioDeviceManager m_audioDeviceManager; | 
					
						
							| 
									
										
										
										
											2017-01-06 16:04:32 +01:00
										 |  |  |     int m_audioInputDeviceIndex; | 
					
						
							|  |  |  |     int m_audioOutputDeviceIndex; | 
					
						
							| 
									
										
										
										
											2017-10-24 16:45:47 +02:00
										 |  |  |     QTimer m_masterTimer; | 
					
						
							| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  | 	bool m_dvSerialSupport; | 
					
						
							| 
									
										
										
										
											2019-05-12 10:25:55 +02:00
										 |  |  |     bool m_mimoSupport; | 
					
						
							| 
									
										
										
										
											2020-03-12 06:27:38 +01:00
										 |  |  |     FFTFactory *m_fftFactory; | 
					
						
							| 
									
										
										
										
											2016-10-03 18:29:05 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // INCLUDE_DSPENGINE_H
 |