src/audio/ogg_sound_file.hpp

Go to the documentation of this file.
00001 //  SuperTux
00002 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
00003 //
00004 //  This program is free software: you can redistribute it and/or modify
00005 //  it under the terms of the GNU General Public License as published by
00006 //  the Free Software Foundation, either version 3 of the License, or
00007 //  (at your option) any later version.
00008 //
00009 //  This program is distributed in the hope that it will be useful,
00010 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //  GNU General Public License for more details.
00013 //
00014 //  You should have received a copy of the GNU General Public License
00015 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 
00017 #ifndef HEADER_SUPERTUX_AUDIO_OGG_SOUND_FILE_HPP
00018 #define HEADER_SUPERTUX_AUDIO_OGG_SOUND_FILE_HPP
00019 
00020 #include <physfs.h>
00021 #include <vorbis/vorbisfile.h>
00022 
00023 #include "audio/sound_file.hpp"
00024 
00025 class OggSoundFile : public SoundFile
00026 {
00027 public:
00028   OggSoundFile(PHYSFS_file* file, double loop_begin, double loop_at);
00029   ~OggSoundFile();
00030 
00031   size_t read(void* buffer, size_t buffer_size);
00032   void reset();
00033 
00034 private:
00035   static size_t cb_read(void* ptr, size_t size, size_t nmemb, void* source);
00036   static int cb_seek(void* source, ogg_int64_t offset, int whence);
00037   static int cb_close(void* source);
00038   static long cb_tell(void* source);
00039 
00040   PHYSFS_file*   file;
00041   OggVorbis_File vorbis_file;
00042   ogg_int64_t    loop_begin;
00043   ogg_int64_t    loop_at;
00044   size_t         normal_buffer_loop;
00045 
00046 private:
00047   OggSoundFile(const OggSoundFile&);
00048   OggSoundFile& operator=(const OggSoundFile&);
00049 };
00050 
00051 
00052 #endif
00053 
00054 /* EOF */

Generated on Mon Jun 9 03:38:16 2014 for SuperTux by  doxygen 1.5.1