SoundReader -> RageSoundReader
This commit is contained in:
@@ -148,7 +148,7 @@ void RageSound::Fail( RString sReason )
|
|||||||
m_sError = sReason;
|
m_sError = sReason;
|
||||||
}
|
}
|
||||||
|
|
||||||
class RageSoundReader_Silence: public SoundReader
|
class RageSoundReader_Silence: public RageSoundReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int GetLength() const { return 0; }
|
int GetLength() const { return 0; }
|
||||||
@@ -156,7 +156,7 @@ public:
|
|||||||
int SetPosition_Accurate(int ms) { return 0; }
|
int SetPosition_Accurate(int ms) { return 0; }
|
||||||
int SetPosition_Fast(int ms) { return 0; }
|
int SetPosition_Fast(int ms) { return 0; }
|
||||||
int Read(char *buf, unsigned len) { return 0; }
|
int Read(char *buf, unsigned len) { return 0; }
|
||||||
SoundReader *Copy() const { return new RageSoundReader_Silence; }
|
RageSoundReader *Copy() const { return new RageSoundReader_Silence; }
|
||||||
int GetSampleRate() const { return 44100; }
|
int GetSampleRate() const { return 44100; }
|
||||||
bool IsStreamingFromDisk() const { return false; }
|
bool IsStreamingFromDisk() const { return false; }
|
||||||
};
|
};
|
||||||
@@ -175,7 +175,7 @@ bool RageSound::Load( RString sSoundFilePath, bool bPrecache )
|
|||||||
|
|
||||||
/* If this sound is already preloaded and held by SOUNDMAN, just make a copy
|
/* If this sound is already preloaded and held by SOUNDMAN, just make a copy
|
||||||
* of that. Since RageSoundReader_Preload is refcounted, this is cheap. */
|
* of that. Since RageSoundReader_Preload is refcounted, this is cheap. */
|
||||||
SoundReader *pSound = SOUNDMAN->GetLoadedSound( sSoundFilePath );
|
RageSoundReader *pSound = SOUNDMAN->GetLoadedSound( sSoundFilePath );
|
||||||
if( pSound == NULL )
|
if( pSound == NULL )
|
||||||
{
|
{
|
||||||
RString error;
|
RString error;
|
||||||
@@ -214,7 +214,7 @@ bool RageSound::Load( RString sSoundFilePath, bool bPrecache )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSound::LoadSoundReader( SoundReader *pSound )
|
void RageSound::LoadSoundReader( RageSoundReader *pSound )
|
||||||
{
|
{
|
||||||
Unload();
|
Unload();
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "RageUtil_CircularBuffer.h"
|
#include "RageUtil_CircularBuffer.h"
|
||||||
#include "RageSoundPosMap.h"
|
#include "RageSoundPosMap.h"
|
||||||
|
|
||||||
class SoundReader;
|
class RageSoundReader;
|
||||||
|
|
||||||
/* Driver interface for sounds: this is what drivers see. */
|
/* Driver interface for sounds: this is what drivers see. */
|
||||||
class RageSoundBase
|
class RageSoundBase
|
||||||
@@ -106,9 +106,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool Load( RString sFile );
|
bool Load( RString sFile );
|
||||||
|
|
||||||
/* Load a SoundReader that you've set up yourself. Sample rate conversion will
|
/* Load a RageSoundReader that you've set up yourself. Sample rate conversion will
|
||||||
* be set up only if needed. Doesn't fail. */
|
* be set up only if needed. Doesn't fail. */
|
||||||
void LoadSoundReader( SoundReader *pSound );
|
void LoadSoundReader( RageSoundReader *pSound );
|
||||||
void Unload();
|
void Unload();
|
||||||
bool IsLoaded() const;
|
bool IsLoaded() const;
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
mutable RageMutex m_Mutex;
|
mutable RageMutex m_Mutex;
|
||||||
|
|
||||||
SoundReader *m_pSource;
|
RageSoundReader *m_pSource;
|
||||||
CircBuf<char> m_DataBuffer;
|
CircBuf<char> m_DataBuffer;
|
||||||
bool FillBuf( int iFrames );
|
bool FillBuf( int iFrames );
|
||||||
|
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ void RageSoundManager::DeleteSoundWhenFinished( RageSound *pSound )
|
|||||||
|
|
||||||
/* If the given path is loaded, return a copy; otherwise return NULL.
|
/* If the given path is loaded, return a copy; otherwise return NULL.
|
||||||
* It's the caller's responsibility to delete the result. */
|
* It's the caller's responsibility to delete the result. */
|
||||||
SoundReader *RageSoundManager::GetLoadedSound( const RString &sPath_ )
|
RageSoundReader *RageSoundManager::GetLoadedSound( const RString &sPath_ )
|
||||||
{
|
{
|
||||||
LockMut(g_SoundManMutex); /* lock for access to m_mapPreloadedSounds */
|
LockMut(g_SoundManMutex); /* lock for access to m_mapPreloadedSounds */
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class RageSound;
|
|||||||
class RageSoundBase;
|
class RageSoundBase;
|
||||||
class RageSoundDriver;
|
class RageSoundDriver;
|
||||||
struct RageSoundParams;
|
struct RageSoundParams;
|
||||||
class SoundReader;
|
class RageSoundReader;
|
||||||
class RageSoundReader_Preload;
|
class RageSoundReader_Preload;
|
||||||
|
|
||||||
class RageSoundManager
|
class RageSoundManager
|
||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
void DeleteSound( RageSound *pSound );
|
void DeleteSound( RageSound *pSound );
|
||||||
void DeleteSoundWhenFinished( RageSound *pSound );
|
void DeleteSoundWhenFinished( RageSound *pSound );
|
||||||
|
|
||||||
SoundReader *GetLoadedSound( const RString &sPath );
|
RageSoundReader *GetLoadedSound( const RString &sPath );
|
||||||
void AddLoadedSound( const RString &sPath, RageSoundReader_Preload *pSound );
|
void AddLoadedSound( const RString &sPath, RageSoundReader_Preload *pSound );
|
||||||
|
|
||||||
void PlayOnce( RString sPath );
|
void PlayOnce( RString sPath );
|
||||||
|
|||||||
Reference in New Issue
Block a user