Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
gslwaveosc.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __GSL_WAVE_OSC_H__
3 #define __GSL_WAVE_OSC_H__
4 
5 #include <bse/gsldefs.hh>
6 #include <bse/gslwavechunk.hh>
7 
8 
9 #define GSL_WAVE_OSC_FILTER_ORDER (8) /* <= GslConfig.wave_chunk_padding ! */
10 
11 typedef struct
12 {
13  GslLong start_offset;
14  gint play_dir, channel;
15 
16  gpointer wchunk_data;
17  GslWaveChunk* (*lookup_wchunk) (gpointer wchunk_data,
18  gfloat freq,
19  gfloat velocity);
20 
21  gfloat fm_strength; /* linear: 0..1, exponential: n_octaves */
22  guint exponential_fm : 1;
23  gfloat cfreq; /* for ifreq == NULL */
25 
26 typedef struct
27 {
28  GslWaveOscConfig config;
29  guint last_mode;
30  gfloat last_sync_level, last_freq_level, last_mod_level;
31  GslWaveChunkBlock block;
32  gfloat *x; /* pointer into block */
33  guint cur_pos, istep; /* FIXME */
34  gdouble a[GSL_WAVE_OSC_FILTER_ORDER + 1]; /* order */
35  gdouble b[GSL_WAVE_OSC_FILTER_ORDER + 1]; /* reversed order */
36  gdouble y[GSL_WAVE_OSC_FILTER_ORDER + 1];
37  guint j; /* y[] index */
38  GslWaveChunk *wchunk;
39  gfloat mix_freq; /* bse_engine_sample_freq() */
40  gfloat step_factor;
41  gboolean done; /* FIXME. caution, this is TRUE only if
42  * (play_dir < 0 && cur_pos < 0) ||
43  * (play_dir > 0 && cur_pos > wchunk.length)
44  */
46 
47 
48 void gsl_wave_osc_config (GslWaveOscData *wosc,
49  GslWaveOscConfig *config);
50 void gsl_wave_osc_reset (GslWaveOscData *wosc);
51 gboolean gsl_wave_osc_process (GslWaveOscData *wosc,
52  guint n_values,
53  const gfloat *ifreq,
54  const gfloat *mod,
55  const gfloat *sync,
56  gfloat *mono_out);
57 void gsl_wave_osc_retrigger (GslWaveOscData *wosc,
58  gfloat freq);
59 void gsl_wave_osc_set_filter (GslWaveOscData *wosc,
60  gfloat freq,
61  gboolean clear_state);
62 
63 void gsl_wave_osc_init (GslWaveOscData *wosc);
64 void gsl_wave_osc_shutdown (GslWaveOscData *wosc);
65 GslLong gsl_wave_osc_cur_pos (GslWaveOscData *wosc);
66 
67 /* setup:
68  * wosc = g_new0 (GslWaveOscData, 1);
69  * wosc->mix_freq = bse_engine_sample_freq ();
70  */
71 
72 
73 
74 #endif /* __GSL_WAVE_OSC_H__ */
sync
Definition: gslwaveosc.hh:26
Definition: gslwaveosc.hh:11