Audio.h
上传用户:hkb425
上传日期:2007-06-16
资源大小:34191k
文件大小:2k
- // Audio.h: interface for the CAudio class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_AUDIO_H__C59411DC_4F55_40AF_945A_7157AAE6F15B__INCLUDED_)
- #define AFX_AUDIO_H__C59411DC_4F55_40AF_945A_7157AAE6F15B__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- include <dmusicc.h>
- #include <dmusici.h>
- #define INIT_GUID
- #define LPDIRECTMUSICLOADER8 IDirectMusicLoader8*
- #define LPDIRECTMUSICPERFORMANCE8 IDirectMusicPerformance8*
- #define LPDIRECTMUSICSEGMENT8 IDirectMusicSegment8*
- #define LPDIRECTMUSICAUDIOPATH IDirectMusicAudioPath*
- #define LPDIRECTCSound3DBUFFER IDirectSound3DBuffer*
- #define LPDIRECTCSound3DLISTENER IDirectSound3DListener*
- class CSound
- {
- public:
- LPDIRECTMUSICSEGMENT8 dmSegment;
- LPDIRECTCSound3DBUFFER ds3DBuffer;
- bool is3DSound;
- void Set3DPos(float x, float y, float z);
- void Set3DDistances(float minDistance, float maxDistance);
- void Shutdown(void);
- CSound() : dmSegment(NULL), ds3DBuffer(NULL), is3DSound(false)
- { }
- ~CSound()
- { }
- };
- class CAudio
- {
- protected:
- LPDIRECTMUSICLOADER8 dmLoader; // the loader
- LPDIRECTMUSICPERFORMANCE8 dmPerformance; // the performance
- LPDIRECTMUSICAUDIOPATH dm3DAudioPath; // the audiopath
- LPDIRECTCSound3DLISTENER ds3DListener; // 3d listener
- DS3DLISTENER dsListenerParams; // 3d listener properties
- //////////////////////////////////
- CSound *pSound;
- unsigned int m_MaxNum;//max number of CSound object
- public:
- bool Init(HWND hwnd,unsigned int MaxNumber);
- void Shutdown(void);
- bool Create(unsigned int NumOfSound, char* filename, bool is3DSound);
- void Play(unsigned int NumOfSound, DWORD numRepeats);
- void Stop(unsigned int NumOfSound);
- void SetListenerPos(float x, float y, float z);
- void SetListenerRolloff(float rolloff);
- void SetListenerOrientation(float forwardX, float forwardY, float forwardZ, float topX, float topY, float topZ);
- CAudio(): dm3DAudioPath(NULL), dmLoader(NULL), dmPerformance(NULL),
- ds3DListener(NULL),pSound(NULL),m_MaxNum(0)
- { }
- virtual ~CAudio()
- { }
- };
- #endif // !defined(AFX_AUDIO_H__C59411DC_4F55_40AF_945A_7157AAE6F15B__INCLUDED_)