@@ -48,8 +48,8 @@ void common_hal_audiofilters_phaser_construct(audiofilters_phaser_obj_t *self,
4848 // The below section sets up the effect's starting values.
4949
5050 // Create buffer to hold the last processed word
51- self -> word_buffer = m_malloc_without_collect (self -> base .channel_count * sizeof (int32_t ));
52- memset (self -> word_buffer , 0 , self -> base .channel_count * sizeof (int32_t ));
51+ self -> word_buffer = m_malloc_without_collect (self -> base .channel_count * sizeof (int16_t ));
52+ memset (self -> word_buffer , 0 , self -> base .channel_count * sizeof (int16_t ));
5353
5454 self -> nyquist = (mp_float_t )self -> base .sample_rate / 2 ;
5555
@@ -105,14 +105,14 @@ void common_hal_audiofilters_phaser_set_stages(audiofilters_phaser_obj_t *self,
105105 arg = 1 ;
106106 }
107107
108- self -> allpass_buffer = (int32_t * )m_realloc (self -> allpass_buffer ,
108+ self -> allpass_buffer = (int16_t * )m_realloc (self -> allpass_buffer ,
109109 #if MICROPY_MALLOC_USES_ALLOCATED_SIZE
110- self -> base .channel_count * self -> stages * sizeof (int32_t ), // Old size
110+ self -> base .channel_count * self -> stages * sizeof (int16_t ), // Old size
111111 #endif
112- self -> base .channel_count * arg * sizeof (int32_t ));
112+ self -> base .channel_count * arg * sizeof (int16_t ));
113113 self -> stages = arg ;
114114
115- memset (self -> allpass_buffer , 0 , self -> base .channel_count * self -> stages * sizeof (int32_t ));
115+ memset (self -> allpass_buffer , 0 , self -> base .channel_count * self -> stages * sizeof (int16_t ));
116116}
117117
118118void audiofilters_phaser_reset_buffer (audiofilters_phaser_obj_t * self ,
@@ -121,8 +121,8 @@ void audiofilters_phaser_reset_buffer(audiofilters_phaser_obj_t *self,
121121
122122 memset (self -> buffer [0 ], 0 , self -> buffer_len );
123123 memset (self -> buffer [1 ], 0 , self -> buffer_len );
124- memset (self -> word_buffer , 0 , self -> base .channel_count * sizeof (int32_t ));
125- memset (self -> allpass_buffer , 0 , self -> base .channel_count * self -> stages * sizeof (int32_t ));
124+ memset (self -> word_buffer , 0 , self -> base .channel_count * sizeof (int16_t ));
125+ memset (self -> allpass_buffer , 0 , self -> base .channel_count * self -> stages * sizeof (int16_t ));
126126}
127127
128128bool common_hal_audiofilters_phaser_get_playing (audiofilters_phaser_obj_t * self ) {
@@ -253,7 +253,7 @@ audioio_get_buffer_result_t audiofilters_phaser_get_buffer(audiofilters_phaser_o
253253 }
254254 }
255255
256- int32_t word = synthio_sat16 (sample_word + synthio_sat16 (self -> word_buffer [right_channel ] * feedback , 15 ), 0 );
256+ int32_t word = synthio_sat16 (sample_word + synthio_sat16 (( int32_t ) self -> word_buffer [right_channel ] * feedback , 15 ), 0 );
257257 int32_t allpass_word = 0 ;
258258
259259 // Update all-pass filters
@@ -262,7 +262,7 @@ audioio_get_buffer_result_t audiofilters_phaser_get_buffer(audiofilters_phaser_o
262262 self -> allpass_buffer [j + allpass_buffer_offset ] = synthio_sat16 (synthio_sat16 (allpass_word * allpasscoef , 15 ) + word , 0 );
263263 word = allpass_word ;
264264 }
265- self -> word_buffer [(bool )allpass_buffer_offset ] = word ;
265+ self -> word_buffer [(bool )allpass_buffer_offset ] = ( int16_t ) word ;
266266
267267 // Add original sample + effect
268268 word = sample_word + (int32_t )(synthio_sat16 (word * mix , 15 ));
0 commit comments