Mercurial > hg > aimc
diff branches/carfac_cpp/src/CARFAC.cpp @ 555:4de3bebec3d6
Fixed the ERB_Hz default parameter bug also in c++
Introduced FloatMatrix to build on the concept of FloatArray typedef
| author | Ulf.Hammarqvist@gmail.com |
|---|---|
| date | Sun, 08 Apr 2012 19:40:13 +0000 |
| parents | 42f8ed31b2b1 |
| children | 0fde611fcd10 |
line wrap: on
line diff
--- a/branches/carfac_cpp/src/CARFAC.cpp Sun Apr 08 14:28:55 2012 +0000 +++ b/branches/carfac_cpp/src/CARFAC.cpp Sun Apr 08 19:40:13 2012 +0000 @@ -10,9 +10,7 @@ CARFAC::CARFAC(int fs = kDefaultFs, CAR_parameters* car_params = new CAR_parameters(), IHC_parameters* ihc_params = new IHC_parameters(), - AGC_parameters* agc_params = new AGC_parameters(), - float erb_break_freq = kDefaultErbBreakFreq, - float erb_q = kDefaultErbQ) : n_ears_(0) { + AGC_parameters* agc_params = new AGC_parameters()) : n_ears_(0) { // Design is to take ownership. Preferences? Make copies, call by value, etc? car_params_ = car_params; @@ -23,7 +21,8 @@ while (pole_hz > car_params->min_pole_hz_){ pole_freqs_.push_back(pole_hz); // TODO: STL specific pole_hz = pole_hz - car_params->erb_per_step_ * - ERB_Hz(pole_hz, erb_break_freq, erb_q); + ERB_Hz(pole_hz, car_params->erb_break_freq_, + car_params->erb_q_); } n_ch_ = pole_freqs_.size(); @@ -35,18 +34,12 @@ agc_coeffs_ = new AGC_coefficients(agc_params_, fs_, n_ch_); //TODO: move this into AGC_coefficients constructor instead? This style - // makes me a bit wary. + // makes me (ulha) a bit wary. agc_coeffs_->detect_scale_ = agc_params_->detect_scale_ / (ihc_coeffs_->saturation_output_ * agc_coeffs_->agc_gain_); - - } -//TODO: move this somewhere else? -float CARFAC::ERB_Hz(float cf_hz){ - return ERB_Hz(cf_hz, kDefaultErbBreakFreq, kDefaultErbQ); -} // TODO: is it really intentional to use this default value thing in matlab code? float CARFAC::ERB_Hz(float cf_hz, float erb_break_freq, float erb_q){ return (erb_break_freq + cf_hz) / erb_q; } @@ -57,7 +50,7 @@ delete agc_coeffs_; //TODO: as the current design takes ownership OR creates news params, - //deletion is a ambiguos. Revise this design! + //deletion is a ambiguos. Revise this design? //delete car_params_; //delete ihc_params_;
