📄 reverb.h
字号:
/* TiMidity++ -- MIDI to WAVE converter and player Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp> Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*//* * REVERB EFFECT FOR TIMIDITY++-1.X (Version 0.06e 1999/1/28) * * Copyright (C) 1997,1998,1999 Masaki Kiryu <mkiryu@usa.net> * (http://w3mb.kcom.ne.jp/~mkiryu/) * * reverb.h * */#ifndef ___REVERB_H_#define ___REVERB_H_#define DEFAULT_REVERB_SEND_LEVEL 40extern int opt_reverb_control;extern void set_dry_signal(int32 *, int32);extern void set_dry_signal_xg(int32 *, int32, int32);extern void mix_dry_signal(int32 *, int32);extern void free_effect_buffers(void);/* *//* Effect Utitities *//* *//*! simple delay */typedef struct { int32 *buf, size, index;} delay;/*! Pink Noise Generator */typedef struct { float b0, b1, b2, b3, b4, b5, b6;} pink_noise;extern void init_pink_noise(pink_noise *);extern float get_pink_noise(pink_noise *);extern float get_pink_noise_light(pink_noise *);#ifndef SINE_CYCLE_LENGTH#define SINE_CYCLE_LENGTH 1024#endif/*! LFO */typedef struct { int32 buf[SINE_CYCLE_LENGTH]; int32 count, cycle; /* in samples */ int32 icycle; /* proportional to (SINE_CYCLE_LENGTH / cycle) */ int type; /* current content of its buffer */ double freq; /* in Hz */} lfo;enum { LFO_NONE = 0, LFO_SINE, LFO_TRIANGULAR,};/*! modulated delay with allpass interpolation */typedef struct { int32 *buf, size, rindex, windex, hist; int32 ndelay, depth; /* in samples */} mod_delay;/*! modulated allpass filter with allpass interpolation */typedef struct { int32 *buf, size, rindex, windex, hist; int32 ndelay, depth; /* in samples */ double feedback; int32 feedbacki;} mod_allpass;/*! Moog VCF (resonant IIR state variable filter) */typedef struct { int16 freq, last_freq; /* in Hz */ double res_dB, last_res_dB; /* in dB */ int32 f, q, p; /* coefficients in fixed-point */ int32 b0, b1, b2, b3, b4;} filter_moog;/*! Moog VCF (resonant IIR state variable filter with distortion) */typedef struct { int16 freq, last_freq; /* in Hz */ double res_dB, last_res_dB; /* in dB */ double dist, last_dist, f, q, p, d, b0, b1, b2, b3, b4;} filter_moog_dist;/*! LPF18 (resonant IIR lowpass filter with waveshaping) */typedef struct { int16 freq, last_freq; /* in Hz */ double dist, res, last_dist, last_res; /* in linear */ double ay1, ay2, aout, lastin, kres, value, kp, kp1h;} filter_lpf18;/*! 1st order lowpass filter */typedef struct { double a; int32 ai, iai; /* coefficients in fixed-point */ int32 x1l, x1r;} filter_lowpass1;extern void init_filter_lowpass1(filter_lowpass1 *);/*! lowpass / highpass filter */typedef struct { double freq, q, last_freq, last_q; int32 x1l, x2l, y1l, y2l, x1r, x2r, y1r, y2r; int32 a1, a2, b1, b02;} filter_biquad;#ifndef PART_EQ_XG#define PART_EQ_XG/*! shelving filter */typedef struct { double freq, gain, q; int32 x1l, x2l, y1l, y2l, x1r, x2r, y1r, y2r; int32 a1, a2, b0, b1, b2;} filter_shelving;struct part_eq_xg { int8 bass, treble, bass_freq, treble_freq; filter_shelving basss, trebles; int8 valid;};#endif /* PART_EQ_XG */extern void calc_filter_shelving_high(filter_shelving *);extern void calc_filter_shelving_low(filter_shelving *);/*! peaking filter */typedef struct { double freq, gain, q; int32 x1l, x2l, y1l, y2l, x1r, x2r, y1r, y2r; int32 ba1, a2, b0, b2;} filter_peaking;extern void calc_filter_peaking(filter_peaking *);/*! allpass filter */typedef struct _allpass { int32 *buf, size, index; double feedback; int32 feedbacki;} allpass;/*! comb filter */typedef struct _comb { int32 *buf, filterstore, size, index; double feedback, damp1, damp2; int32 feedbacki, damp1i, damp2i;} comb;/* *//* Insertion and Variation Effect *//* */struct effect_xg_t { int8 use_msb, type_msb, type_lsb, param_lsb[16], param_msb[10], ret, pan, send_reverb, send_chorus, connection, part, mw_depth, bend_depth, cat_depth, ac1_depth, ac2_depth, cbc1_depth, cbc2_depth; struct _EffectList *ef;};extern void do_insertion_effect_gs(int32*, int32);extern void do_insertion_effect_xg(int32*, int32, struct effect_xg_t *);extern void do_variation_effect1_xg(int32*, int32);extern void init_ch_effect_xg(void);enum { EFFECT_NONE, EFFECT_EQ2, EFFECT_EQ3, EFFECT_STEREO_EQ, EFFECT_OVERDRIVE1, EFFECT_DISTORTION1, EFFECT_OD1OD2, EFFECT_CHORUS, EFFECT_FLANGER, EFFECT_SYMPHONIC, EFFECT_CHORUS_EQ3, EFFECT_STEREO_OVERDRIVE, EFFECT_STEREO_DISTORTION, EFFECT_STEREO_AMP_SIMULATOR, EFFECT_OD_EQ3, EFFECT_HEXA_CHORUS, EFFECT_DELAY_LCR, EFFECT_DELAY_LR, EFFECT_ECHO, EFFECT_CROSS_DELAY, EFFECT_DELAY_EQ2, EFFECT_LOFI, EFFECT_LOFI1, EFFECT_LOFI2, EFFECT_XG_AUTO_WAH, EFFECT_XG_AUTO_WAH_EQ2, EFFECT_XG_AUTO_WAH_OD, EFFECT_XG_AUTO_WAH_OD_EQ3,};#define MAGIC_INIT_EFFECT_INFO -1#define MAGIC_FREE_EFFECT_INFO -2struct insertion_effect_gs_t { int32 type; int8 type_lsb, type_msb, parameter[20], send_reverb, send_chorus, send_delay, control_source1, control_depth1, control_source2, control_depth2, send_eq_switch; struct _EffectList *ef;} insertion_effect_gs;enum { XG_CONN_INSERTION = 0, XG_CONN_SYSTEM = 1, XG_CONN_SYSTEM_CHORUS, XG_CONN_SYSTEM_REVERB,};#define XG_INSERTION_EFFECT_NUM 2#define XG_VARIATION_EFFECT_NUM 1struct effect_xg_t insertion_effect_xg[XG_INSERTION_EFFECT_NUM], variation_effect_xg[XG_VARIATION_EFFECT_NUM], reverb_status_xg, chorus_status_xg;typedef struct _EffectList { int type; void *info; struct _EffectEngine *engine; struct _EffectList *next_ef;} EffectList;struct _EffectEngine { int type; char *name; void (*do_effect)(int32 *, int32, struct _EffectList *); void (*conv_gs)(struct insertion_effect_gs_t *, struct _EffectList *); void (*conv_xg)(struct effect_xg_t *, struct _EffectList *); int info_size;};extern struct _EffectEngine effect_engine[];struct effect_parameter_gs_t { int8 type_msb, type_lsb; char *name; int8 param[20]; int8 control1, control2;};extern struct effect_parameter_gs_t effect_parameter_gs[];struct effect_parameter_xg_t { int8 type_msb, type_lsb; char *name; int8 param_msb[10], param_lsb[16]; int8 control;};extern struct effect_parameter_xg_t effect_parameter_xg[];extern EffectList *push_effect(EffectList *, int);extern void do_effect_list(int32 *, int32, EffectList *);extern void free_effect_list(EffectList *);/*! 2-Band EQ */typedef struct { int16 low_freq, high_freq; /* in Hz */ int16 low_gain, high_gain; /* in dB */ filter_shelving hsf, lsf;} InfoEQ2;/*! 3-Band EQ */typedef struct { int16 low_freq, high_freq, mid_freq; /* in Hz */ int16 low_gain, high_gain, mid_gain; /* in dB */ double mid_width; filter_shelving hsf, lsf; filter_peaking peak;} InfoEQ3;/*! Stereo EQ */typedef struct {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -