@@ -52,7 +52,7 @@ impl Default for AudioBufferSourceOptions {
5252#[ derive( Debug , Copy , Clone ) ]
5353struct PlaybackInfo {
5454 prev_frame_index : usize ,
55- k : f32 ,
55+ k : f64 ,
5656}
5757
5858#[ derive( Debug , Clone , Copy ) ]
@@ -704,7 +704,7 @@ impl AudioProcessor for AudioBufferSourceRenderer {
704704 let playhead = position * sample_rate;
705705 let playhead_floored = playhead. floor ( ) ;
706706 let prev_frame_index = playhead_floored as usize ; // can't be < 0.
707- let k = ( playhead - playhead_floored) as f32 ;
707+ let k = playhead - playhead_floored;
708708
709709 // Due to how buffer_time is computed, we can still run into
710710 // floating point errors and try to access a non existing index
@@ -740,10 +740,10 @@ impl AudioProcessor for AudioBufferSourceRenderer {
740740 k,
741741 } ) => {
742742 // `prev_frame_index` cannot be out of bounds
743- let prev_sample = buffer_channel[ * prev_frame_index] ;
743+ let prev_sample = buffer_channel[ * prev_frame_index] as f64 ;
744744 let next_sample = match buffer_channel. get ( prev_frame_index + 1 )
745745 {
746- Some ( val) => * val,
746+ Some ( val) => * val as f64 ,
747747 None => {
748748 let sample = if is_looping {
749749 if playback_rate >= 0. {
@@ -767,11 +767,11 @@ impl AudioProcessor for AudioBufferSourceRenderer {
767767 0.
768768 } ;
769769
770- sample
770+ sample as f64
771771 }
772772 } ;
773773
774- ( 1. - k) . mul_add ( prev_sample, k * next_sample)
774+ ( 1. - k) . mul_add ( prev_sample, k * next_sample) as f32
775775 }
776776 None => 0. ,
777777 } ;
0 commit comments