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

Method construct_processor

crates/firewheel-nodes/src/sampler.rs:663–740  ·  view source on GitHub ↗
(
        &self,
        config: &Self::Configuration,
        mut cx: ConstructProcessorContext,
    )

Source from the content-addressed store, hash-verified

661
662 fn construct_processor(
663 &self,
664 config: &Self::Configuration,
665 mut cx: ConstructProcessorContext,
666 ) -> Result<impl AudioNodeProcessor, NodeError> {
667 let stop_declicker_buffers = if config.num_declickers == 0 {
668 None
669 } else {
670 Some(InstanceBuffer::<f32>::new(
671 config.num_declickers as usize,
672 NonZeroUsize::new(config.channels.get().get() as usize).unwrap(),
673 cx.stream_info.declick_frames.get() as usize,
674 ))
675 };
676
677 let max_block_frames = cx.stream_info.max_block_frames.get() as usize;
678
679 let playing = *self.play;
680 let paused = !*self.play && self.play_from == PlayFrom::Resume;
681 let playback_state = if playing {
682 PlaybackState::Playing
683 } else if paused {
684 PlaybackState::Paused
685 } else {
686 PlaybackState::Stopped
687 };
688 let playback_id = if playing {
689 self.play.id()
690 } else {
691 PlaybackID::DANGLING
692 };
693
694 let proc_state = CurrentProcessorState {
695 playback_id,
696 playback_state,
697 playhead_frames: self
698 .play_from
699 .as_frames(cx.stream_info.sample_rate)
700 .unwrap_or_default(),
701 ..Default::default()
702 };
703 let mut channel = cx
704 .custom_state_mut::<SamplerState>()
705 .unwrap()
706 .channel
707 .lock()
708 .unwrap();
709 let mut shared_proc_state = if let Some(proc_state_input) = channel.proc_state_input.take()
710 {
711 proc_state_input
712 } else {
713 *channel = SharedChannel::new();
714 channel.proc_state_input.take().unwrap()
715 };
716 shared_proc_state.write(proc_state);
717
718 Ok(SamplerProcessor {
719 config: *config,
720 params: *self,

Callers

nothing calls this directly

Calls 4

idMethod · 0.80
maxMethod · 0.80
getMethod · 0.45
as_framesMethod · 0.45

Tested by

no test coverage detected