1 // ---------------------------------------------------------------------------- 2 // 3 // Copyright (C) 2006-2012 Fons Adriaensen <fons@linuxaudio.org> 4 // 5 // This program is free software; you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation; either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with this program. If not, see <http://www.gnu.org/licenses/>. 17 // 18 // ---------------------------------------------------------------------------- 19 20 21 #ifndef __RESAMPLER_H 22 #define __RESAMPLER_H 23 24 25 #include <zita-resampler/resampler-table.h> 26 27 28 class Resampler 29 { 30 public: 31 32 Resampler (void); 33 ~Resampler (void); 34 35 int setup (unsigned int fs_inp, 36 unsigned int fs_out, 37 unsigned int nchan, 38 unsigned int hlen); 39 40 int setup (unsigned int fs_inp, 41 unsigned int fs_out, 42 unsigned int nchan, 43 unsigned int hlen, 44 double frel); 45 46 void clear (void); 47 int reset (void); nchan(void)48 int nchan (void) const { return _nchan; } filtlen(void)49 int filtlen (void) const { return inpsize (); } // Deprecated 50 int inpsize (void) const; 51 double inpdist (void) const; 52 int process (void); 53 54 unsigned int inp_count; 55 unsigned int out_count; 56 float *inp_data; 57 float *out_data; 58 void *inp_list; 59 void *out_list; 60 61 private: 62 63 Resampler_table *_table; 64 unsigned int _nchan; 65 unsigned int _inmax; 66 unsigned int _index; 67 unsigned int _nread; 68 unsigned int _nzero; 69 unsigned int _phase; 70 unsigned int _pstep; 71 float *_buff; 72 void *_dummy [8]; 73 }; 74 75 76 #endif 77