summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2021-01-01 16:43:26 +0100
committerFilip Gawin <filip.gawin@zoho.com>2021-01-01 16:43:26 +0100
commitb3581bc0b4eb40cefe9261dae7a7ae70c16322d5 (patch)
treee713b64621667b39a21ff9e74aee000311a6b93b
parentsmall CWorld fixes (diff)
downloadre3-b3581bc0b4eb40cefe9261dae7a7ae70c16322d5.tar
re3-b3581bc0b4eb40cefe9261dae7a7ae70c16322d5.tar.gz
re3-b3581bc0b4eb40cefe9261dae7a7ae70c16322d5.tar.bz2
re3-b3581bc0b4eb40cefe9261dae7a7ae70c16322d5.tar.lz
re3-b3581bc0b4eb40cefe9261dae7a7ae70c16322d5.tar.xz
re3-b3581bc0b4eb40cefe9261dae7a7ae70c16322d5.tar.zst
re3-b3581bc0b4eb40cefe9261dae7a7ae70c16322d5.zip
-rw-r--r--src/audio/sampman_oal.cpp30
-rw-r--r--src/core/config.h4
2 files changed, 18 insertions, 16 deletions
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index eec5ca5f..7d6f429d 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -956,33 +956,37 @@ cSampleManager::Initialise(void)
#ifdef AUDIO_CACHE
FILE *cacheFile = fcaseopen("audio\\sound.cache", "rb");
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);
fclose(cacheFile);
} else
-#endif
{
-
- for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
- {
+ debug("Cannot load audio cache\n");
+#endif
+
+ for(int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++) {
aStream[0] = new CStream(StreamedNameTable[i], ALStreamSources[0], ALStreamBuffers[0]);
-
- if ( aStream[0] && aStream[0]->IsOpened() )
- {
+
+ if(aStream[0] && aStream[0]->IsOpened()) {
uint32 tatalms = aStream[0]->GetLengthMS();
delete aStream[0];
aStream[0] = NULL;
-
+
nStreamLength[i] = tatalms;
- }
- else
+ } else
USERERROR("Can't open '%s'\n", StreamedNameTable[i]);
}
#ifdef AUDIO_CACHE
cacheFile = fcaseopen("audio\\sound.cache", "wb");
- fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
- fclose(cacheFile);
-#endif
+ if(cacheFile) {
+ debug("Saving audio cache\n");
+ fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
+ fclose(cacheFile);
+ } else {
+ debug("Cannot save audio cache\n");
+ }
}
+#endif
{
if ( !InitialiseSampleBanks() )
diff --git a/src/core/config.h b/src/core/config.h
index a9bb1a17..9f4ccd1f 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -349,9 +349,7 @@ enum Config {
// Audio
#define RADIO_SCROLL_TO_PREV_STATION
-#ifndef AUDIO_OAL // is not working yet for openal
-#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
-#endif
+#define AUDIO_CACHE
//#define PS2_AUDIO // changes audio paths for cutscenes and radio to PS2 paths, needs vbdec to support VB with MSS
// IMG