Home | nevrax.com |
|
u_source.hGo 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_U_SOURCE_H 00027 #define NL_U_SOURCE_H 00028 00029 #include "nel/misc/types_nl.h" 00030 #include "nel/misc/vector.h" 00031 00032 namespace NLMISC { 00033 00034 class CVector; 00035 00036 } 00037 00038 00039 namespace NLSOUND { 00040 00041 00042 static const uint SoundContextNbArgs = 10; 00043 00044 struct CSoundContext 00045 { 00046 // -1 for args is a special value means that unset. Don't use negative number 00047 00048 CSoundContext() 00049 : Position(NLMISC::CVector::Null), 00050 PreviousRandom(100), 00051 RelativeGain(1.0f) 00052 { 00053 for (uint i = 0; i < SoundContextNbArgs; i++) 00054 Args[i] = -1; 00055 } 00056 00057 float RelativeGain; 00058 NLMISC::CVector Position; 00059 sint32 Args[SoundContextNbArgs]; 00060 uint32 PreviousRandom; 00061 }; 00062 00063 00064 class CSound; 00065 class USource; 00066 00067 00069 typedef CSound* TSoundId; 00070 00072 enum TSoundPriority { HighestPri, HighPri, MidPri, LowPri, NbSoundPriorities}; 00073 //const uint NbSoundPriorities = 4; 00074 00076 typedef void (*TSpawnEndCallback) (USource *, void *); 00077 00078 00103 class USource 00104 { 00105 public: 00106 00110 // virtual void setSound( TSoundId id, CSoundContext *context = 0) = 0; 00112 virtual TSoundId getSound() = 0; 00114 virtual void setPriority( TSoundPriority pr) = 0; 00115 00117 00118 00119 virtual void setLooping( bool l ) = 0; 00121 virtual bool getLooping() const = 0; 00123 virtual void play() = 0; 00125 virtual void stop() = 0; 00127 virtual bool isPlaying() = 0; 00129 virtual void unregisterSpawnCallBack() = 0; 00131 virtual uint32 getTime() =0; 00133 00134 00136 00137 00141 virtual void setPos( const NLMISC::CVector& pos ) = 0; 00143 virtual const NLMISC::CVector &getPos() const = 0; 00145 virtual void setVelocity( const NLMISC::CVector& vel ) = 0; 00147 virtual void getVelocity( NLMISC::CVector& vel ) const = 0; 00149 virtual void setDirection( const NLMISC::CVector& dir ) = 0; 00151 virtual void getDirection( NLMISC::CVector& dir ) const = 0; 00158 virtual void setGain( float gain ) = 0; 00160 virtual float getGain() const = 0; 00164 virtual void setRelativeGain( float gain ) = 0; 00166 virtual float getRelativeGain() const = 0; 00170 virtual void setPitch( float pitch ) = 0; 00172 virtual float getPitch() const = 0; 00174 virtual void setSourceRelativeMode( bool mode ) = 0; 00176 virtual bool getSourceRelativeMode() const = 0; 00178 00180 virtual ~USource() {} 00181 00182 protected: 00183 00185 USource() {} 00186 00187 }; 00188 00189 00190 } // NLSOUND 00191 00192 00193 #endif // NL_U_SOURCE_H 00194 00195 /* End of u_source.h */ |