Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Port debug messagess for audio cache
  • Loading branch information
Filip Gawin committed Jan 16, 2021
1 parent 19749ef commit 6bebde8279cebec810dbc427b53b232ba7bd9619
Showing with 12 additions and 5 deletions.
  1. +12 −5 src/audio/sampman_oal.cpp
@@ -996,12 +996,14 @@ cSampleManager::Initialise(void)
#ifdef AUDIO_CACHE #ifdef AUDIO_CACHE
FILE *cacheFile = fcaseopen("audio\\sound.cache", "rb"); FILE *cacheFile = fcaseopen("audio\\sound.cache", "rb");
if (cacheFile) { if (cacheFile) {
debug("Loadind audio cache (If game crashes around here, then your cache is corrupted, remove audio/sound.cache)\n");
fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile); fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
fclose(cacheFile); fclose(cacheFile);
} else } else
#endif
{ {

debug("Cannot load audio cache\n");
#endif

for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ ) for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
{ {
aStream[0] = new CStream(StreamedNameTable[i], ALStreamSources[0], ALStreamBuffers[0], IsThisTrackAt16KHz(i) ? 16000 : 32000); aStream[0] = new CStream(StreamedNameTable[i], ALStreamSources[0], ALStreamBuffers[0], IsThisTrackAt16KHz(i) ? 16000 : 32000);
@@ -1019,10 +1021,15 @@ cSampleManager::Initialise(void)
} }
#ifdef AUDIO_CACHE #ifdef AUDIO_CACHE
cacheFile = fcaseopen("audio\\sound.cache", "wb"); cacheFile = fcaseopen("audio\\sound.cache", "wb");
fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile); if(cacheFile) {
fclose(cacheFile); debug("Saving audio cache\n");
#endif fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
fclose(cacheFile);
} else {
debug("Cannot save audio cache\n");
}
} }
#endif


{ {
if ( !InitialiseSampleBanks() ) if ( !InitialiseSampleBanks() )

0 comments on commit 6bebde8

Please sign in to comment.