Sion Tower (demo técnica) 0.1

/home/david/programacion/iberogre-siontower/siontower/trunk/src/include/sound3D.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_SOUND3D_H_
00024 #define SIONTOWER_TRUNK_SRC_INCLUDE_SOUND3D_H_
00025 
00026 #include <vector>
00027 
00028 #include <OGRE/Ogre.h>
00029 
00030 #include "soundFX.h"
00031 
00033 
00070 class Sound3D {
00071     public:
00081         Sound3D(const Ogre::String& name,
00082                 const Ogre::String& group = Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
00083                 Ogre::SceneNode* listenerNode = 0,
00084                 Ogre::SceneNode* sourceNode = 0);
00085 
00093         Sound3D(SoundFXPtr s,
00094                 Ogre::SceneNode* listenerNode = 0,
00095                 Ogre::SceneNode* sourceNode = 0);
00096 
00100         ~Sound3D();
00101 
00109         void play(int loop = 0);
00110 
00116         static void update3DSound();
00117 
00124         static void channelFinished(int channel);
00125 
00129         const Ogre::SceneNode* getListenerNode() const;
00130 
00134         const Ogre::SceneNode* getSourceNode() const;
00135 
00139         void setListenerNode(const Ogre::SceneNode* listenerNode);
00140 
00144         void setSourceNode(const Ogre::SceneNode* sourceNode);
00145 
00146     private:
00147         SoundFXPtr _soundFXPtr;
00148         const Ogre::SceneNode* _listenerNode;
00149         const Ogre::SceneNode* _sourceNode;
00150         
00151         // Vector con los sonidos 3D en reproducci&oacute;n junto a su canal asociado.
00152         static std::vector<std::pair<int, Sound3D*> > _sounds;
00153         // Vector con todos los canales de forma que canales[n] indica la
00154         // posici&oacute;n en sonidos de ese canal.
00155         static std::vector<int> _channels;
00156         static int _numUsedChannels;
00157 
00158         void update(int channel);
00159 };
00160 
00167 void channelFinished(int channel);
00168     
00169 
00170 
00171 #endif  // SIONTOWER_TRUNK_SRC_INCLUDE_SOUND3D_H_
 Todo Clases Archivos Funciones 'typedefs' Enumeraciones