better average
This commit is contained in:
parent
c343f3cd0a
commit
2620b812bf
1 changed files with 2 additions and 2 deletions
|
@ -13,9 +13,9 @@ void callback(void *_, Uint8 *stream, int size) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
double tmp = 0.;
|
double tmp = 0.;
|
||||||
for (signed short *stream16 = (signed short *)stream; i < size / 2; ++i) {
|
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) {
|
void initMusic(Mix_Chunk *music, const char *filename) {
|
||||||
|
|
Reference in a new issue