itpp_sci  1.0.0
it++ based simulation framework for scicoslab, scilab and scipy
sim_src.hpp
1 /*xxx
2 * \brief - SIM::src - sample rate converter with sinc fir reconstruction filter
3 * \author maki
4 */
5 
6 
7 #ifndef SIM_SRC_HPP
8 #define SIM_SRC_HPP
9 
10 #include <itpp/itbase.h>
11 #include "sim\_sim_enum_def.h"
12 
13 using namespace itpp;
14 using namespace std;
15 
16 namespace SIM
17 {
22 class src
23 {
24 private:
25  int NTaps;
26  win_type WIN;
27 
28  double *p_x_cb;
29  int x_cb_i;
30 
35  double sinc(double x);
36 
41  double h(double nt);
42 
43 public:
44 
45  double y0;
46 
51  double re_samp(double tau);
52 
56  void xcb(double x_new);
57 
60  src()
61  {
62  y0 = 0.0;
63  NTaps = 15; // default kernel size
64  p_x_cb = new double[NTaps]; // circular buffer initialization
65  for(int i = 0; i < NTaps; i++) p_x_cb[i] = 0.0;
66  x_cb_i = 0;
67  WIN = WIN_HANNING; // default sinc windowing
68  };
69 
70  ~src()
71  {
72  delete [] p_x_cb;
73  };
74 
78  void set_size(int n);
79 
83  void set_win_type(int w);
84 
88  void set_output(double yout);
89 
93  int get_size(void);
94 
98  int get_win_type(void);
99 
103  double get_output(void);
104 
111  vec process(const bmat &ceio, const mat &xt);
112 };
113 
114 } // namespace SIM
115 #endif //SIM_SRC_HPP
116 
double y0
registered filter output
Definition: sim_src.hpp:45
SIM layer implements low level simulation models with itpp base classes as operational types...
Definition: sim_amp.hpp:15
Definition: _sci_assert.cpp:35
src()
Definition: sim_src.hpp:60
sample rate converter with sinc reconstruction filter Core function: SIM::src.process() ...
Definition: sim_src.hpp:22
~src()
Definition: sim_src.hpp:70