comment, cleanup

This commit is contained in:
Glenn Maynard
2005-02-13 03:13:33 +00:00
parent 91e8e6a430
commit f07ac5cf74
5 changed files with 39 additions and 44 deletions
+6 -7
View File
@@ -1,6 +1,4 @@
/*
* pos_map_queue - maps one set of frame numbers to another
*/
/* pos_map_queue - A container that maps one set of frame numbers to another. */
#ifndef RAGE_SOUND_POS_MAP_H
#define RAGE_SOUND_POS_MAP_H
@@ -25,10 +23,6 @@ struct pos_map_t
/* This class maps one range of frames to another. */
class pos_map_queue
{
deque<pos_map_t> m_Queue;
void Cleanup();
public:
pos_map_queue();
pos_map_queue( const pos_map_queue &cpy );
@@ -43,6 +37,11 @@ public:
void Clear();
bool IsEmpty() const;
private:
deque<pos_map_t> m_Queue;
void Cleanup();
};
+7 -8
View File
@@ -1,17 +1,10 @@
/*
* SoundReader - Data source for a RageSound.
*/
/* SoundReader - Data source for a RageSound. */
#ifndef RAGE_SOUND_READER_H
#define RAGE_SOUND_READER_H
class SoundReader
{
mutable string error;
protected:
void SetError(string e) const { error = e; }
public:
virtual int GetLength() const = 0; /* ms */
virtual int GetLength_Fast() const { return GetLength(); } /* ms */
@@ -26,6 +19,12 @@ public:
bool Error() const { return !error.empty(); }
string GetError() const { return error; }
protected:
void SetError(string e) const { error = e; }
private:
mutable string error;
};
#endif
+6 -5
View File
@@ -1,6 +1,4 @@
/*
* SoundReader_FileReader - Simple abstract class for SoundReaders that read from files.
*/
/* SoundReader_FileReader - base class for SoundReaders that read from files. */
#ifndef RAGE_SOUND_READER_FILE_READER_H
#define RAGE_SOUND_READER_FILE_READER_H
@@ -10,12 +8,14 @@
class SoundReader_FileReader: public SoundReader
{
public:
/* Return OPEN_OK if the file is open and ready to go. Return OPEN_UNKNOWN_FILE_FORMAT
/*
* Return OPEN_OK if the file is open and ready to go. Return OPEN_UNKNOWN_FILE_FORMAT
* if the file appears to be of a different type. Return OPEN_FATAL_ERROR if
* the file appears to be the correct type, but there was an error initializing
* the file.
*
* If the file can not be opened at all, or contains no data, return OPEN_MATCH_BUT_FAIL. */
* If the file can not be opened at all, or contains no data, return OPEN_MATCH_BUT_FAIL.
*/
enum OpenResult
{
OPEN_OK,
@@ -26,6 +26,7 @@ public:
virtual bool IsStreamingFromDisk() const { return true; }
static SoundReader *OpenFile( CString filename, CString &error );
private:
static SoundReader_FileReader *TryOpenFile( CString filename, CString &error, CString format, bool &bKeepTrying );
};
+19 -21
View File
@@ -1,6 +1,4 @@
/*
* RageSoundReader_MP3 - Sound reader for MP3s
*/
/* RageSoundReader_MP3 - An interface to read MP3s via MAD. */
#ifndef RAGE_SOUND_READER_MP3_H
#define RAGE_SOUND_READER_MP3_H
@@ -13,12 +11,27 @@ struct madlib_t;
class RageSoundReader_MP3: public SoundReader_FileReader
{
public:
OpenResult Open(CString filename);
void Close();
int GetLength() const { return GetLengthConst(false); }
int GetLength_Fast() const { return GetLengthConst(true); }
int SetPosition_Accurate(int ms);
int SetPosition_Fast(int ms);
int Read(char *buf, unsigned len);
int GetSampleRate() const { return SampleRate; }
RageSoundReader_MP3();
~RageSoundReader_MP3();
RageSoundReader_MP3( const RageSoundReader_MP3 & ); /* not defined; don't use */
SoundReader *Copy() const;
private:
int SampleRate;
int Channels;
int Channels;
CString filename;
RageFile file;
madlib_t *mad;
RageFile file;
madlib_t *mad;
bool MADLIB_rewind();
@@ -34,21 +47,6 @@ public:
bool handle_first_frame();
int GetLengthInternal( bool fast );
int GetLengthConst( bool fast ) const;
public:
OpenResult Open(CString filename);
void Close();
int GetLength() const { return GetLengthConst(false); }
int GetLength_Fast() const { return GetLengthConst(true); }
int SetPosition_Accurate(int ms);
int SetPosition_Fast(int ms);
int Read(char *buf, unsigned len);
int GetSampleRate() const { return SampleRate; }
RageSoundReader_MP3();
~RageSoundReader_MP3();
RageSoundReader_MP3( const RageSoundReader_MP3 & ); /* not defined; don't use */
SoundReader *Copy() const;
};
#endif
+1 -3
View File
@@ -1,6 +1,4 @@
/*
* RageSoundReader_Preload - Preload sounds from another reader
*/
/* RageSoundReader_Preload - Preload sounds from another reader into memory. */
#ifndef RAGE_SOUND_READER_PRELOAD
#define RAGE_SOUND_READER_PRELOAD