00001 //------------------------------------------------------------------------------ 00002 // Lamp : Open source game middleware 00003 // Copyright (C) 2004 Junpei Ohtani ( Email : junpee@users.sourceforge.jp ) 00004 // 00005 // This library is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // This library is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with this library; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 //------------------------------------------------------------------------------ 00019 00020 /** @file 00021 * OggVorbisリーダヘッダ 00022 * @author Junpee 00023 */ 00024 00025 #ifndef OGG_VORBIS_READER_H_ 00026 #define OGG_VORBIS_READER_H_ 00027 00028 #include <Sound/Reader/SoundReader.h> 00029 #include <Core/InputOutput/FilePath.h> 00030 00031 namespace Lamp{ 00032 00033 // OggVorbisのヘッダを外部に見せないようにする 00034 class OggVorbisReaderImpl; 00035 00036 //------------------------------------------------------------------------------ 00037 /** 00038 * OggVorbisリーダ 00039 * 00040 * ov_open_callbacks()を使用すればメモリから読み込める。必要そうなら実装する。 00041 * ファイル末尾からのseekが必要なので独自パックファイルを導入する必要がある。 00042 */ 00043 class OggVorbisReader : public SoundReader{ 00044 public: 00045 /** 00046 * コンストラクタ 00047 * @param filePath ファイルパス 00048 */ 00049 OggVorbisReader(const FilePath& filePath); 00050 00051 /** 00052 * デストラクタ 00053 */ 00054 virtual ~OggVorbisReader(); 00055 00056 //-------------------------------------------------------------------------- 00057 /** 00058 * サイズの取得 00059 * @return サイズ 00060 */ 00061 virtual u_int getSize() const; 00062 00063 /** 00064 * サンプル数の取得 00065 * @return サンプル数 00066 */ 00067 virtual int getSample() const; 00068 00069 /** 00070 * チャンネル数の取得 00071 * @return チャンネル数 00072 */ 00073 virtual int getChannel() const; 00074 00075 /** 00076 * ビット数の取得 00077 * @return ビット数 00078 */ 00079 virtual int getBit() const; 00080 00081 /** 00082 * コメントの取得 00083 * @return コメント 00084 */ 00085 virtual const String& getComment(); 00086 00087 //-------------------------------------------------------------------------- 00088 /** 00089 * 位置の設定 00090 * @param cursor 設定する位置 00091 */ 00092 virtual void setCursor(u_int cursor); 00093 00094 /** 00095 * 位置の取得 00096 * @return 位置 00097 */ 00098 virtual u_int getCursor(); 00099 00100 //-------------------------------------------------------------------------- 00101 /** 00102 * ヘッダ読み込み 00103 * @return 成功すればtrue 00104 */ 00105 virtual bool readHeader(); 00106 00107 /** 00108 * 読み込み 00109 * @param buffer 読み込みバッファ 00110 * @param size 読み込みサイズ 00111 * @return 読み込んだサイズ。終端なら0、失敗すれば-1 00112 */ 00113 virtual int read(void* buffer, u_int size); 00114 00115 //-------------------------------------------------------------------------- 00116 /** 00117 * ファイルがOggVorbisファイルか 00118 * @param filePath ファイルパス 00119 * @return OggVorbisファイルならtrue 00120 */ 00121 static bool isOggVorbisFileName(const FilePath& filePath){ 00122 return filePath.getExtension().equals("ogg"); 00123 } 00124 00125 private: 00126 /** 00127 * コンストラクタ 00128 * @param implement 実装 00129 */ 00130 // OggVorbisReader(OggVorbisReaderImpl* implement); 00131 00132 // 実装クラス 00133 OggVorbisReaderImpl* implement_; 00134 00135 }; 00136 00137 //------------------------------------------------------------------------------ 00138 } // End of namespace Lamp 00139 #endif // End of OGG_VORBIS_READER_H_ 00140 //------------------------------------------------------------------------------