| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2015-08-12 09:03:02 +02:00
										 |  |  | // Copyright (C) 2015 F4EXB                                                      //
 | 
					
						
							|  |  |  | // written by Edouard Griffiths                                                  //
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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                  //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-15 04:05:19 +02:00
										 |  |  | #include <QObject>
 | 
					
						
							| 
									
										
										
										
											2016-05-11 11:34:44 +02:00
										 |  |  | #include <vector>
 | 
					
						
							| 
									
										
										
										
											2015-10-15 04:05:19 +02:00
										 |  |  | #include "dsp/dspdeviceengine.h"
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | #include "audio/audiooutput.h"
 | 
					
						
							|  |  |  | #include "util/export.h"
 | 
					
						
							| 
									
										
										
										
											2016-05-08 06:00:37 +02:00
										 |  |  | #ifdef DSD_USE_SERIALDV
 | 
					
						
							|  |  |  | #include "dsp/dvserialengine.h"
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-15 04:05:19 +02:00
										 |  |  | class DSPDeviceEngine; | 
					
						
							| 
									
										
										
										
											2015-08-17 08:29:34 +02:00
										 |  |  | class ThreadedSampleSink; | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-15 04:05:19 +02:00
										 |  |  | class SDRANGEL_API DSPEngine : public QObject { | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2015-10-15 04:05:19 +02:00
										 |  |  | 	DSPEngine(); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	~DSPEngine(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-09 04:09:05 +02:00
										 |  |  | 	static DSPEngine *instance(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-24 00:51:27 +02:00
										 |  |  | 	uint getAudioSampleRate() const { return m_audioSampleRate; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-13 09:23:33 +02:00
										 |  |  | 	DSPDeviceEngine *addDeviceEngine(); | 
					
						
							|  |  |  | 	void removeLastDeviceEngine(); | 
					
						
							| 
									
										
										
										
											2016-05-12 00:35:39 +02:00
										 |  |  | 	void stopAllAcquisitions(); | 
					
						
							|  |  |  | 	void stopAllDeviceEngines(); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  | 	void startAudio(); | 
					
						
							|  |  |  | 	void stopAudio(); | 
					
						
							| 
									
										
										
										
											2016-05-18 10:51:42 +02:00
										 |  |  |     void startAudioImmediate(); | 
					
						
							|  |  |  |     void stopAudioImmediate(); | 
					
						
							| 
									
										
										
										
											2016-05-11 23:35:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-11 19:14:23 +02:00
										 |  |  |     DSPDeviceEngine *getDeviceEngineByIndex(uint deviceIndex) { return m_deviceEngines[deviceIndex]; } | 
					
						
							|  |  |  |     DSPDeviceEngine *getDeviceEngineByUID(uint uid); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-11 17:03:02 +02:00
										 |  |  | 	void addAudioSink(AudioFifo* audioFifo); //!< Add the audio sink
 | 
					
						
							|  |  |  | 	void removeAudioSink(AudioFifo* audioFifo); //!< Remove the audio sink
 | 
					
						
							| 
									
										
										
										
											2016-05-11 11:34:44 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Serial DV methods:
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-08 06:00:37 +02:00
										 |  |  | 	bool hasDVSerialSupport() | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | #ifdef DSD_USE_SERIALDV
 | 
					
						
							|  |  |  | 	    return m_dvSerialSupport; | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void setDVSerialSupport(bool support); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-09 18:17:53 +02:00
										 |  |  | 	void getDVSerialNames(std::vector<std::string>& deviceNames) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | #ifdef DSD_USE_SERIALDV
 | 
					
						
							|  |  |  | 	    m_dvSerialEngine.getDevicesNames(deviceNames); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-08 07:02:31 +02:00
										 |  |  | 	void pushMbeFrame(const unsigned char *mbeFrame, int mbeRateIndex, int mbeVolumeIndex, AudioFifo *audioFifo) | 
					
						
							| 
									
										
										
										
											2016-05-08 06:00:37 +02:00
										 |  |  | 	{ | 
					
						
							|  |  |  | #ifdef DSD_USE_SERIALDV
 | 
					
						
							| 
									
										
										
										
											2016-05-08 07:02:31 +02:00
										 |  |  | 	    m_dvSerialEngine.pushMbeFrame(mbeFrame, mbeRateIndex, mbeVolumeIndex, audioFifo); | 
					
						
							| 
									
										
										
										
											2016-05-08 06:00:37 +02:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2016-05-11 11:34:44 +02:00
										 |  |  | 	std::vector<DSPDeviceEngine*> m_deviceEngines; | 
					
						
							| 
									
										
										
										
											2016-05-13 09:23:33 +02:00
										 |  |  | 	uint m_deviceEnginesUIDSequence; | 
					
						
							| 
									
										
										
										
											2015-08-20 03:38:31 +02:00
										 |  |  | 	AudioOutput m_audioOutput; | 
					
						
							| 
									
										
										
										
											2015-08-24 00:51:27 +02:00
										 |  |  | 	uint m_audioSampleRate; | 
					
						
							| 
									
										
										
										
											2016-05-08 06:00:37 +02:00
										 |  |  | 	bool m_dvSerialSupport; | 
					
						
							|  |  |  | #ifdef DSD_USE_SERIALDV
 | 
					
						
							|  |  |  | 	DVSerialEngine m_dvSerialEngine; | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // INCLUDE_DSPENGINE_H
 |