From c45c22999535594ec0d77c1e0f5b9ca77914ac86 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Wed, 16 Mar 2005 04:10:10 +0000 Subject: [PATCH] cleanup: don't cast bool to int --- stepmania/src/RageSound.cpp | 12 ++++++++---- stepmania/src/RageSound.h | 14 ++++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index a0f373ba9e..3abba8c70e 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -162,12 +162,16 @@ public: }; -bool RageSound::Load( CString sSoundFilePath, int precache ) +bool RageSound::Load( CString sSoundFilePath ) { - LOG->Trace( "RageSound::LoadSound( '%s' )", sSoundFilePath.c_str() ); + /* Automatically determine whether to precache */ + /* TODO: Hook this up to a pref? */ + return Load( sSoundFilePath, false ); +} - if(precache == 2) - precache = false; +bool RageSound::Load( CString sSoundFilePath, bool precache ) +{ + LOG->Trace( "RageSound::LoadSound( '%s', %d )", sSoundFilePath.c_str(), precache ); CString error; SoundReader *pSound = SoundReader_FileReader::OpenFile( sSoundFilePath, error ); diff --git a/stepmania/src/RageSound.h b/stepmania/src/RageSound.h index 57fc5e34f2..9422cebbed 100644 --- a/stepmania/src/RageSound.h +++ b/stepmania/src/RageSound.h @@ -75,23 +75,25 @@ public: RageSound(const RageSound &cpy); RageSound &operator=( const RageSound &cpy ); - /* If cache == true (1), we'll preload the entire file into memory if + /* If cache == true, 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 + * If cache == false, 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, int precache = 2); + bool Load( CString fn, bool bPrecache ); + /* + * Using this version means the "don't care" about caching. Currently, + * this always will not cache the sound; this may become a preference. + */ + bool Load( CString fn ); /* Load a SoundReader that you've set up yourself. Sample rate conversion will * be set up only if needed. Doesn't fail. */