From cb60c4cc9c83e314c67081bb1eb2c1e0fa33abac Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Tue, 15 Jul 2025 20:49:54 +0200 Subject: [PATCH] maybe this fixes something --- filter/bs412.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filter/bs412.c b/filter/bs412.c index 5c8c97e..bc5ad16 100644 --- a/filter/bs412.c +++ b/filter/bs412.c @@ -30,7 +30,7 @@ void init_bs412(BS412Compressor* mpx, float mpx_deviation, float target_power, f float bs412_compress(BS412Compressor* mpx, float sample) { if(mpx->lookahead_counter > BS412_LOOKAHEAD) mpx->lookahead_counter = 0; - float process_sample = mpx->lookahead_samples[BS412_LOOKAHEAD-mpx->lookahead_counter]; // get sample from the other end + float process_sample = mpx->lookahead_samples[BS412_LOOKAHEAD - 1 - mpx->lookahead_counter]; // get sample from the other end mpx->lookahead_samples[mpx->lookahead_counter++] = sample; // write to the first end mpx->average += process_sample * process_sample * mpx->mpx_deviation * mpx->mpx_deviation;