@@ -19,7 +19,7 @@ use firewheel_core::{
1919 volume:: { Volume , DEFAULT_AMP_EPSILON } ,
2020 } ,
2121 event:: { NodeEventList , NodeEventType , SequenceCommand } ,
22- node:: { AudioNode , AudioNodeInfo , AudioNodeProcessor , ProcInfo , ProcessStatus , ScratchBuffers } ,
22+ node:: { AudioNode , AudioNodeInfo , AudioNodeProcessor , ProcBuffers , ProcInfo , ProcessStatus } ,
2323 sample_resource:: SampleResource ,
2424 SilenceMask , StreamInfo ,
2525} ;
@@ -737,11 +737,9 @@ impl SamplerProcessor {
737737impl AudioNodeProcessor for SamplerProcessor {
738738 fn process (
739739 & mut self ,
740- _inputs : & [ & [ f32 ] ] ,
741- outputs : & mut [ & mut [ f32 ] ] ,
742- mut events : NodeEventList ,
740+ buffers : ProcBuffers ,
743741 proc_info : & ProcInfo ,
744- _scratch_buffers : ScratchBuffers ,
742+ mut events : NodeEventList ,
745743 ) -> ProcessStatus {
746744 events. for_each ( |event| match event {
747745 NodeEventType :: SequenceCommand ( command) => {
@@ -752,7 +750,7 @@ impl AudioNodeProcessor for SamplerProcessor {
752750
753751 match command {
754752 SequenceCommand :: StartOrRestart { delay } => {
755- self . stop ( proc_info. declick_values , outputs. len ( ) ) ;
753+ self . stop ( proc_info. declick_values , buffers . outputs . len ( ) ) ;
756754
757755 self . playback_state = PlaybackState :: Playing ;
758756
@@ -808,7 +806,7 @@ impl AudioNodeProcessor for SamplerProcessor {
808806 }
809807 }
810808 SequenceCommand :: Stop => {
811- self . stop ( proc_info. declick_values , outputs. len ( ) ) ;
809+ self . stop ( proc_info. declick_values , buffers . outputs . len ( ) ) ;
812810
813811 self . playback_state = PlaybackState :: Stopped ;
814812 }
@@ -824,9 +822,9 @@ impl AudioNodeProcessor for SamplerProcessor {
824822 params,
825823 start_immediately,
826824 } => {
827- self . stop ( proc_info. declick_values , outputs. len ( ) ) ;
825+ self . stop ( proc_info. declick_values , buffers . outputs . len ( ) ) ;
828826
829- self . set_sequence ( & mut params. sequence , outputs. len ( ) ) ;
827+ self . set_sequence ( & mut params. sequence , buffers . outputs . len ( ) ) ;
830828
831829 if self . params . sequence . is_none ( ) {
832830 return ;
@@ -855,13 +853,17 @@ impl AudioNodeProcessor for SamplerProcessor {
855853 + ( seconds. fract ( ) * self . sample_rate ) . round ( ) as u64
856854 } ;
857855
858- self . set_playhead ( playhead_frames, proc_info. declick_values , outputs. len ( ) ) ;
856+ self . set_playhead (
857+ playhead_frames,
858+ proc_info. declick_values ,
859+ buffers. outputs . len ( ) ,
860+ ) ;
859861 }
860862 SamplerEvent :: SetPlayheadSamples ( playhead_frames) => {
861863 self . set_playhead (
862864 * playhead_frames,
863865 proc_info. declick_values ,
864- outputs. len ( ) ,
866+ buffers . outputs . len ( ) ,
865867 ) ;
866868 }
867869 }
@@ -907,7 +909,7 @@ impl AudioNodeProcessor for SamplerProcessor {
907909 . do_loop ( sample_state. num_times_looped_back ) ;
908910
909911 let ( finished, n_channels) = self . process_internal (
910- outputs,
912+ buffers . outputs ,
911913 proc_info. frames ,
912914 looping,
913915 proc_info. declick_values ,
@@ -938,7 +940,12 @@ impl AudioNodeProcessor for SamplerProcessor {
938940 }
939941 }
940942
941- for ( i, out_buf) in outputs. iter_mut ( ) . enumerate ( ) . skip ( num_filled_channels) {
943+ for ( i, out_buf) in buffers
944+ . outputs
945+ . iter_mut ( )
946+ . enumerate ( )
947+ . skip ( num_filled_channels)
948+ {
942949 if !proc_info. out_silence_mask . is_channel_silent ( i) {
943950 out_buf[ ..proc_info. frames ] . fill ( 0.0 ) ;
944951 }
@@ -960,7 +967,7 @@ impl AudioNodeProcessor for SamplerProcessor {
960967 let copy_frames = proc_info. frames . min ( declicker. frames_left ) ;
961968 let start_frame = fade_out_frames - declicker. frames_left ;
962969
963- for ( out_buf, tmp_buf) in outputs. iter_mut ( ) . zip ( tmp_buffers. iter ( ) ) {
970+ for ( out_buf, tmp_buf) in buffers . outputs . iter_mut ( ) . zip ( tmp_buffers. iter ( ) ) {
964971 for ( os, & ts) in out_buf[ ..copy_frames]
965972 . iter_mut ( )
966973 . zip ( tmp_buf[ start_frame..start_frame + copy_frames] . iter ( ) )
@@ -978,10 +985,10 @@ impl AudioNodeProcessor for SamplerProcessor {
978985 }
979986 }
980987
981- let out_silence_mask = if num_filled_channels >= outputs. len ( ) {
988+ let out_silence_mask = if num_filled_channels >= buffers . outputs . len ( ) {
982989 SilenceMask :: NONE_SILENT
983990 } else {
984- let mut mask = SilenceMask :: new_all_silent ( outputs. len ( ) ) ;
991+ let mut mask = SilenceMask :: new_all_silent ( buffers . outputs . len ( ) ) ;
985992 for i in 0 ..num_filled_channels {
986993 mask. set_channel ( i, false ) ;
987994 }
0 commit comments