| 416 | } |
| 417 | |
| 418 | void Controller::prepareDynamicParameters() { |
| 419 | for (const size_t& i : not_off_total_) { |
| 420 | if (!dynamic_on_[i]) { |
| 421 | continue; |
| 422 | } |
| 423 | if (side_empty_update_flags_[i].check()) { |
| 424 | auto side_para = side_emptys_[i].getParas(); |
| 425 | if (side_para.filter_type == zldsp::filter::kLowPass |
| 426 | || side_para.filter_type == zldsp::filter::kHighPass) { |
| 427 | side_para.q = std::sqrt(2.0) * .5; |
| 428 | } |
| 429 | side_filter_paras_[i] = side_para; |
| 430 | if (c_solo_on_ && c_solo_side_ && c_solo_idx_ == i) { |
| 431 | updateSoloFilter<false>(side_para); |
| 432 | } |
| 433 | dynamic_side_handlers_[i].setTargetGain(side_para.gain); |
| 434 | side_para.gain = 0.0; |
| 435 | side_filters_[i].updateParas(side_para); |
| 436 | } |
| 437 | if (dynamic_th_update_[i].check()) { |
| 438 | if (c_dynamic_th_relative_[i] != dynamic_th_relative_[i].load(std::memory_order::relaxed)) { |
| 439 | c_dynamic_th_relative_[i] = dynamic_th_relative_[i].load(std::memory_order::relaxed); |
| 440 | if (c_dynamic_th_learn_[i]) { |
| 441 | slow_histograms_[i].reset(); |
| 442 | learned_thresholds_[i].store(-40.0, std::memory_order::relaxed); |
| 443 | } |
| 444 | } |
| 445 | if (c_dynamic_th_learn_[i] != dynamic_th_learn_[i].load(std::memory_order::relaxed)) { |
| 446 | c_dynamic_th_learn_[i] = dynamic_th_learn_[i].load(std::memory_order::relaxed); |
| 447 | if (c_dynamic_th_learn_[i]) { |
| 448 | histograms_[i].reset(); |
| 449 | slow_histograms_[i].reset(); |
| 450 | learned_thresholds_[i].store(-40.0, std::memory_order::relaxed); |
| 451 | } |
| 452 | hist_results_[1] = 0.0; |
| 453 | } |
| 454 | if (c_dynamic_th_learn_[i]) { |
| 455 | c_dynamic_threshold_[i] = dynamic_threshold_[i].load(std::memory_order::relaxed) + 40.0; |
| 456 | } else { |
| 457 | c_dynamic_threshold_[i] = dynamic_threshold_[i].load(std::memory_order::relaxed); |
| 458 | dynamic_side_handlers_[i].setThreshold<false>(c_dynamic_threshold_[i]); |
| 459 | } |
| 460 | dynamic_side_handlers_[i].setKnee(dynamic_knee_[i].load(std::memory_order::relaxed)); |
| 461 | } |
| 462 | if (dynamic_ar_update_[i].check()) { |
| 463 | auto& follower{dynamic_side_handlers_[i].getFollower()}; |
| 464 | follower.setAttack<false>(dynamic_attack_[i].load(std::memory_order::relaxed)); |
| 465 | follower.setRelease<true>(dynamic_release_[i].load(std::memory_order::relaxed)); |
| 466 | } |
| 467 | if (dynamic_extra_update_[i].check()) { |
| 468 | if (dynamic_smooth_update_[i].check()) { |
| 469 | auto& follower{dynamic_side_handlers_[i].getFollower()}; |
| 470 | follower.setSmooth<true>(dynamic_smooth_[i].load(std::memory_order::relaxed)); |
| 471 | } |
| 472 | if (dynamic_rms_length_update_[i].check()) { |
| 473 | auto& handler{dynamic_side_handlers_[i]}; |
| 474 | handler.setRMSLength(dynamic_rms_length_[i].load(std::memory_order::relaxed)); |
| 475 | } |
nothing calls this directly
no test coverage detected