better average

This commit is contained in:
Mylloon 2023-05-03 20:03:03 +02:00
parent c343f3cd0a
commit 2620b812bf
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -13,9 +13,9 @@ void callback(void *_, Uint8 *stream, int size) {
int i = 0;
double tmp = 0.;
for (signed short *stream16 = (signed short *)stream; i < size / 2; ++i) {
tmp += stream16[i] / ((1 << 15) - 1.);
tmp += stream16[i] / ((1 << 15) + 1.);
}
average = fabs(tmp / i);
average = fabs(tmp / (i / 100.));
}
void initMusic(Mix_Chunk *music, const char *filename) {