background_sound.h

Go to the documentation of this file.
00001 
00006 /* Copyright, 2001 Nevrax Ltd.
00007  *
00008  * This file is part of NEVRAX NEL.
00009  * NEVRAX NEL is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2, or (at your option)
00012  * any later version.
00013 
00014  * NEVRAX NEL is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00017  * General Public License for more details.
00018 
00019  * You should have received a copy of the GNU General Public License
00020  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00021  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00022  * MA 02111-1307, USA.
00023  */
00024 
00025 #ifndef NL_BACKGROUND_SOUND_H
00026 #define NL_BACKGROUND_SOUND_H
00027 
00028 #include "nel/misc/string_mapper.h"
00029 #include "sound.h"
00030 #include "nel/sound/u_audio_mixer.h"
00031 
00032 namespace NLSOUND {
00033 
00034 //class ISoundDriver;
00035 //class IBuffer;
00036 //class CSound;
00037 
00038 
00039 
00046 class CBackgroundSound : public CSound
00047 {
00048 public:
00050         CBackgroundSound();
00052         ~CBackgroundSound();
00053 
00054         TSOUND_TYPE getSoundType()                                                      { return SOUND_BACKGROUND;}
00055 
00057         virtual void            importForm(const std::string& filename, NLGEORGES::UFormElm& formRoot);
00058 
00060         bool                            isDetailed() const                              { return false;}
00062         virtual uint32          getDuration();
00064 
00066         virtual void            getSubSoundList(std::vector<std::pair<std::string, CSound*> > &subsounds) const;
00067 
00068         virtual float           getMaxDistance() const;
00069 
00070         void                            serial(NLMISC::IStream &s);
00071 
00073         struct TSoundInfo
00074         {
00075                 NLMISC::TStringId               SoundName;
00076                 UAudioMixer::TBackgroundFlags           Filter;
00077 
00078                 void serial(NLMISC::IStream &s)
00079                 {
00080                         std::string soundName;
00081                         if (s.isReading())
00082                         {
00083                                 s.serial(soundName);
00084                                 SoundName = NLMISC::CStringMapper::map(soundName);
00085                         }
00086                         else
00087                         {
00088                                 soundName = NLMISC::CStringMapper::unmap(SoundName);
00089                                 s.serial(soundName);
00090                         }
00091                         s.serial(Filter);
00092                 }
00093         };
00094 
00095         const std::vector<TSoundInfo> &getSounds() const                        { return _Sounds;}
00096 
00097 private:
00098 
00099 
00101         std::vector<TSoundInfo>         _Sounds;
00102         
00103 
00104         // Duration of sound.
00105         uint32                                          _Duration;
00106         // flag for validity of duration (after first evaluation).
00107         bool                                            _DurationValid;
00108 };
00109 
00110 } // NLSOUND
00111 
00112 #endif // NL_BACKGROUND_SOUND_H
00113 

Generated on Tue Mar 16 06:22:36 2004 for NeL by doxygen 1.3.6