MCPcopy Create free account
hub / github.com/BillyDM/Firewheel / construct_processor

Method construct_processor

crates/firewheel-nodes/src/svf.rs:480–545  ·  view source on GitHub ↗
(
        &self,
        config: &Self::Configuration,
        cx: ConstructProcessorContext,
    )

Source from the content-addressed store, hash-verified

478
479 fn construct_processor(
480 &self,
481 config: &Self::Configuration,
482 cx: ConstructProcessorContext,
483 ) -> Result<impl AudioNodeProcessor, NodeError> {
484 let cutoff_hz = self
485 .cutoff_hz
486 .clamp(config.freq_range.start, config.freq_range.end);
487 let q_factor = self
488 .q_factor
489 .clamp(config.q_range.start, config.q_range.end);
490
491 let min_gain = db_to_amp(config.gain_db_range.start);
492 let max_gain = db_to_amp(config.gain_db_range.end);
493 let mut gain = self.gain.amp().clamp(min_gain, max_gain);
494 if gain > 0.99999 && gain < 1.00001 {
495 gain = 1.0;
496 }
497
498 let mut new_self = Processor {
499 filter_0: SvfStateSimd::<CHANNELS>::default(),
500 filter_1: SvfStateSimd::<CHANNELS>::default(),
501 num_filters: 0,
502 filter_0_coeff: SvfCoeffSimd::<CHANNELS>::default(),
503 filter_1_coeff: SvfCoeffSimd::<CHANNELS>::default(),
504 filter_type: self.filter_type,
505 cutoff_hz: SmoothedParam::new(
506 cutoff_hz,
507 config.freq_range.end - config.freq_range.start,
508 SmootherConfig {
509 smooth_seconds: self.smooth_seconds,
510 ..Default::default()
511 },
512 cx.stream_info.sample_rate,
513 ),
514 q_factor: SmoothedParam::new(
515 q_factor,
516 config.q_range.end - config.q_range.start,
517 SmootherConfig {
518 smooth_seconds: self.smooth_seconds,
519 ..Default::default()
520 },
521 cx.stream_info.sample_rate,
522 ),
523 gain: SmoothedParam::new(
524 gain,
525 max_gain - min_gain,
526 SmootherConfig {
527 smooth_seconds: self.smooth_seconds,
528 ..Default::default()
529 },
530 cx.stream_info.sample_rate,
531 ),
532 freq_range: config.freq_range.clone(),
533 q_range: config.q_range.clone(),
534 gain_range: min_gain..max_gain,
535 coeff_update_mask: self.coeff_update_factor.mask(),
536 params_changed: false,
537 };

Callers

nothing calls this directly

Calls 7

db_to_ampFunction · 0.85
clampMethod · 0.80
ampMethod · 0.80
maskMethod · 0.80
update_coefficientsMethod · 0.80
target_valueMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected