# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

simple_source.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2001 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_SIMPLE_SOURCE_H
00027 #define NL_SIMPLE_SOURCE_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/vector.h"
00031 #include "nel/misc/time_nl.h"
00032 //#include "playable.h"
00033 #include "source_common.h"
00034 #include "simple_sound.h"
00035 
00036 
00037 namespace NLSOUND {
00038 
00039 
00040 class ISource;
00041 class CTrack;
00042 class CSimpleSound;
00043 
00044 
00051 class CSimpleSource : public CSourceCommon, public CAudioMixerUser::IMixerEvent //, public IPlayable
00052 {
00053 public:
00054 
00056         CSimpleSource( CSimpleSound *simpleSound=NULL, bool spawn=false, TSpawnEndCallback cb=0, void *cbUserParam = 0);
00058         virtual ~CSimpleSource();
00059 
00060 /*      
00061         static void                                             init() 
00062         { 
00063                 //NLMISC_REGISTER_CLASS(CSimpleSource); 
00064         }
00065 */
00066         
00068         virtual TSoundId                                getSound()                                                                      { return _Sound; }
00070         CSimpleSound                                    *getSimpleSound();
00071 
00073 
00074 
00075         virtual void                                    setLooping( bool l );
00077         virtual void                                    play();
00079         virtual void                                    stop();
00081         virtual bool                                    isPlaying();
00083         virtual NLMISC::TTicks                  getPlayTime()                                                           { return NLMISC::CTime::getLocalTime() - _PlayStart; }
00085         virtual uint32                                  getTime();
00087 
00088 
00090 
00091 
00095         virtual void                                    setPos( const NLMISC::CVector& pos );
00099 //      virtual void                                    getPos( NLMISC::CVector& pos ) const;
00101         virtual void                                    setVelocity( const NLMISC::CVector& vel );
00103         virtual void                                    setDirection( const NLMISC::CVector& dir );
00110         virtual void                                    setGain( float gain );
00114         virtual void                                    setRelativeGain( float gain );
00118         virtual void                                    setPitch( float pitch );
00120         virtual void                                    setSourceRelativeMode( bool mode );
00121 
00122 
00124         CTrack                                                  *getTrack()                                                                     { return _Track; }
00126         TSpawnEndCallback                               getSpawnEndCallback() const                                     { return _SpawnEndCb; }
00127 
00128         //NLMISC_DECLARE_CLASS(CSimpleSource);
00129 
00130         virtual IBuffer                                 *getBuffer();
00131         
00132 private:
00133         // Mixer event call when doing muted play
00134         virtual void onEvent();
00135 
00136         TSOURCE_TYPE                                    getType() const                                                         {return SOURCE_SIMPLE;}
00137 
00138         // The simple sound of this source.
00139         CSimpleSound                                    *_Sound;
00140 
00141         // The volume falloff factor.
00142         float                                                   _Alpha;
00143 
00144         // Corresponding track (if selected for playing)
00145         CTrack                                                  *_Track;
00146         // True when the sound is played muted and until the mixer event notifying the end.
00147         bool                                                    _PlayMuted;
00148 
00149 };
00150 
00151 
00152 } // NLSOUND
00153 
00154 
00155 #endif // NL_SIMPLE_SOURCE_H
00156 
00157 /* End of source_user.h */