2002-11-16 08:07:38 +00:00
|
|
|
#ifndef RANDOMSAMPLE_H
|
|
|
|
|
#define RANDOMSAMPLE_H
|
2002-03-10 10:30:45 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
2002-07-31 19:40:40 +00:00
|
|
|
Class: RandomSample
|
2002-03-10 10:30:45 +00:00
|
|
|
|
|
|
|
|
Desc: Holds multiple sounds samples and can play a random sound easily.
|
|
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-07-31 19:40:40 +00:00
|
|
|
Chris Danford
|
2002-03-10 10:30:45 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
2003-01-02 08:13:34 +00:00
|
|
|
#include "RageSound.h"
|
2002-03-10 10:30:45 +00:00
|
|
|
#include "RageUtil.h"
|
|
|
|
|
|
|
|
|
|
class RandomSample
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
RandomSample();
|
2002-11-16 08:55:46 +00:00
|
|
|
virtual ~RandomSample();
|
2002-03-10 10:30:45 +00:00
|
|
|
|
2003-03-16 07:38:40 +00:00
|
|
|
virtual bool Load( CString sFilePath, int iMaxToLoad = 1000 /*load all*/ )
|
2002-03-10 10:30:45 +00:00
|
|
|
{
|
|
|
|
|
CString sDir, sFName, sExt;
|
|
|
|
|
splitrelpath( sFilePath, sDir, sFName, sExt );
|
|
|
|
|
|
|
|
|
|
sExt.MakeLower();
|
|
|
|
|
|
2003-03-16 07:38:40 +00:00
|
|
|
if( sExt == "" ) return LoadSoundDir( sFilePath, iMaxToLoad );
|
2002-04-28 20:42:32 +00:00
|
|
|
else return LoadSound( sFilePath );
|
2002-03-10 10:30:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void PlayRandom();
|
|
|
|
|
void Stop();
|
|
|
|
|
|
|
|
|
|
private:
|
2003-03-16 07:38:40 +00:00
|
|
|
bool LoadSoundDir( CString sDir, int iMaxToLoad );
|
2002-03-10 10:30:45 +00:00
|
|
|
bool LoadSound( CString sSoundFilePath );
|
|
|
|
|
|
|
|
|
|
|
2003-01-03 05:56:28 +00:00
|
|
|
vector<RageSound*> m_pSamples;
|
2002-03-10 10:30:45 +00:00
|
|
|
int m_iIndexLastPlayed;
|
|
|
|
|
};
|
|
|
|
|
|
2002-11-16 08:07:38 +00:00
|
|
|
|
|
|
|
|
#endif
|