BEAST/BSE - Better Audio System and Sound Engine
0.8.2
|
00001 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html 00002 #ifndef __GSL_OSCILLATOR_H__ 00003 #define __GSL_OSCILLATOR_H__ 00004 00005 #include <bse/gsldefs.hh> 00006 #include <bse/gslosctable.hh> 00007 00008 #ifdef __cplusplus 00009 extern "C" { 00010 #endif /* __cplusplus */ 00011 00012 00013 /* --- structures --- */ 00014 typedef struct 00015 { 00016 GslOscTable *table; 00017 guint exponential_fm : 1; 00018 gfloat fm_strength; /* linear: 0..1, exponential: n_octaves */ 00019 gfloat self_fm_strength; /* 0..1 */ 00020 gfloat phase; /* -0.5..+0.5 */ 00021 gfloat cfreq; /* for ifreq == NULL */ 00022 gfloat pulse_width; /* 0..1 */ 00023 gfloat pulse_mod_strength; /* 0..0.5 */ 00024 double transpose_factor; /* -132..0..+132 */ 00025 gint fine_tune; /* -100..+100 */ 00026 } GslOscConfig; 00027 typedef struct 00028 { 00029 GslOscConfig config; 00030 guint last_mode; 00031 guint32 cur_pos, last_pos; 00032 gfloat last_sync_level; 00033 gdouble last_freq_level; 00034 gfloat last_pwm_level; 00035 GslOscWave wave; 00036 /* pwm */ 00037 guint32 pwm_offset; 00038 gfloat pwm_max, pwm_center; 00039 } GslOscData; 00040 00041 00042 /* --- Oscillator --- */ 00043 void gsl_osc_config (GslOscData *osc, 00044 GslOscConfig *config); 00045 void gsl_osc_reset (GslOscData *osc); 00046 void gsl_osc_process (GslOscData *osc, 00047 guint n_values, 00048 const gfloat *ifreq, 00049 const gfloat *imod, 00050 const gfloat *isync, 00051 gfloat *mono_out, 00052 gfloat *sync_out); 00053 void gsl_osc_process_pulse (GslOscData *osc, 00054 guint n_values, 00055 const gfloat *ifreq, 00056 const gfloat *imod, 00057 const gfloat *isync, 00058 const gfloat *ipwm, 00059 gfloat *mono_out, 00060 gfloat *sync_out); 00061 00062 00063 00064 00065 #ifdef __cplusplus 00066 } 00067 #endif /* __cplusplus */ 00068 00069 #endif /* __GSL_OSCILLATOR_H__ */