IsStreamingFromDisk

This commit is contained in:
Glenn Maynard
2004-08-21 07:01:54 +00:00
parent 00bf5e9639
commit ed2939b205
7 changed files with 14 additions and 1 deletions
+7 -1
View File
@@ -156,8 +156,9 @@ 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; }
int GetSampleRate() const { return 44100; }
SoundReader *Copy() const { return new RageSoundReader_Silence; } SoundReader *Copy() const { return new RageSoundReader_Silence; }
int GetSampleRate() const { return 44100; }
bool IsStreamingFromDisk() const { return false; }
}; };
@@ -790,6 +791,11 @@ int RageSound::GetSampleRate() const
return Sample->GetSampleRate(); return Sample->GetSampleRate();
} }
bool RageSound::IsStreamingFromDisk() const
{
ASSERT( Sample );
return Sample->IsStreamingFromDisk();
}
bool RageSound::SetPositionFrames( int frames ) bool RageSound::SetPositionFrames( int frames )
{ {
+2
View File
@@ -22,6 +22,7 @@ public:
virtual float GetVolume() const = 0; virtual float GetVolume() const = 0;
virtual int GetID() const = 0; virtual int GetID() const = 0;
virtual CString GetLoadedFilePath() const = 0; virtual CString GetLoadedFilePath() const = 0;
virtual bool IsStreamingFromDisk() const = 0;
}; };
/* These are parameters to play a sound. These are normally changed before playing begins, /* These are parameters to play a sound. These are normally changed before playing begins,
@@ -104,6 +105,7 @@ public:
float GetLengthSeconds(); float GetLengthSeconds();
float GetPositionSeconds( bool *approximate=NULL, RageTimer *Timestamp=NULL ) const; float GetPositionSeconds( bool *approximate=NULL, RageTimer *Timestamp=NULL ) const;
int GetSampleRate() const; int GetSampleRate() const;
bool IsStreamingFromDisk() const;
bool SetPositionSeconds( float fSeconds ); bool SetPositionSeconds( float fSeconds );
CString GetLoadedFilePath() const { return m_sFilePath; } CString GetLoadedFilePath() const { return m_sFilePath; }
bool IsPlaying() const { return playing; } bool IsPlaying() const { return playing; }
+1
View File
@@ -22,6 +22,7 @@ public:
virtual SoundReader *Copy() const = 0; virtual SoundReader *Copy() const = 0;
virtual int GetSampleRate() const = 0; virtual int GetSampleRate() const = 0;
virtual unsigned GetNumChannels() const { return 2; } /* 1 or 2 */ virtual unsigned GetNumChannels() const { return 2; } /* 1 or 2 */
virtual bool IsStreamingFromDisk() const = 0;
bool Error() const { return !error.empty(); } bool Error() const { return !error.empty(); }
string GetError() const { return error; } string GetError() const { return error; }
@@ -23,6 +23,7 @@ public:
OPEN_FATAL_ERROR=2, OPEN_FATAL_ERROR=2,
}; };
virtual OpenResult Open(CString filename) = 0; virtual OpenResult Open(CString filename) = 0;
virtual bool IsStreamingFromDisk() const { return true; }
static SoundReader *OpenFile( CString filename, CString &error ); static SoundReader *OpenFile( CString filename, CString &error );
private: private:
+1
View File
@@ -46,6 +46,7 @@ public:
int Read(char *buf, unsigned len); int Read(char *buf, unsigned len);
int GetSampleRate() const { return samplerate; } int GetSampleRate() const { return samplerate; }
unsigned GetNumChannels() const { return channels; } unsigned GetNumChannels() const { return channels; }
bool IsStreamingFromDisk() const { return false; }
SoundReader *Copy() const; SoundReader *Copy() const;
~SoundReader_Preload() { } ~SoundReader_Preload() { }
@@ -33,6 +33,7 @@ public:
int GetSampleRate() const { return samplerate; } int GetSampleRate() const { return samplerate; }
unsigned GetNumChannels() const { return source->GetNumChannels(); } unsigned GetNumChannels() const { return source->GetNumChannels(); }
bool IsStreamingFromDisk() const { return source->IsStreamingFromDisk(); }
}; };
#endif #endif
@@ -25,6 +25,7 @@ public:
int GetSampleRate() const { return samplerate; } int GetSampleRate() const { return samplerate; }
unsigned GetNumChannels() const { return source->GetNumChannels(); } unsigned GetNumChannels() const { return source->GetNumChannels(); }
bool IsStreamingFromDisk() const { return source->IsStreamingFromDisk(); }
enum { BUFSIZE = 4096 }; enum { BUFSIZE = 4096 };