@@ -72,7 +72,7 @@ void common_hal_audiodelays_chorus_construct(audiodelays_chorus_obj_t *self, uin
72
72
73
73
// Allocate the chorus buffer for the max possible delay, chorus is always 16-bit
74
74
self -> max_delay_ms = max_delay_ms ;
75
- self -> max_chorus_buffer_len = self -> base .sample_rate / MICROPY_FLOAT_CONST (1000.0 ) * max_delay_ms * (self -> base .channel_count * sizeof (uint16_t )); // bytes
75
+ self -> max_chorus_buffer_len = ( uint32_t )( self -> base .sample_rate / MICROPY_FLOAT_CONST (1000.0 ) * max_delay_ms * (self -> base .channel_count * sizeof (uint16_t ) )); // bytes
76
76
self -> chorus_buffer = m_malloc (self -> max_chorus_buffer_len );
77
77
if (self -> chorus_buffer == NULL ) {
78
78
common_hal_audiodelays_chorus_deinit (self );
@@ -126,10 +126,6 @@ void chorus_recalculate_delay(audiodelays_chorus_obj_t *self, mp_float_t f_delay
126
126
// Calculate the current chorus buffer length in bytes
127
127
uint32_t new_chorus_buffer_len = (uint32_t )(self -> base .sample_rate / MICROPY_FLOAT_CONST (1000.0 ) * f_delay_ms ) * (self -> base .channel_count * sizeof (uint16_t ));
128
128
129
- if (new_chorus_buffer_len < 0 ) { // or too short!
130
- return ;
131
- }
132
-
133
129
self -> chorus_buffer_len = new_chorus_buffer_len ;
134
130
135
131
self -> current_delay_ms = f_delay_ms ;
@@ -227,7 +223,7 @@ audioio_get_buffer_result_t audiodelays_chorus_get_buffer(audiodelays_chorus_obj
227
223
// get the effect values we need from the BlockInput. These may change at run time so you need to do bounds checking if required
228
224
shared_bindings_synthio_lfo_tick (self -> base .sample_rate , n / self -> base .channel_count );
229
225
230
- int32_t voices = MAX (synthio_block_slot_get (& self -> voices ), 1.0 );
226
+ int32_t voices = ( int32_t ) MAX (synthio_block_slot_get (& self -> voices ), 1.0 );
231
227
int32_t mix_down_scale = SYNTHIO_MIX_DOWN_SCALE (voices );
232
228
233
229
mp_float_t f_delay_ms = synthio_block_slot_get (& self -> delay_ms );
0 commit comments