don't precache sounds by default
(makes loads faster and doesn't really matter for most things)
This commit is contained in:
@@ -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. */
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user