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:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user