File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
shared-module/audiodelays Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ void common_hal_audiodelays_echo_set_delay_ms(audiodelays_echo_obj_t *self, mp_o
125
125
void recalculate_delay (audiodelays_echo_obj_t * self , mp_float_t f_delay_ms ) {
126
126
// Calculate the current echo buffer length in bytes
127
127
128
- uint32_t new_echo_buffer_len = self -> sample_rate / 1000.0f * f_delay_ms * sizeof (uint16_t );
128
+ uint32_t new_echo_buffer_len = self -> sample_rate / 1000.0f * f_delay_ms * ( self -> channel_count * sizeof (uint16_t ) );
129
129
130
130
// Check if our new echo is too long for our maximum buffer
131
131
if (new_echo_buffer_len > self -> max_echo_buffer_len ) {
@@ -134,6 +134,11 @@ void recalculate_delay(audiodelays_echo_obj_t *self, mp_float_t f_delay_ms) {
134
134
return ;
135
135
}
136
136
137
+ // If the echo buffer is larger then our audio buffer weird things happen
138
+ if (new_echo_buffer_len < self -> buffer_len ) {
139
+ return ;
140
+ }
141
+
137
142
self -> echo_buffer_len = new_echo_buffer_len ;
138
143
self -> current_delay_ms = f_delay_ms ;
139
144
}
You can’t perform that action at this time.
0 commit comments