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

📄 soundmanager.h

📁 吃豆子游戏源码
💻 H
字号:
/**
 *	File	:	SoundManager.h
 *  Author	:	Kevin Lynx
 *	Date	:	2007/8/3
 */
#ifndef _SOUND_MANAGER_H_
#define _SOUND_MANAGER_H_

#include "Singleton.h"
#include <irrKlang.h>
#include <vector>

using std::vector;
using namespace irr;
using namespace irr::audio;

/**
 * SoundManager
 *
 * manage the sound / music in this game
 */
class SoundManager : public Singleton<SoundManager>
{
public:
	/**
	 * background music list
	 *
	 */
	typedef vector<std::string> tMusicList;

	/**
	 * sound effect type
	 *
	 */
	enum E_SND_TYPE
	{
		SND_DEATH_1,
		SND_DEATH_2,
		SND_EAT,
		SND_EXPLODE,
		SND_TAKE_BONUS,
		SND_LOGO,
		SND_COUNT
	};
public:
	/**
	 * Constructor
	 *
	 */
	SoundManager();

	/**
	 * Destructor
	 *
	 */
	~SoundManager();

	/** 
	 * init
	 *
	 * @param g_volume global volume
	 */
	bool	init( float g_volume );

	/**
	 * update
	 *
	 * when one music is end, it will play next in the list
	 * the param is the camera's properties , for 3d sound
	 */
	void	update( const vector3df &pos, const vector3df &lookat );

	/** 
	 * loadMusicList
	 *
	 */
	bool	loadMusicList( const char *file );

	/**
	 * playNextMusic
	 *
	 * play a new music in the music list
	 */
	void	playNextMusic();

	/**
	 * playSound
	 *
	 */
	void	playSound( int sndType, const vector3df pos );
	void	playSound( int sndType );

private:
	ISoundEngine *mSndEngine;
	tMusicList    mMusicList;

	ISound *mCurMusic;
};

#endif //end _SOUND_MANAGER_H_

⌨️ 快捷键说明

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