00001 /* 00002 * 00003 * Stochastic Global Reverb Class 00004 * Header 00005 * 00006 * Brent Lehman 00007 * 30 April 2002 00008 * 00009 * 00010 */ 00011 00012 00013 #include "CSL_Core.h" 00014 00015 00016 namespace csl { 00017 00018 class LateReverb 00019 { 00020 00021 // Absorption rate parameter 00022 double a_coeff_db_per_sec; // powers of ten per second 00023 double a_coeff_exp_per_sec; // powers of e per second 00024 double a_coeff_exp_per_samp; // powers of e per sample 00025 00026 // Diffusion rate parameter 00027 double d_coeff_db_per_sec; // powers of ten per second 00028 double d_coeff_exp_per_sec; // powers of e per second 00029 double d_coeff_exp_per_samp; // powers of e per sample 00030 00031 double rho; // Surface density parameter, try a value of 1.0 00032 double delay; // No sound possible before sound makes direct path from src to ear 00033 double* current_envelope; // array holding most recently calculated envelope 00034 sample* current_IR; // array holding most recenty calculate impulse response 00035 int length; // length of current_IR 00036 00037 void _calculate_envelope_length(); 00038 void _generate_envelope(); 00039 void _generate_noise(); 00040 void _filter_noise(); 00041 void _apply_envelope(); 00042 void _generate_IR(); 00043 00044 public: 00045 00046 LateReverb(); 00047 ~LateReverb(); 00048 00049 void set_attributes(float a, float d, float r, float t); 00050 int get_length(); 00051 sample* get_IR(); 00052 bool get_IR(Buffer& irbuffer); 00053 00054 static int trim_tails(sample** ir, int* len, int num); 00055 //static void correct_for_absorption(sample* ir, int len); 00056 00057 }; 00058 00059 }
1.4.5-20051010