add "loop" file name hint for sounds

This commit is contained in:
Chris Danford
2003-07-05 22:02:42 +00:00
parent ca3cf2b6b7
commit e68bd0a3e6
8 changed files with 11 additions and 5 deletions
+6
View File
@@ -178,6 +178,12 @@ bool RageSound::Load(CString sSoundFilePath, int precache)
m_sFilePath = sSoundFilePath;
position = 0;
// Check for "loop" hint
if( m_sFilePath.Find("loop") != -1 )
SetStopMode( M_LOOP );
SoundReader_FileReader *NewSample = new RageSoundReader_LowLevel;
if(!NewSample->Open(sSoundFilePath.c_str()))
RageException::Throw( "RageSoundManager::RageSoundManager: error opening sound '%s': '%s'",
+3 -3
View File
@@ -256,7 +256,7 @@ void RageSoundManager::MixAudio(Sint16 *dst, const Sint16 *src, Uint32 len, floa
}
}
void RageSoundManager::PlayMusic(CString file, bool loop, float start_sec, float length_sec, float fade_len)
void RageSoundManager::PlayMusic(CString file, bool force_loop, float start_sec, float length_sec, float fade_len)
{
// LOG->Trace("play '%s' (current '%s')", file.c_str(), music->GetLoadedFilePath().c_str());
if(music->IsPlaying())
@@ -272,8 +272,8 @@ void RageSoundManager::PlayMusic(CString file, bool loop, float start_sec, float
return;
music->Load( file, false );
music->SetStopMode(loop? RageSound::M_LOOP:RageSound::M_STOP);
if( force_loop )
music->SetStopMode( RageSound::M_LOOP );
if(start_sec == -1)
music->SetStartSeconds();
+1 -1
View File
@@ -60,7 +60,7 @@ public:
* itself to this. */
set<RageSound *> all_sounds;
void PlayMusic(CString file, bool loop = true, float start_sec = -1, float length_sec = -1, float fade_len = 0);
void PlayMusic(CString file, bool force_loop = false, float start_sec = -1, float length_sec = -1, float fade_len = 0);
void StopMusic() { PlayMusic(""); }
static void MixAudio(Sint16 *dst, const Sint16 *src, Uint32 len, float volume);
};
+1 -1
View File
@@ -140,7 +140,7 @@ try_element_again:
{ "*.ini", NULL },
{ "*.model", "*.sprite", "*.png", "*.jpg", "*.bmp", "*.gif","*.avi", "*.mpg", "*.mpeg", NULL},
{ "*.png", NULL },
{ ".set", ".mp3", ".ogg", ".wav", NULL },
{ ".set", "*.mp3", "*.ogg", "*.wav", NULL },
};
const char **asset_masks = masks[category];