mirror of
https://github.com/halpz/re3.git
synced 2025-06-30 04:26:20 +00:00
Add audio cache for faster initialization
This commit is contained in:
@ -959,6 +959,15 @@ cSampleManager::Initialise(void)
|
||||
|
||||
}
|
||||
|
||||
#ifdef AUDIO_CACHE
|
||||
TRACE("cache");
|
||||
FILE *cacheFile = fopen("audio\\sound.cache", "rb");
|
||||
if (cacheFile) {
|
||||
fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
||||
fclose(cacheFile);
|
||||
m_bInitialised = true;
|
||||
}else {
|
||||
#endif
|
||||
TRACE("cdrom");
|
||||
|
||||
S32 tatalms;
|
||||
@ -1115,7 +1124,13 @@ cSampleManager::Initialise(void)
|
||||
_bUseHDDAudio = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef AUDIO_CACHE
|
||||
cacheFile = fopen("audio\\sound.cache", "wb");
|
||||
fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
||||
fclose(cacheFile);
|
||||
}
|
||||
#endif
|
||||
|
||||
TRACE("stream");
|
||||
{
|
||||
for ( int32 i = 0; i < MAX_STREAMS; i++ )
|
||||
|
@ -604,7 +604,13 @@ cSampleManager::Initialise(void)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef AUDIO_CACHE
|
||||
FILE *cacheFile = fopen("audio\\sound.cache", "rb");
|
||||
if (cacheFile) {
|
||||
fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
||||
fclose(cacheFile);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
||||
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
|
||||
@ -622,6 +628,11 @@ cSampleManager::Initialise(void)
|
||||
else
|
||||
USERERROR("Can't open '%s'\n", StreamedNameTable[i]);
|
||||
}
|
||||
#ifdef AUDIO_CACHE
|
||||
cacheFile = fopen("audio\\sound.cache", "wb");
|
||||
fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
||||
fclose(cacheFile);
|
||||
#endif
|
||||
}
|
||||
|
||||
LoadSampleBank(SAMPLEBANK_MAIN);
|
||||
|
Reference in New Issue
Block a user