⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gamesound.h

📁 一个类似坦克大战的小小游戏
💻 H
字号:

/**************************************************************************************
	Project  Name			: Pirates of the Caribbean
	Module Name				: Direct Sound
	File Name				: GameSound.h: interface for the CGameSound class.
	Create					: 2007-7-14, by Vigame
	Update					: 
	Copyright				: 
	Reference				: 
	Abstrct					: Encapsulation of the DirectSound interface
 **************************************************************************************/

#ifndef __H_GameSound__
#define __H_GameSound__

#pragma once
#pragma comment(lib, "Dsound.lib")
#pragma comment(lib, "Winmm.lib")

#include <dsound.h>

// SOUND TYPE DEFINES ///////////////////////////////////////////

const int SOUND_COUNT = 10;

enum Sound_Type
{
	ST_Fire,
	ST_Explode,
	ST_Win,
	ST_Lost,
	ST_Bonus,
	ST_Circumvention,
	ST_LvUp,
	ST_Alarm,
	ST_Hit,
	ST_Reborn
};

//////////////////////////////////////////////////////////////////

class CGameSound
{
public:
	CGameSound(void);
	~CGameSound(void);

public:
	BOOL Create(HWND hWnd);		// Init directsound			
	BOOL CreateBuffer(LPDIRECTSOUNDBUFFER &pBuffer,	LPSTR inFileName);	// Create a directsound buffer
	void Release();

	BOOL Play(Sound_Type inType);	// Play sound
	void Stop(Sound_Type inType);	// Stop sound

private:
	LPDIRECTSOUND m_pSound;							// The direct sound interface pointer
	LPDIRECTSOUNDBUFFER m_pdsBuffer[SOUND_COUNT];	// DirectSound buffer
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -