don't precache sounds by default

(makes loads faster and doesn't really matter for most things)
This commit is contained in:
Glenn Maynard
2003-01-21 02:44:35 +00:00
parent 0bff4f5add
commit aa90ddfccd
2 changed files with 17 additions and 7 deletions
+5 -2
View File
@@ -162,10 +162,13 @@ void RageSound::Fail(CString reason)
error = reason;
}
bool RageSound::Load(CString sSoundFilePath, bool cache)
bool RageSound::Load(CString sSoundFilePath, int precache)
{
LOG->Trace( "RageSound::LoadSound( '%s' )", sSoundFilePath.GetString() );
if(precache == 2)
precache = false;
/* Don't load over copies. */
ASSERT(original == this || m_sFilePath == "");
@@ -185,7 +188,7 @@ bool RageSound::Load(CString sSoundFilePath, bool cache)
/* Try to decode into full_buf. */
big = false;
if(!cache)
if(!precache)
big = true; /* Don't. */
/* Check the length, and see if we think it'll fit in the buffer. */
+12 -5
View File
@@ -39,16 +39,23 @@ public:
~RageSound();
RageSound(const RageSound &cpy);
/* If cache is true, we'll preload the entire file into memory if it's
* small enough. False is only generally used when we're going to do
* operations on a file but not actually play it (eg. to find out
* its length).
/* If cache == true (1), we'll preload the entire file into memory if
* it's small enough. If this is done, a large number of copies of the
* sound can be played without much performance penalty. This is useful
* for BM (keyed sounds), and for rapidly-repeating sound effects, such
* as the music wheel.
*
* If cache == false (0), we'll never preload the file (always stream
* it). This makes loads much faster.
*
* If cache is 2 (the default), it means "don't care". Currently, this
* means false; this may become a preference.
*
* If the file failed to load, false is returned, Error() is set
* and a null sample will be loaded. (This makes failed loads nonfatal;
* they can be ignored most of the time, so we continue to work if a file
* is broken or missing.) */
bool Load(CString fn, bool cache = true);
bool Load(CString fn, int precache = 2);
void Unload();
void SetStopMode(StopMode_t m) { StopMode = m; }