00001 /* 00002 * RageSoundReader_Vorbisfile - Read from a Vorbisfile interface 00003 */ 00004 00005 #ifndef RAGE_SOUND_READER_VORBISFILE 00006 #define RAGE_SOUND_READER_VORBISFILE 00007 00008 #include "RageSoundReader_FileReader.h" 00009 00010 typedef struct OggVorbis_File OggVorbis_File; 00011 00012 class RageSoundReader_Vorbisfile: public SoundReader_FileReader { 00013 OggVorbis_File *vf; 00014 bool eof; 00015 int SetPosition(int ms, bool accurate); 00016 bool FillBuf(); 00017 CString filename; 00018 int read_offset; 00019 unsigned channels; 00020 00021 public: 00022 OpenResult Open(CString filename); 00023 int GetLength() const; 00024 int GetLength_Fast() const; 00025 int SetPosition_Accurate(int ms) { return SetPosition(ms, true); } 00026 int SetPosition_Fast(int ms) { return SetPosition(ms, false); } 00027 int Read(char *buf, unsigned len); 00028 int GetSampleRate() const; 00029 unsigned GetNumChannels() const { return channels; } 00030 RageSoundReader_Vorbisfile(); 00031 ~RageSoundReader_Vorbisfile(); 00032 SoundReader *Copy() const; 00033 }; 00034 00035 #endif 00036 00037 /* 00038 * Copyright (c) 2003 Glenn Maynard 00039 * All rights reserved. 00040 * 00041 * Permission is hereby granted, free of charge, to any person obtaining a 00042 * copy of this software and associated documentation files (the 00043 * "Software"), to deal in the Software without restriction, including 00044 * without limitation the rights to use, copy, modify, merge, publish, 00045 * distribute, and/or sell copies of the Software, and to permit persons to 00046 * whom the Software is furnished to do so, provided that the above 00047 * copyright notice(s) and this permission notice appear in all copies of 00048 * the Software and that both the above copyright notice(s) and this 00049 * permission notice appear in supporting documentation. 00050 * 00051 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00052 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00053 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00054 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00055 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00056 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00057 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00058 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00059 * PERFORMANCE OF THIS SOFTWARE. 00060 */ 00061