Use size_t rather than int64_t as the array index in AudioProvider::GetAudioWithVolume

In 32-bit builds the int64_t index resulted in two (inlined) calls to
allmul per audio sample, which took 25-50% of the total CPU time
involved in playing audio from the RAM cache.

Originally committed to SVN as r6900.
This commit is contained in:
Thomas Goyne 2012-06-13 04:16:50 +00:00
parent 998fc633b9
commit 7c461ddfcf
1 changed files with 1 additions and 1 deletions

View File

@ -76,7 +76,7 @@ void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count,
int value; int value;
// Modify // Modify
for (int64_t i=0;i<count;i++) { for (size_t i = 0; i < (size_t)count; ++i) {
value = (int)(buffer[i]*volume+0.5); value = (int)(buffer[i]*volume+0.5);
if (value < -0x8000) value = -0x8000; if (value < -0x8000) value = -0x8000;
if (value > 0x7FFF) value = 0x7FFF; if (value > 0x7FFF) value = 0x7FFF;