00001 00005 /* Copyright, 2001 Nevrax Ltd. 00006 * 00007 * This file is part of NEVRAX NEL. 00008 * NEVRAX NEL is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2, or (at your option) 00011 * any later version. 00012 00013 * NEVRAX NEL is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * General Public License for more details. 00017 00018 * You should have received a copy of the GNU General Public License 00019 * along with NEVRAX NEL; see the file COPYING. If not, write to the 00020 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00021 * MA 02111-1307, USA. 00022 */ 00023 00024 #ifndef NL_BACKGROUND_SOURCE_H 00025 #define NL_BACKGROUND_SOURCE_H 00026 00027 #include "nel/misc/types_nl.h" 00028 //#include "nel/sound/u_source.h" 00029 #include "source_common.h" 00030 #include "background_sound.h" 00031 00032 00033 namespace NLSOUND { 00034 00035 class CBackgroundSound; 00036 00042 class CBackgroundSource : public CSourceCommon , public CAudioMixerUser::IMixerUpdate 00043 { 00044 public: 00046 CBackgroundSource (CBackgroundSound *backgroundSound=NULL, bool spawn=false, TSpawnEndCallback cb=0, void *cbUserParam = 0, NL3D::CCluster *cluster = 0); 00048 ~CBackgroundSource (); 00049 00051 virtual TSoundId getSound(); 00052 00053 virtual void play(); 00055 virtual void stop(); 00056 00057 TSOURCE_TYPE getType() const {return SOURCE_BACKGROUND;} 00058 00059 void setGain( float gain ); 00060 void setRelativeGain( float gain ); 00061 00062 void setPos( const NLMISC::CVector& pos ); 00063 void setVelocity( const NLMISC::CVector& vel ); 00064 void setDirection( const NLMISC::CVector& dir ); 00065 00066 void updateFilterValues(const float *filterValues); 00067 00068 00069 private: 00070 00072 void onUpdate(); 00073 00075 enum TSubSourceStatus 00076 { 00078 SUB_STATUS_PLAY, 00080 SUB_STATUS_STOP, 00082 SUB_STATUS_PLAY_FAIL 00083 }; 00084 00086 struct TSubSource 00087 { 00089 USource *Source; 00091 TSubSourceStatus Status; 00093 UAudioMixer::TBackgroundFlags Filter; 00094 }; 00095 00097 CBackgroundSound *_BackgroundSound; 00098 00100 std::vector<TSubSource> _Sources; 00101 }; 00102 00103 00104 00105 } // NLSOOUND 00106 00107 #endif // NL_BACKGROUND_SOURCE_H
1.6.1