@@ -48,8 +48,8 @@ void common_hal_audiofilters_phaser_construct(audiofilters_phaser_obj_t *self,
48
48
// The below section sets up the effect's starting values.
49
49
50
50
// 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 ));
53
53
54
54
self -> nyquist = (mp_float_t )self -> base .sample_rate / 2 ;
55
55
@@ -105,14 +105,14 @@ void common_hal_audiofilters_phaser_set_stages(audiofilters_phaser_obj_t *self,
105
105
arg = 1 ;
106
106
}
107
107
108
- self -> allpass_buffer = (int32_t * )m_realloc (self -> allpass_buffer ,
108
+ self -> allpass_buffer = (int16_t * )m_realloc (self -> allpass_buffer ,
109
109
#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
111
111
#endif
112
- self -> base .channel_count * arg * sizeof (int32_t ));
112
+ self -> base .channel_count * arg * sizeof (int16_t ));
113
113
self -> stages = arg ;
114
114
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 ));
116
116
}
117
117
118
118
void audiofilters_phaser_reset_buffer (audiofilters_phaser_obj_t * self ,
@@ -121,8 +121,8 @@ void audiofilters_phaser_reset_buffer(audiofilters_phaser_obj_t *self,
121
121
122
122
memset (self -> buffer [0 ], 0 , self -> buffer_len );
123
123
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 ));
126
126
}
127
127
128
128
bool 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
253
253
}
254
254
}
255
255
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 );
257
257
int32_t allpass_word = 0 ;
258
258
259
259
// Update all-pass filters
@@ -262,7 +262,7 @@ audioio_get_buffer_result_t audiofilters_phaser_get_buffer(audiofilters_phaser_o
262
262
self -> allpass_buffer [j + allpass_buffer_offset ] = synthio_sat16 (synthio_sat16 (allpass_word * allpasscoef , 15 ) + word , 0 );
263
263
word = allpass_word ;
264
264
}
265
- self -> word_buffer [(bool )allpass_buffer_offset ] = word ;
265
+ self -> word_buffer [(bool )allpass_buffer_offset ] = ( int16_t ) word ;
266
266
267
267
// Add original sample + effect
268
268
word = sample_word + (int32_t )(synthio_sat16 (word * mix , 15 ));
0 commit comments