DirectSound.h
资源名称:DXGuide.zip [点击查看]
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:3k
源码类别:
DirextX编程
开发平台:
Visual C++
- // Copyright (C) 1998-1999 DXGuide. All Rights Reserved.
- // File: DirectSound.h
- #ifndef _DIRECTSOUND__H
- #define _DIRECTSOUND__H
- #if _MSC_VER >= 1000
- #pragma once
- #endif // _MSC_VER >= 1000
- // turn off warnings for /W4
- #pragma warning(disable: 4201)
- #include <mmsystem.h>
- #pragma warning(default: 4201)
- #pragma warning(disable: 4201)
- #include <dsound.h>
- #pragma warning(default: 4201)
- class CDSDriverInfoObject;
- class CDSBuffer;
- class CWaveFile;
- class CDirectSound
- {
- friend class CDSBuffer;
- friend class CDSStreamBuffer;
- friend class CDS3DListener;
- friend class CDirectMusic;
- friend class CDirectXApp;
- public:
- // Flags for DSInit
- enum DSInitFlag
- {
- DSIF_3D = 0x00000001L,
- DSIF_DSSCL_NORMAL = 0x00010000L,
- DSIF_DSSCL_PRIORITY = 0x00020000L,
- DSIF_DSSCL_EXCLUSIVE = 0x00040000L,
- DSIF_DSSCL_WRITEPRIMARY = 0x00080000L,
- };
- enum WAVEFORMATCODE
- {
- _WAVEFORMATCODE_UNKNOWN = 0,
- _8000_8BIT_MONO = 8108,
- _8000_8BIT_STEREO = 8208,
- _8000_16BIT_MONO = 8116,
- _8000_16BIT_STEREO = 8216,
- _11025_8BIT_MONO = 11108,
- _11025_8BIT_STEREO = 11208,
- _11025_16BIT_MONO = 11116,
- _11025_16BIT_STEREO = 11216,
- _22050_8BIT_MONO = 22108,
- _22050_8BIT_STEREO = 22208,
- _22050_16BIT_MONO = 22116,
- _22050_16BIT_STEREO = 22216,
- _44100_8BIT_MONO = 44108,
- _44100_8BIT_STEREO = 44208,
- _44100_16BIT_MONO = 44116,
- _44100_16BIT_STEREO = 44216,
- };
- protected:
- CDirectSound(void);
- ~CDirectSound();
- protected:
- bool Create(HWND hWnd, DWORD dwDSInitFlags);
- protected:
- HRESULT CreateSoundBuffer(
- LPCDSBUFFERDESC lpcDSBufferDesc,
- LPLPDIRECTSOUNDBUFFER lplpDirectSoundBuffer);
- public:
- HRESULT GetCaps(DSCAPS* pDSCaps);
- HRESULT Compact(void);
- bool SetFormat(CDirectSound::WAVEFORMATCODE waveFormatCode);
- bool SetFormat(CDSBuffer* pDSB);
- CDS3DListener* GetDS3DListener(void);
- public:
- bool SelectDSDriver(int nPos);
- bool SelectDSDriver(const LPGUID lpGuid);
- int GetDSDriverNumber(void) const;
- protected:
- bool LoadDSDriverInfoArray(void);
- CDSDriverInfoObject* GetSelectedDSDriverInfoObject(void) const;
- void AddDSDriverInfo(GUID FAR* const lpGuid, LPCSTR lpDriverDescription,
- LPCSTR lpDriverName, DSCAPS* pDSCaps);
- static BOOL CALLBACK DSEnumCallback(
- LPGUID lpGuid, LPCSTR lpstrDescription,
- LPCSTR lpstrModule, LPVOID lpContext);
- protected:
- int m_nSelectedDSDriverInfoPos;
- protected:
- LPDIRECTSOUND m_lpDS;
- CDSBuffer* m_pPrimaryDSB;
- DWORD m_dwDSInitFlags;
- };
- #include "DirectSound.inl"
- #endif // _DIRECTSOUND__H