00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "AimPZFC2.h"
00020
00021 using std::ostringstream;
00022 using std::cout;
00023 using std::endl;
00024
00025 using namespace Marsyas;
00026
00027 AimPZFC2::AimPZFC2(mrs_string name):MarSystem("AimPZFC2",name)
00028 {
00029 is_initialized = false;
00030 initialized_israte = 0.0;
00031 initialized_inobservations = 0;
00032 initialized_mindamp = 0.0;
00033 initialized_maxdamp = 0.0;
00034 initialized_cf_max = 0.0;
00035 initialized_cf_min = 0.0;
00036
00037
00038
00039 channel_count_ = 1;
00040 pole_dampings_.create(1);
00041
00042
00043 is_reset = false;
00044 reseted_inobservations = 0;
00045 reseted_agc_factor = 0;
00046
00047 addControls();
00048 }
00049
00050 AimPZFC2::AimPZFC2(const AimPZFC2& a): MarSystem(a)
00051 {
00052 is_initialized = false;
00053 initialized_israte = 0.0;
00054 initialized_inobservations = 0;
00055 initialized_mindamp = 0.0;
00056 initialized_maxdamp = 0.0;
00057 initialized_cf_max = 0.0;
00058 initialized_cf_min = 0.0;
00059
00060 is_reset = false;
00061 reseted_inobservations = 0;
00062 reseted_agc_factor = 0;
00063
00064 channel_count_ = 1;
00065 pole_dampings_.create(1);
00066
00067
00068 ctrl_pole_damping_ = getctrl("mrs_real/pole_damping");
00069 ctrl_zero_damping_ = getctrl("mrs_real/zero_damping");
00070 ctrl_zero_factor_ = getctrl("mrs_real/zero_factor");
00071 ctrl_step_factor_ = getctrl("mrs_real/step_factor");
00072 ctrl_bandwidth_over_cf_ = getctrl("mrs_real/bandwidth_over_cf");
00073 ctrl_min_bandwidth_hz_ = getctrl("mrs_real/min_bandwidth_hz");
00074 ctrl_agc_factor_ = getctrl("mrs_real/agc_factor");
00075 ctrl_cf_max_ = getctrl("mrs_real/cf_max");
00076 ctrl_cf_min_ = getctrl("mrs_real/cf_min");
00077 ctrl_mindamp_ = getctrl("mrs_real/mindamp");
00078 ctrl_maxdamp_ = getctrl("mrs_real/maxdamp");
00079 ctrl_do_agc_step_ = getctrl("mrs_bool/do_agc_step");
00080 ctrl_use_fit_ = getctrl("mrs_bool/do_use_fit");
00081
00082 }
00083
00084
00085 AimPZFC2::~AimPZFC2()
00086 {
00087 }
00088
00089
00090 MarSystem*
00091 AimPZFC2::clone() const
00092 {
00093 return new AimPZFC2(*this);
00094 }
00095
00096 void
00097 AimPZFC2::addControls()
00098 {
00099 addControl("mrs_real/pole_damping", 0.12 , ctrl_pole_damping_);
00100 addControl("mrs_real/zero_damping", 0.2 , ctrl_zero_damping_);
00101 addControl("mrs_real/zero_factor", 1.4 , ctrl_zero_factor_);
00102 addControl("mrs_real/step_factor", 1.0/3.0 , ctrl_step_factor_);
00103 addControl("mrs_real/bandwidth_over_cf", 0.11 , ctrl_bandwidth_over_cf_);
00104 addControl("mrs_real/min_bandwidth_hz", 27.0 , ctrl_min_bandwidth_hz_);
00105 addControl("mrs_real/agc_factor", 12.0, ctrl_agc_factor_);
00106 addControl("mrs_real/cf_max", 6000.0, ctrl_cf_max_);
00107 addControl("mrs_real/cf_min", 100.0, ctrl_cf_min_);
00108 addControl("mrs_real/mindamp", 0.18 , ctrl_mindamp_);
00109 addControl("mrs_real/maxdamp", 0.4 , ctrl_maxdamp_);
00110 addControl("mrs_bool/do_agc_step", true , ctrl_do_agc_step_);
00111 addControl("mrs_bool/do_use_fit", false , ctrl_use_fit_);
00112 }
00113
00114 void
00115 AimPZFC2::myUpdate(MarControlPtr sender)
00116 {
00117
00118 (void) sender;
00119 MRSDIAG("AimPZFC2.cpp - AimPZFC2:myUpdate");
00120 ctrl_onSamples_->setValue(ctrl_inSamples_, NOUPDATE);
00121 ctrl_osrate_->setValue(ctrl_israte_, NOUPDATE);
00122 ctrl_onObsNames_->setValue("AimPZFC2_" + ctrl_inObsNames_->to<mrs_string>() , NOUPDATE);
00123
00124
00125
00126
00127 ctrl_onObservations_->setValue(channel_count_ , NOUPDATE);
00128
00129
00130
00131
00132 if (initialized_israte != ctrl_israte_->to<mrs_real>() ||
00133 initialized_inobservations != ctrl_inObservations_->to<mrs_natural>() ||
00134 initialized_mindamp != ctrl_mindamp_->to<mrs_real>() ||
00135 initialized_maxdamp != ctrl_maxdamp_->to<mrs_real>() ||
00136 initialized_cf_max != ctrl_cf_max_->to<mrs_real>() ||
00137 initialized_cf_min != ctrl_cf_min_->to<mrs_real>()
00138 )
00139 {
00140 is_initialized = false;
00141 }
00142
00143
00144 if (!is_initialized) {
00145 InitializeInternal();
00146 is_initialized = true;
00147 initialized_israte = ctrl_israte_->to<mrs_real>();
00148 initialized_inobservations = ctrl_inObservations_->to<mrs_natural>();
00149 initialized_mindamp = ctrl_mindamp_->to<mrs_real>();
00150 initialized_maxdamp = ctrl_maxdamp_->to<mrs_real>();
00151 initialized_cf_max = ctrl_cf_max_->to<mrs_real>();
00152 initialized_cf_min = ctrl_cf_min_->to<mrs_real>();
00153 }
00154
00155
00156
00157 if (reseted_inobservations != ctrl_inObservations_->to<mrs_natural>() ||
00158 reseted_agc_factor != ctrl_agc_factor_->to<mrs_real>()) {
00159 is_reset = false;
00160 }
00161
00162
00163 if (!is_reset) {
00164 ResetInternal();
00165 is_reset = true;
00166 reseted_inobservations = ctrl_inObservations_->to<mrs_natural>();
00167 reseted_agc_factor = ctrl_agc_factor_->to<mrs_real>();
00168 }
00169
00170 }
00171
00172 bool
00173 AimPZFC2::InitializeInternal() {
00174 channel_count_ = 1;
00175 SetPZBankCoeffs();
00176 return true;
00177 }
00178
00179 void
00180 AimPZFC2::ResetInternal() {
00181
00182
00183
00184 agc_state_.clear();
00185 agc_state_.resize(channel_count_);
00186 for (int i = 0; i < channel_count_; ++i) {
00187 agc_state_[i].clear();
00188 agc_state_[i].resize(agc_stage_count_, 0.0);
00189 }
00190
00191 state_1_.clear();
00192 state_1_.resize(channel_count_, 0.0);
00193
00194 state_2_.clear();
00195 state_2_.resize(channel_count_, 0.0);
00196
00197
00198
00199
00200
00201 previous_out_.stretch(channel_count_);
00202 previous_out_.setval(0.0);
00203
00204
00205
00206 pole_damps_mod_.clear();
00207 pole_damps_mod_.resize(channel_count_, 0.0);
00208
00209
00210 inputs_.stretch(channel_count_);
00211 inputs_.setval(0.0);
00212
00213
00214
00215
00216 offset_ = 1.0 - ctrl_agc_factor_->to<mrs_real>() * DetectFun(0.0);
00217 agc_factor_ = ctrl_agc_factor_->to<mrs_real>();
00218 AGCDampStep();
00219
00220
00221
00222
00223 for (int i = 0; i < channel_count_; ++i) {
00224 pole_damps_mod_[i] += 0.05;
00225 for (int j = 0; j < agc_stage_count_; ++j)
00226 agc_state_[i][j] += 0.05;
00227 }
00228
00229 last_input_ = 0.0;
00230 }
00231
00232 bool
00233 AimPZFC2::SetPZBankCoeffs() {
00238 if (ctrl_use_fit_->to<mrs_bool>()) {
00239 if (!SetPZBankCoeffsERBFitted())
00240 return false;
00241 } else {
00242 if (!SetPZBankCoeffsOrig())
00243 return false;
00244 }
00245
00246 double mindamp = ctrl_mindamp_->to<mrs_real>();
00247 double maxdamp = ctrl_maxdamp_->to<mrs_real>();
00248
00249 rmin_.resize(channel_count_);
00250 rmax_.resize(channel_count_);
00251 xmin_.resize(channel_count_);
00252 xmax_.resize(channel_count_);
00253
00254 for (int c = 0; c < channel_count_; ++c) {
00255
00256 rmin_[c] = exp(-mindamp * pole_frequencies_(c));
00257 rmax_[c] = exp(-maxdamp * pole_frequencies_(c));
00258
00259 xmin_[c] = rmin_[c] * cos(pole_frequencies_(c)
00260 * pow((1-pow(mindamp, 2)), 0.5));
00261 xmax_[c] = rmax_[c] * cos(pole_frequencies_(c)
00262 * pow((1-pow(maxdamp, 2)), 0.5));
00263
00264 }
00265
00266
00267 agc_stage_count_ = 4;
00268 agc_epsilons_.create(agc_stage_count_);
00269 agc_epsilons_(0) = 0.0064;
00270 agc_epsilons_(1) = 0.0016;
00271 agc_epsilons_(2) = 0.0004;
00272 agc_epsilons_(3) = 0.0001;
00273
00274 agc_gains_.create(agc_stage_count_);
00275 agc_gains_(0) = 1.0;
00276 agc_gains_(1) = 1.4;
00277 agc_gains_(2) = 2.0;
00278 agc_gains_(3) = 2.8;
00279
00280 double mean_agc_gain = 0.0;
00281 for (int c = 0; c < agc_stage_count_; ++c)
00282 mean_agc_gain += agc_gains_(c);
00283 mean_agc_gain /= static_cast<double>(agc_stage_count_);
00284
00285 for (int c = 0; c < agc_stage_count_; ++c)
00286 agc_gains_(c) /= mean_agc_gain;
00287
00288 return true;
00289 }
00290
00291 bool
00292 AimPZFC2::SetPZBankCoeffsOrig() {
00293
00294
00295
00296
00297
00298
00299
00300 double sample_rate = getctrl("mrs_real/israte")->to<mrs_real>();
00301 double cf_max = getctrl("mrs_real/cf_max")->to<mrs_real>();
00302 double cf_min = getctrl("mrs_real/cf_min")->to<mrs_real>();
00303 double bandwidth_over_cf = getctrl("mrs_real/bandwidth_over_cf")->to<mrs_real>();
00304 double min_bandwidth_hz = getctrl("mrs_real/min_bandwidth_hz")->to<mrs_real>();
00305 double step_factor = getctrl("mrs_real/step_factor")->to<mrs_real>();
00306 double pole_damping = getctrl("mrs_real/pole_damping")->to<mrs_real>();
00307 double zero_factor = getctrl("mrs_real/zero_factor")->to<mrs_real>();
00308 double zero_damping = getctrl("mrs_real/zero_damping")->to<mrs_real>();
00309
00310
00311
00312
00313
00314 double pole_frequency = cf_max / sample_rate * (2.0 * PI);
00315 channel_count_ = 0;
00316 while ((pole_frequency / (2.0 * PI)) * sample_rate > cf_min) {
00317 double bw = bandwidth_over_cf * pole_frequency + 2 * PI * min_bandwidth_hz / sample_rate;
00318 pole_frequency -= step_factor * bw;
00319 channel_count_++;
00320 }
00321
00322
00323
00324
00325
00326
00327
00328
00329 pole_dampings_.stretch(channel_count_);
00330 pole_dampings_.setval(pole_damping);
00331
00332
00333 pole_frequencies_.stretch(channel_count_);
00334 pole_frequencies_.setval(0.0);
00335
00336
00337
00338
00339 za0_.clear();
00340 za0_.resize(channel_count_, 0.0);
00341 za1_.clear();
00342 za1_.resize(channel_count_, 0.0);
00343 za2_.clear();
00344 za2_.resize(channel_count_, 0.0);
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354 pole_frequency = cf_max / sample_rate * (2.0 * PI);
00355
00356
00357
00358
00359 centre_frequencies_.clear();
00360 centre_frequencies_.resize(channel_count_);
00361
00362 for (int i = channel_count_ - 1; i > -1; --i) {
00363
00364
00365
00366 pole_frequencies_(i) = pole_frequency;
00367
00368
00369 double frequency = pole_frequency / (2.0 * PI) * sample_rate;
00370
00371
00372
00373 centre_frequencies_[i] = frequency;
00374
00375
00376 double zero_frequency = Minimum(PI, zero_factor * pole_frequency);
00377
00378
00379
00380 double z_plane_theta = zero_frequency * sqrt(1.0 - pow(zero_damping, 2));
00381 double z_plane_rho = exp(-zero_damping * zero_frequency);
00382
00383
00384
00385 double a1 = -2.0 * z_plane_rho * cos(z_plane_theta);
00386 double a2 = z_plane_rho * z_plane_rho;
00387
00388
00389 double a_sum = 1.0 + a1 + a2;
00390
00391
00392
00393
00394 za0_[i] = 1.0 / a_sum;
00395 za1_[i] = a1 / a_sum;
00396 za2_[i] = a2 / a_sum;
00397
00398
00399
00400 double bw = bandwidth_over_cf * pole_frequency + 2 * PI * min_bandwidth_hz / sample_rate;
00401
00402
00403
00404 pole_frequency -= step_factor * bw;
00405 }
00406
00407 return true;
00408 }
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498 bool
00499 AimPZFC2::SetPZBankCoeffsERBFitted() {
00500
00501
00502
00504
00505
00506
00508
00509
00510
00511
00513
00514
00515 double parameter_values[3 * 7] = {
00516
00517
00518 1.72861, 0.00000, 0.00000,
00519 0.56657, -0.93911, 0.89163,
00520 0.39469, 0.00000, 0.00000,
00521
00522 0.00000, 0.00000, 0.00000,
00523 2.00000, 0.00000, 0.00000,
00524 1.27393, 0.00000, 0.00000,
00525 11.46247, 5.46894, 0.11800
00526
00527 };
00528
00529 double sample_rate = getctrl("mrs_real/israte")->to<mrs_real>();
00530 double cf_max = getctrl("mrs_real/cf_max")->to<mrs_real>();
00531 double cf_min = getctrl("mrs_real/cf_min")->to<mrs_real>();
00532
00533
00534
00535
00536
00537
00538 double pole_frequency = cf_max / sample_rate * (2.0 * PI);
00539
00540 channel_count_ = 0;
00541 while ((pole_frequency / (2.0 * PI)) * sample_rate > cf_min) {
00542 double frequency = pole_frequency / (2.0 * PI) * sample_rate;
00543 double f_dep = ERBTools::Freq2ERB(frequency)
00544 / ERBTools::Freq2ERB(1000.0) - 1.0;
00545 double bw = ERBTools::Freq2ERBw(pole_frequency
00546 / (2.0 * PI) * sample_rate);
00547 double step_factor = 1.0
00548 / (parameter_values[4*3] + parameter_values[4 * 3 + 1]
00549 * f_dep + parameter_values[4 * 3 + 2] * f_dep * f_dep);
00550 pole_frequency -= step_factor * (bw * (2.0 * PI) / sample_rate);
00551 channel_count_++;
00552 }
00553
00554
00555
00556
00557
00558 cout << "channel_count_ = " << channel_count_ << endl;
00559 pole_dampings_.stretch(channel_count_);
00560 pole_dampings_.setval(0.0);
00561 cout << pole_dampings_ << endl;
00562
00563
00564 pole_frequencies_.stretch(channel_count_);
00565 pole_frequencies_.setval(0.0);
00566
00567
00568 za0_.clear();
00569 za0_.resize(channel_count_, 0.0);
00570 za1_.clear();
00571 za1_.resize(channel_count_, 0.0);
00572 za2_.clear();
00573 za2_.resize(channel_count_, 0.0);
00574
00575
00576
00577
00578
00579 pole_frequency = cf_max / sample_rate * (2.0 * PI);
00580
00581 for (int i = channel_count_ - 1; i > -1; --i) {
00582
00583 pole_frequencies_(i) = pole_frequency;
00584
00585
00586 double frequency = pole_frequency / (2.0 * PI) * sample_rate;
00587
00588
00589
00590
00591
00592
00593 double DpndF = ERBTools::Freq2ERB(frequency)
00594 / ERBTools::Freq2ERB(1000.0) - 1.0;
00595
00596 double p[8];
00597
00598
00599 for (int param = 0; param < 7; ++param)
00600 p[param] = parameter_values[param * 3]
00601 + parameter_values[param * 3 + 1] * DpndF
00602 + parameter_values[param * 3 + 2] * DpndF * DpndF;
00603
00604
00605 p[7] = p[1] * pow(10.0, (p[2] / (p[1] * p[4])) * (p[6] - 60.0) / 20.0);
00606 if (p[7] < 0.2)
00607 p[7] = 0.2;
00608
00609
00610 double fERBw = ERBTools::Freq2ERBw(frequency);
00611
00612
00613 double fPBW = ((p[7] * fERBw * (2 * PI) / sample_rate) / 2)
00614 * pow(p[4], 0.5);
00615
00616
00617 double pole_damping = fPBW / sqrt(pow(pole_frequency, 2) + pow(fPBW, 2));
00618
00619
00620 pole_dampings_(i) = pole_damping;
00621
00622 cout << "pole_damping = " << pole_damping << endl;
00623
00624
00625
00626 double fZBW = ((p[0] * p[5] * fERBw * (2 * PI) / sample_rate) / 2)
00627 * pow(p[4], 0.5);
00628
00629
00630 double zero_frequency = p[5] * pole_frequency;
00631
00632 if (zero_frequency > PI) {
00633 MRSWARN("Warning: Zero frequency is above the Nyquist frequency.");
00634 MRSWARN("Continuing anyway but results may not be accurate.");
00635 }
00636
00637
00638
00639
00640
00641 double fZDamp = fZBW / sqrt(pow(zero_frequency, 2) + pow(fZBW, 2));
00642
00643
00644 double fZTheta = zero_frequency * sqrt(1.0 - pow(fZDamp, 2));
00645 double fZRho = exp(-fZDamp * zero_frequency);
00646
00647
00648 double fA1 = -2.0 * fZRho * cos(fZTheta);
00649 double fA2 = fZRho * fZRho;
00650
00651
00652 double fASum = 1.0 + fA1 + fA2;
00653 za0_[i] = 1.0 / fASum;
00654 za1_[i] = fA1 / fASum;
00655 za2_[i] = fA2 / fASum;
00656
00657
00658
00659 pole_frequency -= ((1.0 / p[4])
00660 * (fERBw * (2.0 * PI) / sample_rate));
00661 }
00662 return true;
00663 }
00664
00665 void
00666 AimPZFC2::AGCDampStep() {
00667
00668 if (detect_.size() == 0) {
00669
00670
00673 detect_.clear();
00674 double detect_zero = DetectFun(0.0);
00675 detect_.resize(channel_count_, detect_zero);
00676
00677 for (int c = 0; c < channel_count_; c++)
00678 for (int st = 0; st < agc_stage_count_; st++)
00679 agc_state_[c][st] = (1.2 * detect_[c] * agc_gains_(st));
00680 }
00681
00682 double fAGCEpsLeft = 0.3;
00683 double fAGCEpsRight = 0.3;
00684
00685 for (int c = channel_count_ - 1; c > -1; --c) {
00686 for (int st = 0; st < agc_stage_count_; ++st) {
00687
00688
00691 double fPrevAGCState;
00692 double fCurrAGCState;
00693 double fNextAGCState;
00694
00695 if (c < channel_count_ - 1)
00696 fPrevAGCState = agc_state_[c + 1][st];
00697 else
00698 fPrevAGCState = agc_state_[c][st];
00699
00700 fCurrAGCState = agc_state_[c][st];
00701
00702 if (c > 0)
00703 fNextAGCState = agc_state_[c - 1][st];
00704 else
00705 fNextAGCState = agc_state_[c][st];
00706
00707
00711 double agc_avg = fAGCEpsLeft * fPrevAGCState
00712 + (1.0 - fAGCEpsLeft - fAGCEpsRight) * fCurrAGCState
00713 + fAGCEpsRight * fNextAGCState;
00714
00715 agc_state_[c][st] = agc_avg * (1.0 - agc_epsilons_(st))
00716 + agc_epsilons_(st) * detect_[c] * agc_gains_(st);
00717 }
00718 }
00719
00720
00721
00722
00723 for (int i = 0; i < channel_count_; ++i) {
00724 double fAGCStateMean = 0.0;
00725 for (int j = 0; j < agc_stage_count_; ++j)
00726 fAGCStateMean += agc_state_[i][j];
00727
00728 fAGCStateMean /= static_cast<double>(agc_stage_count_);
00729
00730
00731 pole_damps_mod_[i] = pole_dampings_(i) *
00732 (offset_ + agc_factor_ * fAGCStateMean);
00733 }
00734 }
00735
00736 double
00737 AimPZFC2::DetectFun(double fIN)
00738 {
00739 if (fIN < 0.0)
00740 fIN = 0.0;
00741 double fDetect = Minimum(1.0, fIN);
00742 double fA = 0.25;
00743 return fA * fIN + (1.0 - fA) * (fDetect - pow(fDetect, 3) / 3.0);
00744 }
00745
00746 inline double AimPZFC2::Minimum(double a, double b)
00747 {
00748 if (a < b)
00749 return a;
00750 else
00751 return b;
00752 }
00753
00754
00755 void
00756 AimPZFC2::myProcess(realvec& in, realvec& out)
00757 {
00758 double damp_rate = 1.0 / (ctrl_maxdamp_->to<mrs_real>() - ctrl_mindamp_->to<mrs_real>());
00759 double min_damp = ctrl_mindamp_->to<mrs_real>();
00760 double interp_factor;
00761 bool do_agc = ctrl_do_agc_step_->to<mrs_bool>();
00762
00763 for (t = 0; t < inSamples_; t++)
00764 {
00765 double input_sample = in(0, t);
00766
00767
00768 input_sample = 0.5 * input_sample + 0.5 * last_input_;
00769 last_input_ = in(0, t);
00770
00771 inputs_(channel_count_ - 1) = input_sample;
00772 for (int c = 0; c < channel_count_ - 1; ++c)
00773 {
00774 inputs_(c) = previous_out_(c + 1);
00775
00776 }
00777
00778
00779
00780 for (int c = channel_count_ - 1; c > -1; --c)
00781 {
00782 interp_factor = (pole_damps_mod_[c] -min_damp) * damp_rate;
00783
00784 double x = xmin_[c] + (xmax_[c] - xmin_[c]) * interp_factor;
00785 double r = rmin_[c] + (rmax_[c] - rmin_[c]) * interp_factor;
00786
00787
00788 double fd = pole_frequencies_(c) * pole_damps_mod_[c];
00789
00790 r = r + 0.25 * fd * Minimum(0.05, fd);
00791
00792
00793 double zb1 = -2.0 * x;
00794 double zb2 = r * r;
00795
00796
00797
00798
00799 double new_state = inputs_(c) - (state_1_[c] - inputs_(c)) * zb1
00800 - (state_2_[c] - inputs_(c)) * zb2;
00801
00802
00803
00804
00805
00806
00807
00808
00809 double output = za0_[c] * new_state + za1_[c] * state_1_[c]
00810 + za2_[c] * state_2_[c];
00811
00812
00813 output -= 0.0001 * pow(output, 3);
00814
00815
00816 out(c, t) = output;
00817 detect_[c] = DetectFun(output);
00818 state_2_[c] = state_1_[c];
00819 state_1_[c] = new_state;
00820 }
00821
00822 if (do_agc)
00823 {
00824
00825
00826 AGCDampStep();
00827 }
00828
00829 for (int c = 0; c < channel_count_; ++c)
00830 previous_out_(c) = out(c,t);
00831 }
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843 }