Mercurial > hg > aimc
comparison trunk/src/Modules/BMM/ModulePZFC.cc @ 398:3ee03a6b95a0
- All \t to two spaces (style guide compliance)
author | tomwalters |
---|---|
date | Fri, 15 Oct 2010 05:46:53 +0000 |
parents | e7bcaf1e87d5 |
children | 99f9bf0f7798 |
comparison
equal
deleted
inserted
replaced
397:7a573750b186 | 398:3ee03a6b95a0 |
---|---|
130 | 130 |
131 // Normalised maximum pole frequency | 131 // Normalised maximum pole frequency |
132 float pole_frequency = cf_max_ / sample_rate_ * (2.0f * M_PI); | 132 float pole_frequency = cf_max_ / sample_rate_ * (2.0f * M_PI); |
133 channel_count_ = 0; | 133 channel_count_ = 0; |
134 while ((pole_frequency / (2.0f * M_PI)) * sample_rate_ > cf_min_) { | 134 while ((pole_frequency / (2.0f * M_PI)) * sample_rate_ > cf_min_) { |
135 float bw = bandwidth_over_cf_ * pole_frequency + 2 * M_PI * min_bandwidth_hz_ / sample_rate_; | 135 float bw = bandwidth_over_cf_ * pole_frequency + 2 * M_PI * min_bandwidth_hz_ / sample_rate_; |
136 pole_frequency -= step_factor_ * bw; | 136 pole_frequency -= step_factor_ * bw; |
137 channel_count_++; | 137 channel_count_++; |
138 } | 138 } |
139 | 139 |
140 // Now the number of channels is known, various buffers for the filterbank | 140 // Now the number of channels is known, various buffers for the filterbank |
167 | 167 |
168 // Store the real pole frequency as the 'centre frequency' of the filterbank | 168 // Store the real pole frequency as the 'centre frequency' of the filterbank |
169 // channel | 169 // channel |
170 output_.set_centre_frequency(i, frequency); | 170 output_.set_centre_frequency(i, frequency); |
171 | 171 |
172 float zero_frequency = Minimum(M_PI, zero_factor_ * pole_frequency); | 172 float zero_frequency = Minimum(M_PI, zero_factor_ * pole_frequency); |
173 | 173 |
174 // Impulse-invariance mapping | 174 // Impulse-invariance mapping |
175 float z_plane_theta = zero_frequency * sqrt(1.0f - pow(zero_damping_, 2)); | 175 float z_plane_theta = zero_frequency * sqrt(1.0f - pow(zero_damping_, 2)); |
176 float z_plane_rho = exp(-zero_damping_ * zero_frequency); | 176 float z_plane_rho = exp(-zero_damping_ * zero_frequency); |
177 | 177 |
185 za1_[i] = a1 / a_sum; | 185 za1_[i] = a1 / a_sum; |
186 za2_[i] = a2 / a_sum; | 186 za2_[i] = a2 / a_sum; |
187 | 187 |
188 // Subtract step factor (1/n2) times current bandwidth from the pole | 188 // Subtract step factor (1/n2) times current bandwidth from the pole |
189 // frequency | 189 // frequency |
190 float bw = bandwidth_over_cf_ * pole_frequency + 2 * M_PI * min_bandwidth_hz_ / sample_rate_; | 190 float bw = bandwidth_over_cf_ * pole_frequency + 2 * M_PI * min_bandwidth_hz_ / sample_rate_; |
191 pole_frequency -= step_factor_ * bw; | 191 pole_frequency -= step_factor_ * bw; |
192 } | 192 } |
193 return true; | 193 return true; |
194 } | 194 } |
195 | 195 |
245 | 245 |
246 // Store the real pole frequency as the 'centre frequency' of the filterbank | 246 // Store the real pole frequency as the 'centre frequency' of the filterbank |
247 // channel | 247 // channel |
248 output_.set_centre_frequency(i, frequency); | 248 output_.set_centre_frequency(i, frequency); |
249 | 249 |
250 float zero_frequency = Minimum(M_PI, zero_factor_ * pole_frequency); | 250 float zero_frequency = Minimum(M_PI, zero_factor_ * pole_frequency); |
251 | 251 |
252 // Impulse-invariance mapping | 252 // Impulse-invariance mapping |
253 float z_plane_theta = zero_frequency * sqrt(1.0f - pow(zero_damping_, 2)); | 253 float z_plane_theta = zero_frequency * sqrt(1.0f - pow(zero_damping_, 2)); |
254 float z_plane_rho = exp(-zero_damping_ * zero_frequency); | 254 float z_plane_rho = exp(-zero_damping_ * zero_frequency); |
255 | 255 |
424 if (use_fitted_parameters_) { | 424 if (use_fitted_parameters_) { |
425 if (!SetPZBankCoeffsERBFitted()) | 425 if (!SetPZBankCoeffsERBFitted()) |
426 return false; | 426 return false; |
427 } else { | 427 } else { |
428 if (!SetPZBankCoeffsOrig()) | 428 if (!SetPZBankCoeffsOrig()) |
429 return false; | 429 return false; |
430 } | 430 } |
431 | 431 |
432 /*! \todo Make fMindamp and fMaxdamp user-settable? | 432 /*! \todo Make fMindamp and fMaxdamp user-settable? |
433 */ | 433 */ |
434 mindamp_ = 0.18f; | 434 mindamp_ = 0.18f; |