Sion Tower (demo técnica) 0.1

/home/david/programacion/iberogre-siontower/siontower/trunk/src/include/song.h

00001 /*
00002  * This file is part of SionTower.
00003  *
00004  * 
00005  * David Saltares Márquez (C) 2011
00006  * <david.saltares@gmail.com>
00007  *
00008  * 
00009  * SionTower examples are free software: you can redistribute it and/or
00010  * modify it under the terms of the GNU General Public License ad
00011  * published by the Free Software Foundation, either version 3 of the
00012  * License, or (at your option) ant later version.
00013  *
00014  * SionTower examples are distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with SionTower examples.  If not, see <http://www.gnu.org/licenses/>.
00021  */
00022 
00023 #ifndef SIONTOWER_TRUNK_SRC_INCLUDE_SONG_H_
00024 #define SIONTOWER_TRUNK_SRC_INCLUDE_SONG_H_
00025 
00026 #include <SDL/SDL_mixer.h>
00027 #include <OGRE/Ogre.h>
00028 
00029 
00031 
00044  class Song: public Ogre::Resource {
00045     public:
00061         Song(Ogre::ResourceManager* creator,
00062              const Ogre::String& name,
00063              Ogre::ResourceHandle handle,
00064              const Ogre::String& group,
00065              bool isManual = false,
00066              Ogre::ManualResourceLoader* loader = 0);
00067 
00071         ~Song();
00072 
00081         void play(int loop = -1);
00082 
00086         void pause();
00087 
00092         void stop();
00093 
00103         void fadeIn(int ms, int loop = -1);
00104 
00111         void fadeOut(int ms);
00112 
00117         static bool isPlaying();
00118     protected:
00122         void loadImpl();
00123 
00127         void unloadImpl();
00128 
00132         size_t calculateSize() const;
00133 
00134     private:
00135         Mix_Music* _song;
00136         Ogre::String _path;
00137         size_t _size;
00138 };
00139 
00141 
00150 class SongPtr: public Ogre::SharedPtr<Song> {
00151     public:
00155         SongPtr(): Ogre::SharedPtr<Song>() {}
00156 
00163         explicit SongPtr(Song* m): Ogre::SharedPtr<Song>(m) {}
00164 
00171         SongPtr(const SongPtr &m): Ogre::SharedPtr<Song>(m) {}
00172 
00178         SongPtr(const Ogre::ResourcePtr &r);
00179 
00186         SongPtr& operator= (const Ogre::ResourcePtr& r);
00187 };
00188 
00189 
00190 #endif  // SIONTOWER_TRUNK_SRC_INCLUDE_SONG_H_
 Todo Clases Archivos Funciones 'typedefs' Enumeraciones