2 #ifndef __BSE_RESAMPLER_HH__
3 #define __BSE_RESAMPLER_HH__
9 typedef struct BseResampler2 BseResampler2;
13 BSE_RESAMPLER2_MODE_UPSAMPLE,
14 BSE_RESAMPLER2_MODE_DOWNSAMPLE
19 BSE_RESAMPLER2_PREC_LINEAR = 1,
20 BSE_RESAMPLER2_PREC_48DB = 8,
21 BSE_RESAMPLER2_PREC_72DB = 12,
22 BSE_RESAMPLER2_PREC_96DB = 16,
23 BSE_RESAMPLER2_PREC_120DB = 20,
24 BSE_RESAMPLER2_PREC_144DB = 24
25 } BseResampler2Precision;
27 BseResampler2* bse_resampler2_create (BseResampler2Mode mode,
28 BseResampler2Precision precision);
29 void bse_resampler2_destroy (BseResampler2 *resampler);
30 void bse_resampler2_process_block (BseResampler2 *resampler,
34 guint bse_resampler2_order (BseResampler2 *resampler);
35 double bse_resampler2_delay (BseResampler2 *resampler);
37 BseResampler2Precision bse_resampler2_find_precision_for_bits (guint bits);
38 const char* bse_resampler2_precision_name (BseResampler2Precision precision);
54 static Resampler2* create (BseResampler2Mode mode,
55 BseResampler2Precision precision);
59 static BseResampler2Precision find_precision_for_bits (guint bits);
63 static const char *precision_name (BseResampler2Precision precision);
67 virtual ~Resampler2();
71 virtual void process_block (
const float *input, uint n_input_samples,
float *output) = 0;
75 virtual guint order()
const = 0;
88 virtual double delay()
const = 0;
90 static const double halfband_fir_linear_coeffs[2];
91 static const double halfband_fir_48db_coeffs[16];
92 static const double halfband_fir_72db_coeffs[24];
93 static const double halfband_fir_96db_coeffs[32];
94 static const double halfband_fir_120db_coeffs[42];
95 static const double halfband_fir_144db_coeffs[52];
102 template<
class Filter>
static inline Resampler2*
103 create_impl_with_coeffs (
const double *d,
108 for (guint i = 0; i < order; i++)
109 taps[i] = d[i] * scaling;
111 Resampler2 *filter =
new Filter (taps);
112 g_assert (order == filter->order());
121 template<
bool USE_SSE>
static inline Resampler2*
122 create_impl (BseResampler2Mode mode,
123 BseResampler2Precision precision);
The Bse namespace contains all functions of the synthesis engine.
Definition: bstbseutils.cc:67