| 
									
										
										
										
											2019-02-24 20:59:09 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							| 
									
										
										
										
											2023-11-19 06:43:20 +01:00
										 |  |  | // Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
 | 
					
						
							|  |  |  | // written by Christian Daniel                                                   //
 | 
					
						
							|  |  |  | // Copyright (C) 2015-2020 Edouard Griffiths, F4EXB <f4exb06@gmail.com>          //
 | 
					
						
							|  |  |  | // Copyright (C) 2020 Jon Beniston, M7RCE <jon@beniston.com>                     //
 | 
					
						
							| 
									
										
										
										
											2019-02-24 20:59:09 +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                  //
 | 
					
						
							| 
									
										
										
										
											2019-04-11 14:32:15 +02:00
										 |  |  | // (at your option) any later version.                                           //
 | 
					
						
							| 
									
										
										
										
											2019-02-24 20:59:09 +01: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 SDRBASE_AUDIO_AUDIORESAMPLER_H_
 | 
					
						
							|  |  |  | #define SDRBASE_AUDIO_AUDIORESAMPLER_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "dsp/dsptypes.h"
 | 
					
						
							|  |  |  | #include "audiofilter.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-29 18:12:56 +01:00
										 |  |  | class SDRBASE_API AudioResampler | 
					
						
							| 
									
										
										
										
											2019-02-24 20:59:09 +01:00
										 |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     AudioResampler(); | 
					
						
							|  |  |  |     ~AudioResampler(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void setDecimation(uint32_t decimation); | 
					
						
							| 
									
										
										
										
											2019-02-26 16:46:58 +01:00
										 |  |  |     uint32_t getDecimation() const { return m_decimation; } | 
					
						
							| 
									
										
										
										
											2019-02-27 00:31:45 +01:00
										 |  |  |     void setAudioFilters(int srHigh, int srLow, int fcLow, int fcHigh, float gain=1.0f); | 
					
						
							| 
									
										
										
										
											2019-02-24 20:59:09 +01:00
										 |  |  |     bool downSample(qint16 sampleIn, qint16& sampleOut); | 
					
						
							| 
									
										
										
										
											2019-02-26 16:46:58 +01:00
										 |  |  |     bool upSample(qint16 sampleIn, qint16& sampleOut); | 
					
						
							| 
									
										
										
										
											2019-02-24 20:59:09 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     AudioFilter m_audioFilter; | 
					
						
							|  |  |  |     uint32_t m_decimation; | 
					
						
							|  |  |  |     uint32_t m_decimationCount; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* SDRBASE_AUDIO_AUDIORESAMPLER_H_ */
 |