Skip to content

Commit c9a2a40

Browse files
committed
Fix the mix calculation
1 parent 86eca38 commit c9a2a40

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: shared-module/audiofreeverb/Freeverb.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ void common_hal_audiofreeverb_freeverb_set_mix(audiofreeverb_freeverb_obj_t *sel
177177

178178
void audiofreeverb_freeverb_get_mix_fixedpoint(mp_float_t mix, int16_t *mix_sample, int16_t *mix_effect) {
179179
mix = mix * (mp_float_t)MICROPY_FLOAT_CONST(2.0);
180-
*mix_sample = (int16_t)MIN((mp_float_t)MICROPY_FLOAT_CONST(2.0) - mix, (mp_float_t)MICROPY_FLOAT_CONST(1.0)) * 32767;
181-
*mix_effect = (int16_t)MIN(mix, (mp_float_t)MICROPY_FLOAT_CONST(1.0)) * 32767;
180+
*mix_sample = (int16_t)(MIN((mp_float_t)MICROPY_FLOAT_CONST(2.0) - mix, (mp_float_t)MICROPY_FLOAT_CONST(1.0)) * 32767);
181+
*mix_effect = (int16_t)(MIN(mix, (mp_float_t)MICROPY_FLOAT_CONST(1.0)) * 32767);
182182
}
183183

184184
void audiofreeverb_freeverb_reset_buffer(audiofreeverb_freeverb_obj_t *self,

0 commit comments

Comments
 (0)