From f07ac5cf742fbdcf7e729ed248d1710e4b3c2652 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 13 Feb 2005 03:13:33 +0000 Subject: [PATCH] comment, cleanup --- stepmania/src/RageSoundPosMap.h | 13 ++++--- stepmania/src/RageSoundReader.h | 15 ++++---- stepmania/src/RageSoundReader_FileReader.h | 11 +++--- stepmania/src/RageSoundReader_MP3.h | 40 ++++++++++------------ stepmania/src/RageSoundReader_Preload.h | 4 +-- 5 files changed, 39 insertions(+), 44 deletions(-) diff --git a/stepmania/src/RageSoundPosMap.h b/stepmania/src/RageSoundPosMap.h index 75e15a4991..c4107aa52e 100644 --- a/stepmania/src/RageSoundPosMap.h +++ b/stepmania/src/RageSoundPosMap.h @@ -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 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 m_Queue; + + void Cleanup(); }; diff --git a/stepmania/src/RageSoundReader.h b/stepmania/src/RageSoundReader.h index 374204f595..c6eb0e200b 100644 --- a/stepmania/src/RageSoundReader.h +++ b/stepmania/src/RageSoundReader.h @@ -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 diff --git a/stepmania/src/RageSoundReader_FileReader.h b/stepmania/src/RageSoundReader_FileReader.h index 461e37f79f..985235cade 100644 --- a/stepmania/src/RageSoundReader_FileReader.h +++ b/stepmania/src/RageSoundReader_FileReader.h @@ -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 ); }; diff --git a/stepmania/src/RageSoundReader_MP3.h b/stepmania/src/RageSoundReader_MP3.h index 0d7992cb27..25409ec65e 100644 --- a/stepmania/src/RageSoundReader_MP3.h +++ b/stepmania/src/RageSoundReader_MP3.h @@ -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 diff --git a/stepmania/src/RageSoundReader_Preload.h b/stepmania/src/RageSoundReader_Preload.h index ad153c48ea..5e3a80c666 100644 --- a/stepmania/src/RageSoundReader_Preload.h +++ b/stepmania/src/RageSoundReader_Preload.h @@ -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