1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-06 21:26:56 +02:00

#9 apply sample volume

This commit is contained in:
XProger
2016-10-11 00:02:37 +03:00
parent 5a99d547ba
commit f6cb9c5000
2 changed files with 7 additions and 1 deletions

View File

@@ -174,7 +174,7 @@ struct Controller {
if (b.chance == 0 || (rand() & 0x7fff) <= b.chance) { if (b.chance == 0 || (rand() & 0x7fff) <= b.chance) {
uint32 c = level->soundOffsets[b.offset + rand() % ((b.flags & 0xFF) >> 2)]; uint32 c = level->soundOffsets[b.offset + rand() % ((b.flags & 0xFF) >> 2)];
void *p = &level->soundData[c]; 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);
} }
} }

View File

@@ -297,6 +297,12 @@ namespace Sound {
} }
i += res; 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; return true;
} }