From 24195ab56014f61524427bc88b023b1f10503acc Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Tue, 20 Aug 2024 17:07:34 +0300 Subject: [PATCH] properer int16_t to float scaling in .xm sampling --- townengine/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/townengine/audio.c b/townengine/audio.c index f999c6c..a66a4d1 100644 --- a/townengine/audio.c +++ b/townengine/audio.c @@ -303,7 +303,7 @@ static void audio_sample_and_mixin_channel(const struct audio_channel *channel, /* convert floats to int16_t */ for (int p = 0; p < samples_per_channel * 2; ++p) - ((int16_t *)buffer)[p] = (int16_t)(((float *)buffer)[p] * 32768.0f); + ((int16_t *)buffer)[p] = (int16_t)(((float *)buffer)[p] * (float)INT16_MAX); /* panning and mixing */ audio_mixin_streams(channel,