| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  | /*  siphon.h
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | This file is part of a program that implements a Software-Defined Radio. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Copyright (C) 2013 Warren Pratt, NR0V | 
					
						
							|  |  |  | Copyright (C) 2024 Edouard Griffiths, F4EXB Adapted to SDRangel | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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; either version 2 | 
					
						
							|  |  |  | of the License, or (at your option) any later version. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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 for more details. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  | along with this program; if not, write to the Free Software | 
					
						
							|  |  |  | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The author can be reached by email at | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | warren@wpratt.com | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // 'siphon' collects samples in a buffer.  These samples can then be PULLED from the buffer
 | 
					
						
							|  |  |  | //  in either raw or FFT'd form.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef wdsp_siphon_h
 | 
					
						
							|  |  |  | #define wdsp_siphon_h
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-30 22:52:21 +02:00
										 |  |  | #include <vector>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  | #include "fftw3.h"
 | 
					
						
							|  |  |  | #include "export.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace WDSP { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class WDSP_API SIPHON | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     int run; | 
					
						
							|  |  |  |     int position; | 
					
						
							|  |  |  |     int mode; | 
					
						
							|  |  |  |     int disp; | 
					
						
							|  |  |  |     int insize; | 
					
						
							| 
									
										
										
										
											2024-06-25 03:50:48 +02:00
										 |  |  |     float* in; | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  |     int sipsize;    // NOTE:  sipsize MUST BE A POWER OF TWO!!
 | 
					
						
							| 
									
										
										
										
											2024-07-30 22:52:21 +02:00
										 |  |  |     std::vector<float> sipbuff; | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  |     int outsize; | 
					
						
							|  |  |  |     int idx; | 
					
						
							| 
									
										
										
										
											2024-07-30 22:52:21 +02:00
										 |  |  |     std::vector<float> sipout; | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  |     int fftsize; | 
					
						
							| 
									
										
										
										
											2024-07-30 22:52:21 +02:00
										 |  |  |     std::vector<float> specout; | 
					
						
							| 
									
										
										
										
											2024-07-14 00:05:10 +02:00
										 |  |  |     long specmode; | 
					
						
							| 
									
										
										
										
											2024-06-25 03:50:48 +02:00
										 |  |  |     fftwf_plan sipplan; | 
					
						
							| 
									
										
										
										
											2024-07-30 22:52:21 +02:00
										 |  |  |     std::vector<float> window; | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-30 22:52:21 +02:00
										 |  |  |     SIPHON( | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  |         int run, | 
					
						
							|  |  |  |         int position, | 
					
						
							|  |  |  |         int mode, | 
					
						
							|  |  |  |         int disp, | 
					
						
							|  |  |  |         int insize, | 
					
						
							| 
									
										
										
										
											2024-06-25 03:50:48 +02:00
										 |  |  |         float* in, | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  |         int sipsize, | 
					
						
							|  |  |  |         int fftsize, | 
					
						
							|  |  |  |         int specmode | 
					
						
							|  |  |  |     ); | 
					
						
							| 
									
										
										
										
											2024-07-30 22:52:21 +02:00
										 |  |  |     SIPHON(const SIPHON&) = delete; | 
					
						
							|  |  |  |     SIPHON& operator=(const SIPHON& other) = delete; | 
					
						
							|  |  |  |     ~SIPHON(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void flush(); | 
					
						
							|  |  |  |     void execute(int pos); | 
					
						
							|  |  |  |     void setBuffers(float* in); | 
					
						
							|  |  |  |     void setSamplerate(int rate); | 
					
						
							|  |  |  |     void setSize(int size); | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  |     // RXA Properties
 | 
					
						
							| 
									
										
										
										
											2024-07-30 22:52:21 +02:00
										 |  |  |     void getaSipF  (float* out, int size); | 
					
						
							|  |  |  |     void getaSipF1 (float* out, int size); | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  |     // TXA Properties
 | 
					
						
							| 
									
										
										
										
											2024-07-30 22:52:21 +02:00
										 |  |  |     void setSipPosition(int pos); | 
					
						
							|  |  |  |     void setSipMode(int mode); | 
					
						
							|  |  |  |     void setSipDisplay(int disp); | 
					
						
							|  |  |  |     void getSpecF1(float* out); | 
					
						
							|  |  |  |     void setSipSpecmode(int mode); | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2024-07-30 22:52:21 +02:00
										 |  |  |     void build_window(); | 
					
						
							|  |  |  |     void suck(); | 
					
						
							|  |  |  |     void sip_spectrum(); | 
					
						
							| 
									
										
										
										
											2024-06-16 11:31:13 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace WDSP
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 |