Files
2026-06-01 12:46:52 +02:00

74 lines
2.1 KiB
C++

#pragma once
#include <sound/XSoundManager.h>
#include <sound/XMusicPlayer.h>
#include <toolkit/khash.h>
/// 단지 Hash를 이용해서, Play Sound 한다.
class SSoundManager
{
public:
SSoundManager();
virtual ~SSoundManager();
bool Init( void* hWnd, bool bGlobal = false, bool bUse3D = true, bool bIsStereo = true, unsigned freq = 44100, unsigned bit = 16 );
bool DeInit();
bool UnLoad( unsigned short idx );
bool SetMinMax( unsigned short idx, float fMin, float fMax );
bool SetListenerPosition( float x, float y, float z = 0.0f );
bool SetCameraPosition( float x, float y, float z = 0.0f );
bool SetVolume( int nVolume );
int GetVolume();
void SetMusicVolume( int nVolume );
int GetMusicVolume();
void SetMute( bool bFlag );
void SetMusicMute( bool bFlag );
bool IsMusicPlaying();
/// 옵션 영향을 받지 않음
bool ForcePlayMusic( const char * pName, bool bLoop = false );
bool PlayMusic( const char * pName, bool bLoop = false );
void StopMusic();
bool Stop( unsigned short idx, int play_id );
void StopSound( const char * pName, int play_id );
int StartSound( const char * pName, bool bUse3D = false , bool bLoop = false, int nVolume = -1 , bool bStream = false);
int StartSound( const char * pName, bool bUse3D, float x, float y, float z = 0.0f, bool bLoop = false, int nVolume = -1 , bool bStream = false); // 성식씨의 디버깅 후 bStream=true 로 고쳐야 함 -by Tyburn
int PreLoad( const char * pName, bool bUse3D, bool bStream );
bool SetLowFilter( const char * pName, int play_id , int frequency); //ps
void SetCutOffFreqRate( float fDistMin, float fDist, float fDistData);
private:
int PreLoad_Buffer( const char * pName, bool bUse3D ); //ps
int PreLoad_Stream( const char * pName, bool bUse3D ); //ps
KHash<int, hashPr_string> m_hashSound;
XMusicPlayer * m_pMusicPlayer;
XSoundManager * m_pSoundMng;
int m_nNewIndex;
#ifdef _STOOL
HWND m_hWnd;
#endif
std::string m_strMuteMusicName; ///< 음소거 시 음악 이름 저장.
bool m_bMuteLoop;
std::string m_strMusicName;
bool m_bSFX_Mute;
bool m_bBGM_Mute;
bool m_bIsUseAble;
};