157 lines
4.7 KiB
C++
157 lines
4.7 KiB
C++
#pragma once
|
|
|
|
#include <sound/miles/ISoundBufferInfoTable.h>
|
|
#include <miles/mss.h>
|
|
|
|
class SGameMilesSoundBufferInfoTable : public ISoundBufferInfoTable
|
|
{
|
|
private:
|
|
class SGameMilesSoundMgr* m_pMSoundMgr;
|
|
public:
|
|
SGameMilesSoundBufferInfoTable( class SGameMilesSoundMgr* pMSoundMgr ) : m_pMSoundMgr( pMSoundMgr )
|
|
{}
|
|
virtual ~SGameMilesSoundBufferInfoTable() {}
|
|
|
|
virtual bool GetSoundBufferData( const char *szFileName, float *pfMaxDist, float *pfMinDist,
|
|
float *pfVolume, float *pfReverbDry, float *pfReverbWet, bool *pbSfx);
|
|
|
|
virtual bool GetGameDryWetVolume( float *pfReverbDry, float *pfReverbWet );
|
|
virtual bool GetGameLowPassCutOff( float *pfCutOff );
|
|
};
|
|
|
|
class SGameMilesSoundMgr
|
|
{
|
|
private:
|
|
class ISoundManager* m_pSoundMng;
|
|
SGameMilesSoundBufferInfoTable* m_pBufferInfoTable;
|
|
|
|
class SGameWorld* m_pGameWorld;
|
|
|
|
struct MusicKey
|
|
{
|
|
enum FILTER_TYPE
|
|
{
|
|
FILTER_NONE = 0,
|
|
FILTER_VOLUME_RAMP,
|
|
};
|
|
|
|
std::string m_strPlayMusicName;
|
|
std::string m_strPrevPlayMusicName;
|
|
bool m_bMusicLoop;
|
|
|
|
std::string m_strFilterMusicName;
|
|
FILTER_TYPE m_nFilterType;
|
|
|
|
bool m_bMute;
|
|
|
|
MusicKey() : m_bMusicLoop( false )
|
|
, m_bMute( false )
|
|
, m_nFilterType( FILTER_NONE )
|
|
{}
|
|
|
|
void Reset()
|
|
{
|
|
m_strPlayMusicName.clear();
|
|
m_strPrevPlayMusicName.clear();
|
|
m_bMusicLoop = false;
|
|
}
|
|
void ResetFilter()
|
|
{
|
|
m_strFilterMusicName.clear();
|
|
m_nFilterType = FILTER_NONE;
|
|
}
|
|
void SetFilter( const char* szFilterMusicName, FILTER_TYPE nFilter )
|
|
{
|
|
m_strFilterMusicName = szFilterMusicName;
|
|
m_nFilterType = nFilter;
|
|
}
|
|
FILTER_TYPE GetFilterType()
|
|
{
|
|
return m_nFilterType ;
|
|
}
|
|
void MusicMute( bool bMute )
|
|
{
|
|
if( bMute ) m_strPrevPlayMusicName = m_strPlayMusicName;
|
|
else m_strPlayMusicName = m_strPrevPlayMusicName;
|
|
|
|
m_bMute = bMute;
|
|
}
|
|
bool IsMuteStream() { return m_bMute; }
|
|
};
|
|
|
|
MusicKey* m_pMusic;
|
|
MusicKey* m_pBgm;
|
|
|
|
bool m_bMasterMute;
|
|
|
|
int m_nPlayRate;
|
|
int m_nMasterVolume;
|
|
int m_nBgmVolume;
|
|
int m_nEnvVolume;
|
|
int m_nSfxVolume;
|
|
|
|
float m_fCutOff;
|
|
public:
|
|
bool Initialize( HWND hWnd );
|
|
/// 마일즈 컬백함수 - 로비BGM끝나면 일로 들어옴!
|
|
static void AILCALLBACK CallBack( HSTREAM stream );
|
|
void Process( DWORD dwTime );
|
|
void GetCurrentEnvironmentInfo( int& nWorldID, int& nCurTime, int& nWeatherID );
|
|
void GetGameDryWetVolume( float *pfReverbDry, float *pfReverbWet );
|
|
void GetGameLowPassCutOff( float *pfCutOff );
|
|
public:
|
|
int PlayMusic( const char *szKeyName, int nVolume = 100, bool bLoop = false );
|
|
void SwapPlayMusic( const char *szKeyName, int nFadeInTime, int nFadeOutTime, int nVolume = 100, bool bLoop = false );
|
|
void StopMusic();
|
|
|
|
int PlayBGM( const char *szKeyName, int nVolume = 100, bool bLoop = false );
|
|
void SwapPlayBGM( const char *szKeyName, int nFadeInTime, int nFadeOutTime, int nVolume = 100, bool bLoop = false );
|
|
void StopBgm();
|
|
|
|
bool IsPlayMusic();
|
|
bool IsPlayBGM();
|
|
void SetFadeStream( const char* szFileName, int nTime, bool bFadeIn );
|
|
void UnLoadAllStream();
|
|
|
|
int StartSound( const char *szKeyName, int nVolume = 100, bool bLoop = false );
|
|
int PlaySound3D( const char *szKeyName, float x, float y, float z, int nVolume, bool bLoop, bool bReverb, bool bLowPass );
|
|
|
|
void StopAllSound();
|
|
void StopSound( const char *szKeyName );
|
|
void StopSound( int nBufferIndex );
|
|
void StopSound( int nBufferIndex, int nSampleIndex );
|
|
void UnLoadSound( const char *szKeyName );
|
|
|
|
int ForcePlayMusic( const char *szKeyName, int nVolume = 100, bool bLoop = false );
|
|
public:
|
|
/// 효과음
|
|
void SetSfxVolume( int nVolume );
|
|
/// 환경음
|
|
void SetEnvVolume( int nVolume );
|
|
/// 배경음
|
|
void SetBgmVolume( int nVolume );
|
|
|
|
/// 전체 볼륨
|
|
void SetMasterVolume( int nVolume );
|
|
|
|
void SetSfxMute( bool bMute );
|
|
void SetEnvMute( bool bMute );
|
|
void SetBgmMute( bool bMute );
|
|
void SetSoundMute( bool bMute );
|
|
|
|
void SetListenerPosition( float x, float y, float z );
|
|
void SetSampleListenerPosition( int nBuffer, int nSampleBuffer, float x, float y, float z );
|
|
void SetOrientation( float face_x, float face_y, float face_z, float up_x, float up_y, float up_z);
|
|
public:
|
|
void SetGameWorld( class SGameWorld* pGameWorld );
|
|
void SetRoomType( int nRoomType );
|
|
void SetLowPassCutOff( float fCutOff );
|
|
public:
|
|
int GetSfxVolume();
|
|
int GetEnvVolume();
|
|
int GetBgmVolume();
|
|
int GetMasterVolume();
|
|
public:
|
|
SGameMilesSoundMgr();
|
|
~SGameMilesSoundMgr();
|
|
}; |