Mercurial > hg > aimc
comparison branches/carfac_cpp/src/CARFAC.cpp @ 551:ca3859e0d275
comments
author | Ulf.Hammarqvist@gmail.com |
---|---|
date | Sat, 07 Apr 2012 09:59:35 +0000 |
parents | ff12d0432d9c |
children | 42f8ed31b2b1 |
comparison
equal
deleted
inserted
replaced
550:e0b20fbd7384 | 551:ca3859e0d275 |
---|---|
27 } | 27 } |
28 n_ch_ = pole_freqs_.size(); | 28 n_ch_ = pole_freqs_.size(); |
29 | 29 |
30 max_channels_per_octave_ = log(2) / log(pole_freqs_[0]/pole_freqs_[1]); | 30 max_channels_per_octave_ = log(2) / log(pole_freqs_[0]/pole_freqs_[1]); |
31 | 31 |
32 // replace with feeding this (as const ref) instead? Saves storing doubly | 32 //TODO: pass const references? |
33 car_coeffs_ = new CAR_coefficients(car_params_, fs_, pole_freqs_); | 33 car_coeffs_ = new CAR_coefficients(car_params_, fs_, pole_freqs_); |
34 ihc_coeffs_ = new IHC_coefficients(ihc_params_, fs_, n_ch_); | 34 ihc_coeffs_ = new IHC_coefficients(ihc_params_, fs_, n_ch_); |
35 agc_coeffs_ = new AGC_coefficients(agc_params_, fs_, n_ch_); | 35 agc_coeffs_ = new AGC_coefficients(agc_params_, fs_, n_ch_); |
36 | 36 |
37 // move this into AGC_coefficients constructor instead | 37 //TODO: move this into AGC_coefficients constructor instead? This style |
38 // makes me a bit wary. | |
38 agc_coeffs_->detect_scale_ = agc_params_->detect_scale_ / | 39 agc_coeffs_->detect_scale_ = agc_params_->detect_scale_ / |
39 (ihc_coeffs_->saturation_output_ * | 40 (ihc_coeffs_->saturation_output_ * |
40 agc_coeffs_->agc_gain_); | 41 agc_coeffs_->agc_gain_); |
41 | 42 |
42 | 43 |
43 } | 44 } |
44 | 45 |
45 //move this somewhere else? | 46 //TODO: move this somewhere else? |
46 | |
47 float CARFAC::ERB_Hz(float cf_hz){ | 47 float CARFAC::ERB_Hz(float cf_hz){ |
48 return ERB_Hz(cf_hz, 1000/4.37, 1000/(24.7*4.37)); | 48 return ERB_Hz(cf_hz, 1000/4.37, 1000/(24.7*4.37)); |
49 } // is it really intentional to use this default value thing in matlab code? | 49 } // TODO: is it really intentional to use this default value thing in matlab code? |
50 float CARFAC::ERB_Hz(float cf_hz, float erb_break_freq, float erb_q){ | 50 float CARFAC::ERB_Hz(float cf_hz, float erb_break_freq, float erb_q){ |
51 return (erb_break_freq + cf_hz) / erb_q; | 51 return (erb_break_freq + cf_hz) / erb_q; |
52 } | 52 } |
53 | 53 |
54 CARFAC::~CARFAC() { | 54 CARFAC::~CARFAC() { |
55 delete car_coeffs_; | 55 delete car_coeffs_; |
56 delete ihc_coeffs_; | 56 delete ihc_coeffs_; |
57 delete agc_coeffs_; | 57 delete agc_coeffs_; |
58 | 58 |
59 //TODO: as the current design takes ownership OR creates news params, | |
60 //deletion is a ambiguos. Revise this design! | |
61 | |
59 //delete car_params_; | 62 //delete car_params_; |
60 //delete ihc_params_; | 63 //delete ihc_params_; |
61 //delete agc_params_; | 64 //delete agc_params_; |
62 } | 65 } |