From d17c21e091556aa30ccc3436e586b0e0f5861bb9 Mon Sep 17 00:00:00 2001 From: Thai Pangsakulyanont Date: Mon, 5 Sep 2011 16:02:51 +0700 Subject: [PATCH] Moved the unused RageSoundReader_Silence from RageSound.cpp to RageSoundReader.h and use it in AutoKeysounds.cpp. Hopefully this should fix Bug 0000500, but I don't know, can't reproduce. --- src/AutoKeysounds.cpp | 3 +++ src/RageSound.cpp | 15 --------------- src/RageSoundReader.h | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/AutoKeysounds.cpp b/src/AutoKeysounds.cpp index b536a3aa95..e7a9d00916 100644 --- a/src/AutoKeysounds.cpp +++ b/src/AutoKeysounds.cpp @@ -19,6 +19,7 @@ #include "AutoKeysounds.h" #include "GameState.h" #include "Song.h" +#include "RageSoundReader.h" #include "RageSoundReader_Chain.h" #include "RageSoundReader_ChannelSplit.h" #include "RageSoundReader_Extend.h" @@ -276,6 +277,8 @@ void AutoKeysounds::FinishLoading() else { delete pChain; + RageSoundReader_Silence *pSilence = new RageSoundReader_Silence; + m_pSharedSound = pSilence; } } ASSERT_M( m_pSharedSound, ssprintf("No keysounds were loaded for the song %s!", pSong->m_sMainTitle.c_str() )); diff --git a/src/RageSound.cpp b/src/RageSound.cpp index 0d0dc575b9..85060536e0 100644 --- a/src/RageSound.cpp +++ b/src/RageSound.cpp @@ -133,21 +133,6 @@ bool RageSound::IsLoaded() const return m_pSource != NULL; } -class RageSoundReader_Silence: public RageSoundReader -{ -public: - int GetLength() const { return 0; } - int GetLength_Fast() const { return 0; } - int SetPosition( int iFrame ) { return 1; } - int Read( float *pBuf, int iFrames ) { return RageSoundReader::END_OF_FILE; } - RageSoundReader *Copy() const { return new RageSoundReader_Silence; } - int GetSampleRate() const { return 44100; } - unsigned GetNumChannels() const { return 1; } - int GetNextSourceFrame() const { return 0; } - float GetStreamToSourceRatio() const { return 1.0f; } - RString GetError() const { return ""; } -}; - bool RageSound::Load( RString sSoundFilePath ) { diff --git a/src/RageSoundReader.h b/src/RageSoundReader.h index ccb99351cd..6084b7e888 100644 --- a/src/RageSoundReader.h +++ b/src/RageSoundReader.h @@ -43,6 +43,22 @@ public: int RetriedRead( float *pBuffer, int iFrames, int *iSourceFrame = NULL, float *fRate = NULL ); }; + +class RageSoundReader_Silence: public RageSoundReader +{ +public: + int GetLength() const { return 0; } + int GetLength_Fast() const { return 0; } + int SetPosition( int iFrame ) { return 1; } + int Read( float *pBuf, int iFrames ) { return RageSoundReader::END_OF_FILE; } + RageSoundReader *Copy() const { return new RageSoundReader_Silence; } + int GetSampleRate() const { return 44100; } + unsigned GetNumChannels() const { return 1; } + int GetNextSourceFrame() const { return 0; } + float GetStreamToSourceRatio() const { return 1.0f; } + RString GetError() const { return ""; } +}; + #endif /*