36#ifndef BLO_N_HARMONICS
37#define BLO_N_HARMONICS 64
44#define BLO_SIN_GEN(phase) sin((phase) * 2.0f * (float)M_PI / table_size_f)
45#define BLO_NEXT_TABLE (all_tables + (table_count++ * (table_size + BLO_TABLE_WR)))
98 const float ff = fabs(
f) + 0.00001f;
101 this->om.all = (
int)(
f * this->ph_coef);
102 tab_num =
f_round(this->nyquist / ff - 0.5f);
106 this->table_b = this->tables->h_tables[this->wave][tab_num];
115 const float ff = fabs(
f) + 0.00001f;
117 this->om.all =
f_round(
f * this->ph_coef);
121 }
else if (tab_num < 0) {
124 this->table = this->tables->h_tables[this->wave][tab_num];
125 this->xfade = this->nyquist / ff - tab_num;
126 if (this->xfade > 1.0f) {
132 this->table_b = this->tables->h_tables[this->wave][tab_num];
140 const float frac = (float)(this->ph.part.fr) * 0.00001525878f;
141 const int idx = this->ph.part.in;
143 this->ph.all += this->om.all;
144 this->ph.all &= this->ph_mask;
145 if (this->topbit != (this->ph.all & this->table_size)) {
146 this->topbit = this->ph.all & this->table_size;
147 this->table = this->table_b;
150 return this->table[idx] * (1.0f - frac) + this->table[idx+1] * frac;
158 const float frac = (float)(this->ph.part.fr) * 0.00001525878f;
159 const int idx = this->ph.part.in;
160 float *
t = this->table;
162 this->ph.all += this->om.all;
163 this->ph.all &= this->ph_mask;
165 if (this->topbit != (this->ph.all & this->table_size)) {
166 this->topbit = this->ph.all & this->table_size;
167 this->table = this->table_b;
182 const float frac = (float)(this->ph.part.fr) * 0.00001525878f;
183 const int idx = this->ph.part.in;
185 this->ph.all += this->om.all;
186 this->ph.all &= this->ph_mask;
188 low =
LIN_INTERP(frac, this->table_b[idx], this->table_b[idx+1]);
189 high =
LIN_INTERP(frac, this->table[idx], this->table[idx+1]);
202 const float frac = (float)(this->ph.part.fr) * 0.00001525878f;
203 const int idx = this->ph.part.in;
204 const float *tl = this->table_b;
205 const float *th = this->table;
208 this->ph.all += this->om.all;
209 this->ph.all &= this->ph_mask;
211 low =
cube_interp(frac, tl[idx], tl[idx+1], tl[idx+2], tl[idx+3]);
212 high =
cube_interp(frac, th[idx], th[idx+1], th[idx+2], th[idx+3]);
static void blo_hd_set_freq(blo_h_osc *this, const float f)
Definition blo.h:112
static float blo_hs_run_cub(blo_h_osc *this)
Definition blo.h:156
void blo_h_free(blo_h_osc *osc)
Definition blo.c:274
void blo_h_tables_free(blo_h_tables *tables)
Definition blo.c:243
static float blo_hs_run_lin(blo_h_osc *this)
Definition blo.h:138
blo_h_osc * blo_h_new(blo_h_tables *tables, unsigned int wave, float sample_rate)
Definition blo.c:255
blo_h_tables * blo_h_tables_new(int table_size)
Definition blo.c:39
#define BLO_N_HARMONICS
Definition blo.h:37
#define BLO_N_WAVES
Definition blo.h:27
static float blo_hd_run_cub(blo_h_osc *const this)
Definition blo.h:199
static float blo_hd_run_lin(blo_h_osc *const this)
Definition blo.h:179
static void blo_hs_set_freq(blo_h_osc *this, const float f)
Definition blo.h:95
struct huft * t
Definition inflate.c:943
unsigned f
Definition inflate.c:1572
#define LIN_INTERP(f, a, b)
Definition ladspa-util.h:133
#define f_abs(j)
Definition ladspa-util.h:185
static float cube_interp(const float fr, const float inm1, const float in, const float inp1, const float inp2)
Definition ladspa-util.h:136
static int f_round(float f)
Definition ladspa-util.h:175
float sample_rate
Definition blo.h:66
int ph_mask
Definition blo.h:72
blo_fixp ph
Definition blo.h:69
int table_mask
Definition blo.h:73
int topbit
Definition blo.h:75
unsigned int wave
Definition blo.h:68
float * table
Definition blo.h:76
int table_size
Definition blo.h:74
blo_fixp om
Definition blo.h:70
blo_h_tables * tables
Definition blo.h:65
float * table_b
Definition blo.h:77
float ph_coef
Definition blo.h:71
float nyquist
Definition blo.h:67
float xfade
Definition blo.h:78
size_t alloc_size
Definition blo.h:50
int table_size
Definition blo.h:51
float * h_tables[BLO_N_WAVES][BLO_N_HARMONICS]
Definition blo.h:48
int store_type
Definition blo.h:53
float * alloc_space
Definition blo.h:49
int table_mask
Definition blo.h:52
unsigned short fr
Definition blo.h:59
short in
Definition blo.h:60
int all
Definition blo.h:57
typedef int(UZ_EXP MsgFn)()