/* ========================================================================== * ÀÛ ¼º ÀÚ : À̼ø±Ô * ÀÛ ¼º ÀÏ : 2007.03.20 * ³» ¿ë : »ç¿îµå ½Ã½ºÅÛ * ÁÖÀÇ»çÇ× : *===========================================================================*/ #pragma once struct sSoundInfo { unsigned long mIndex; cString mFileName; float mVolume; float mRadius; }; /// »ç¿îµå ½Ã½ºÅÛ class cSoundSystem { static cSoundSystem* mSingleton; public: /// ´ÜÀÏü¸¦ ¸®ÅÏ static cSoundSystem* GetSingleton(); cSoundSystem(); ~cSoundSystem(); /// ÃʱâÈ­ bool Init(); void Close(); /// ó¸® void Process( unsigned long deltaTime, unsigned long accumTime ); inline bool IsSoundActive() { return mActiveSound; } void ActiveSound( bool active ); /// void StopAll(); /// ¿µ¿ª »ç¿îµå NiAudioSource* LoadAreaSound( unsigned int index, const cString& pathName, bool streamed = false ); NiAudioSource* GetAreaSound( unsigned int index ) const; //bool DestroyAreaSound( unsigned int index ); void SetHWND( NiWindowRef hwnd ); public: /// »ç¿îµå¿¡ ´ëÇÑ Á¤º¸ ÂüÁ¶ sSoundInfo* GetSoundInfo( unsigned long index ); /// 2D »ç¿îµå bool Play2DSound( unsigned long index ); protected: bool LoadSoundList(); private: /// ¿µ¿ª »ç¿îµå ¸Ê typedef tHashMap cAreaSoundMap; cAreaSoundMap mAreaSoundMap; /// ½ºÅ©¸³Æ®¿ë À妽º, »ç¿îµåÁ¤º¸ typedef tPointerHashMap cPointHashMap; cPointHashMap mSoundListMap; /// Ãâ·Â 2D »ç¿îµå ¸Ê typedef tPointerList cPlay2DSoundList; cPlay2DSoundList mPlayList; /// »èÁ¦¿ë.. typedef tPointerList cDelList; cDelList mDelList; bool mActiveSound; }; inline NiAudioSource* cSoundSystem::GetAreaSound( unsigned int index ) const { cAreaSoundMap::cConstIterator i = mAreaSoundMap.Find( index ); if( i != mAreaSoundMap.End() ) return (NiAudioSource*)(*i).mSecond; else return 0; } inline sSoundInfo* cSoundSystem::GetSoundInfo( unsigned long index ) { return (sSoundInfo*)mSoundListMap.GetAt( index ); } inline cSoundSystem* cSoundSystem::GetSingleton() { return mSingleton; } #define SOUNDSYS cSoundSystem::GetSingleton() /*// »ç¿îµå ½Ã½ºÅÛ class cSoundSystem { static cSoundSystem* mpSingleton; public: cSoundSystem(); ~cSoundSystem(); /// Áö¿ò void Clear(); /// Á¾·á void Exit(); /// ÃʱâÈ­ bool Init( NiWindowRef hwnd ); /// ó¸® void Process( float time ); /// ¸®½º³Ê NiAVObject* GetListener(); /// ·Îµù bool LoadBackground( const cString& pathName ); bool LoadEffect( const cString& pathName ); /// Ç÷¹ÀÌ //void PlayBackground( unsigned int index ); void PlayEffect( unsigned int index ); void StopAllSounds(); //void RewindAmbientSound(); //void SetAmbientGain(float fGain); protected: bool LoadAmbient( const cString& pathName, bool bgm ); public: /// ´ÜÀÏü¸¦ ¸®ÅÏ static cSoundSystem* GetSingleton(); private: /// ¹è°æ »ç¿îµå ¹è¿­ // typedef tArray cSoundArray; typedef tArray cSoundArray; cSoundArray mBackgroundArray; /// È¿°ú »ç¿îµå ¹è¿­ cSoundArray mEffectArray; //NiAudioSource* mpCurrentAmbient; }; inline cSoundSystem* cSoundSystem::GetSingleton() { return mpSingleton; } #define SOUNDSYS cSoundSystem::GetSingleton() */