/* ========================================================================== * ÀÛ ¼º ÀÚ : À̼ø±Ô * ÀÛ ¼º ÀÏ : 2007.03.20 * ³» ¿ë : »ç¿îµå ½Ã½ºÅÛ * ÁÖÀÇ»çÇ× : *===========================================================================*/ #pragma once struct sSoundInfo { unsigned long mIndex; cString mFileName; float mVolume; float mRadius; }; struct sPlayInfo { float mVolume; NiAudioSourcePtr mSnd; sPlayInfo() { mVolume = 1.0f; mSnd = 0; } ~sPlayInfo() { assert( mSnd->GetRefCount() == 1 ); mSnd = 0; // SAFE_NIDELETE( mSnd ); } }; /// »ç¿îµå ½Ã½ºÅÛ class cSoundSystem { static cSoundSystem* mSingleton; public: /// ´ÜÀÏü¸¦ ¸®ÅÏ static cSoundSystem* GetSingleton(); cSoundSystem(); ~cSoundSystem(); /// ÃʱâÈ­ bool Init(); // void Open( unsigned int mapIdx, unsigned char mapMode ); void Close(); // // /// ó¸® // void Process( unsigned long deltaTime, unsigned long accumTime ); // // void ProcessStageBGM( unsigned long accumTime ); // inline bool IsBGMFading() { return mFadeBGM; } // inline bool IsSoundActive() { return mActiveSound; } // void ActiveSound( bool active ); // // void UpdateSoundGain(); // // /// // void StopAll(); // /// ¿µ¿ª »ç¿îµå NiAudioSource* LoadAreaSound( unsigned int index, const cString& pathName ); NiAudioSource* GetAreaSound( unsigned int index ) const; // //bool DestroyAreaSound( unsigned int index ); void SetHWND( NiWindowRef hwnd ); inline bool IsUsableSoundSystem() { return mInitedSoundSystem; } // public: /// »ç¿îµå¿¡ ´ëÇÑ Á¤º¸ ÂüÁ¶ sSoundInfo* GetSoundInfo( unsigned long index ); // /// 2D »ç¿îµå // bool Play2DSound( unsigned long index ); // /// bool LoadBGMList(); // void PlayBGMSound( bool on ); // // /// // void PlayAreaSound( NiAudioSource* snd ); protected: bool LoadSoundList(); private: /// ¿µ¿ª »ç¿îµå ¸Ê typedef tHashMap cAreaSoundMap; cAreaSoundMap mAreaSoundMap; /// ½ºÅ©¸³Æ®¿ë À妽º, »ç¿îµåÁ¤º¸ typedef tPointerHashMap cPointHashMap; cPointHashMap mSoundListMap; /// Ãâ·Â 2D »ç¿îµå ¸Ê typedef tPointerList cPlay2DSoundList; cPlay2DSoundList mPlayList; /// Ãâ·Â Area Sound NiAudioSource* mCurrentAreaSound; /// »èÁ¦¿ë.. typedef tPointerList cDelList; cDelList mDelList; NiAudioSource* mBGMSound; bool mFadeBGM; bool mActiveSound; /// NiAudioSource* mCurrentMapBGM; bool mIsActiveAreaSound; unsigned long mMapBGMWaitTime; unsigned long mCheckTime; bool mInitedSoundSystem; }; 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()