AxibugEmuOnline/References/virtuanessrc097-master/DirectSound.h

124 lines
5.7 KiB
C
Raw Permalink Normal View History

<EFBFBD><EFBFBD>//
// DirectSound class
//
#ifndef __DIRECTSOUND_INCLUDED__
#define __DIRECTSOUND_INCLUDED__
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <mmsystem.h>
#define DIRECTSOUND_VERSION 0x0700
#include <dsound.h>
#include "extsoundfile.h"
#include "typedef.h"
#include "macro.h"
class CWaveData
{
public:
CWaveData();
virtual ~CWaveData();
BOOL Load( LPCSTR szFileName );
void Free();
DWORD GetSize();
WAVEFORMATEX* GetFormat();
LPVOID GetData();
protected:
LPVOID m_pBuffer;
WAVEFORMATEX* m_pwfex;
DWORD m_dwSize;
LPVOID m_pData;
private:
};
class CDirectSound
{
public:
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0 Ype
typedef struct tagSAMPLERATE {
DWORD Rate;
DWORD Bits;
} SAMPLERATE, *LPSAMPLERATE;
SAMPLERATE m_SampleRate; // <EFBFBD>s(W<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
INT m_BufferSize; // <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0(<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0pe)
static SAMPLERATE m_SampleRateTable[]; // <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
static INT m_BufferSizeTable[]; // <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD><EFBFBD>pe
CDirectSound();
virtual ~CDirectSound();
BOOL InitialDSound( HWND hWnd );
void ReleaseDSound();
BOOL InitialBuffer();
void ReleaseBuffer();
BOOL SetSamplingRate( DWORD rate, DWORD bits );
void GetSamplingRate( DWORD& rate, DWORD& bits );
void SetBufferSize( INT nSize ) { m_BufferSize = nSize; }
INT GetBufferSize() { return m_BufferSize; }
BOOL IsStreamPlaying() { return (m_bStreamPlay&&!m_bStreamPause); }
void StreamPlay();
void StreamStop();
void StreamPause();
void StreamResume();
BOOL GetStreamLockPosition( LPDWORD lpdwStart, LPDWORD lpdwSize );
BOOL StreamLock( DWORD dwWriteCursor, DWORD dwWriteBytes, LPVOID* lplpvPtr1, LPDWORD lpdwBytes1, LPVOID* lplpvPtr2, LPDWORD lpdwBytes2, DWORD dwFlags );
BOOL StreamUnlock( LPVOID lpvPtr1, DWORD dwBytes1, LPVOID lpvPtr2, DWORD dwBytes2 );
BOOL IsStreamPlay() { return m_bStreamPlay; }
BOOL IsStreamPause() { return m_bStreamPause; }
// Y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>X<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>[<EFBFBD>_
BOOL LoadEsf( LPCSTR szFileName, INT no );
BOOL EsfPlay( INT no );
BOOL EsfPlayLoop( INT no );
BOOL EsfStop( INT no );
void EsfAllStop();
BOOL CreateESFBuffer( INT no, WAVEFORMATEX* pwfex, LPVOID pData, DWORD dwSize );
void ReleaseEsfBuffer();
protected:
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0 Ype
HWND m_hWnd; // Window handle
LPDIRECTSOUND m_lpDS; // DirectSound<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
LPDIRECTSOUNDBUFFER m_lpDSPrimary; // <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
LPDIRECTSOUNDBUFFER m_lpDSStream; // <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
DWORD m_dwDSBufferSize;
DWORD m_dwDSBlockSize; // 1<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0n0<EFBFBD>0<EFBFBD>0<EFBFBD>0
DWORD m_dwDSBlockNum; // <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0n0pe
DWORD m_dwDSLastBlock; // g<EFBFBD>_k0<EFBFBD>fM0<EFBFBD><EFBFBD><EFBFBD>0`0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0MOn
volatile BOOL m_bStreamPlay; // <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>Qu-N<EFBFBD>0<EFBFBD>0<EFBFBD>0
volatile BOOL m_bStreamPause; // <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
// Y<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>X<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>[<EFBFBD>_
CWaveData m_EsfWaveFile[ ESF_FILE_MAX ];
LPDIRECTSOUNDBUFFER m_pEsfDSBuffer[ ESF_FILE_MAX ];
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD><EFBFBD>pe
private:
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0 Ype
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD><EFBFBD>pe
};
extern CDirectSound DirectSound;
#endif // !__DIRECTSOUND_INCLUDED__