SoDaRadio-5.0.3-master:8901fb5
ReSamplers625x48.hxx
Go to the documentation of this file.
1 /*
2  Copyright (c) 2012,2013,2014 Matthew H. Reilly (kb1vc)
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions are
7  met:
8 
9  Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11  Redistributions in binary form must reproduce the above copyright
12  notice, this list of conditions and the following disclaimer in
13  the documentation and/or other materials provided with the
14  distribution.
15 
16  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 
29 // OK... this is just for 48K to 625K interpolation.
30 // fast, small, simple.
31 #include "SoDaBase.hxx"
32 
33 #ifndef RESAMPLERS_48625_HDR
34 #define RESAMPLERS_48625_HDR
35 #include <complex>
36 #include "ReSampler.hxx"
37 
38 namespace SoDa {
42  class ReSample48to625 : public SoDaBase {
43  public:
49  ReSample48to625(unsigned int inbufsize, float gain = 1.0);
51 
57  void apply(std::complex<float> * in, std::complex<float> * out);
63  void apply(float * in, float * out);
64 
65  private:
66  unsigned int N, MN;
67 
68  // The resampler objects
70 
71  // the buffers
72  std::complex<float> * inter1, *inter2;
73  float * finter1, *finter2;
74 
75  float gain;
76  };
77 
81  class ReSample625to48 : public SoDaBase {
82  public:
88  ReSample625to48(unsigned int inbufsize, float _gain = 1.0);
89  ~ReSample625to48();
90 
96  void apply(std::complex<float> * in, std::complex<float> * out);
102  void apply(float * in, float * out);
103 
104 
105  private:
106  unsigned int N, MN;
107 
108  // The resampler objects
109  SoDa::ReSampler * rs45a, * rs45b, * rs35, * rs15;
110 
111  // the buffers
112  std::complex<float> * inter1, *inter2;
113  float * finter1, *finter2;
114 
115  float gain;
116  };
117 
118 }
119 #endif
The Baseclass for all SoDa objects, and useful commonly used classes.
Rational Resampler.
Definition: ReSampler.hxx:41
std::complex< float > * inter1
Resampler for 625KHz to 48KHz data stream, built on rational ReSampler class.
float gain
the gain to be applied to the final transform result.
SoDa::ReSampler * rs54b
SoDa::ReSampler * rs45b
Resampler for 48KHz to 625KHz data stream, built on rational ReSampler class.
std::complex< float > * inter2
float gain
the gain to be applied to the final transform result.
void apply(std::complex< float > *in, std::complex< float > *out)
Perform the resampling on a complex float buffer.
std::complex< float > * inter2
ReSample48to625(unsigned int inbufsize, float gain=1.0)
Constructor.
SoDa::ReSampler * rs53
The SoDa Base class.
Definition: SoDaBase.hxx:167
SoDa::ReSampler * rs51
SoDa::ReSampler * rs54a