diff --git a/src/controller.h b/src/controller.h index b84eff5..f7cc395 100644 --- a/src/controller.h +++ b/src/controller.h @@ -174,7 +174,7 @@ struct Controller { if (b.chance == 0 || (rand() & 0x7fff) <= b.chance) { uint32 c = level->soundOffsets[b.offset + rand() % ((b.flags & 0xFF) >> 2)]; void *p = &level->soundData[c]; - Sound::play(new Stream(p, 1024 * 1024), b.volume / 255.0f, 0.0f, Sound::Flags::PAN); + Sound::play(new Stream(p, 1024 * 1024), (float)b.volume / 0xFFFF, 0.0f, Sound::Flags::PAN); } } diff --git a/src/sound.h b/src/sound.h index 8517163..071915f 100644 --- a/src/sound.h +++ b/src/sound.h @@ -297,6 +297,12 @@ namespace Sound { } i += res; } + + if (volume != 1.0f) + for (int j = 0; j < i; j++) { + frames[j].L = int(frames[j].L * volume); + frames[j].R = int(frames[j].R * volume); + } return true; }