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

📄 msoundplayer.h

📁 这是一个用BREW和VC++开发的暴力摩托游戏,与大家一同分享.
💻 H
字号:
#ifndef _MSOUNDPLAYER_H
#define _MSOUNDPLAYER_H

#include "AEE.h"
#include "AEEModGen.h"
#include "AEEAppGen.h"
#include "AEEShell.h"
#include "AEEStdLib.h"
#include "AEEHeap.h"

#include "MGlobalConstant.h"
#include "MGlobalMacro.h"

#include "MResourceTool.h"
#include "MBinary.h"

#if defined(KTF_VER_10) || defined(KTF_VER_11_OVER)
#include "IEB_KTF_DM.h"
#endif

typedef enum {
	MYSOUND_PLAY_NOTHING = -1,
	MYSOUND_WAIT_DELAY = -2
} MYSOUND_MODE;

#define VIRTUAL_CB_HAZARD	100		// 啊惑 荤款靛 妮归 困氰 皑荐 矫埃

class CMSoundPlayer {

public:
	__MACRO_NEW_DELETE_SOURCE

	CMSoundPlayer() {
		pIShell_ = ((AEEApplet *)GETAPPINSTANCE())->m_pIShell;

	#ifdef LOAD_FROM_FILE
		pSoundBuf_			= NULL;
		pSoundStart_		= NULL;
		pSoundSize_			= NULL;
		pSoundRealSize_		= NULL;
	#else
		pSoundRes_	= NULL;
	#endif	// LOAD_FROM_FILE

		pSoundBuffArr_ = NULL;
		pISoundPlayer_ = NULL;

	#ifndef USE_CALLBACK
		totalPlayTimeMs_ = NULL;
	#endif	// USE_CALLBACK
		playPriority_	= NULL;

		pResTool_ = new CMResourceTool();
	}

	~CMSoundPlayer() {
		finalize();
	}

	void setResToolRef(CMResourceTool *pResTool);

	void initialize(int nSoundCount);
	void finalize();
	
#ifdef LOAD_FROM_FILE

	boolean createSoundFileInfo(char *pSndFileName, char **pMergeFileNames = NULL);
	boolean loadSoundFile(int nIndex, boolean bCompressed = false);
	void freeSoundFile(int nIndex);

	#ifdef AEE_SIMULATOR
		void createSoundFile(char *pTrgFileName, char **pSrcFileNames);
	#endif	// AEE_SIMULATOR

#else

	boolean loadSoundRes(int nIndex, int ResID, char *szFileName, boolean bCompressed = false);
	void freeSoundRes(int nIndex);

#endif	// LOAD_FROM_FILE



	//void setVolume(int nRate);
	//void effectVolume();

	boolean getSoundCount();
	boolean getSoundStatus();
	void setSoundStatus(boolean bSound);

	boolean playSound(int nIndex, boolean bRepeat);

	void stopSound();
	void pauseSound();
	void resumeSound();
	void toggleSound();

	void push(int nIndex, boolean bRepeat);
	void pop();
	void checkSound();

	void setPriority(int nIndex, uint8 priorityLevel);
	void setGapDelay(int delay);

#ifdef USE_CALLBACK
	static void SoundCB(void *pUser, AEESoundPlayerCmd eCBType, AEESoundPlayerStatus eSPStatus, uint32 dwParam);
#else
	void virtualSoundCB();
	void setPlayTimeMs(int nIndex, int ms);
	int getPlayTimeMs(int nIndex);
#endif	// USE_CALLBACK

	void initSoundData();
	int nGapDelay_;				// 荤款靛 楷林 Gap 狼 Delay

private:

	AEESoundPlayerInfo *pSoundBuffArr_;
	ISoundPlayer *pISoundPlayer_;

	IShell *pIShell_;
	CMResourceTool *pResTool_;
	
	boolean bSound_;
	int nSoundCount_;

	int Queue_[1];
	boolean QueueRepeat_[1];
	int nQueueCount_;

	//int m_nVolume;
	int nWaitCount_;

	int nPlayingIndex_;			// 泅犁 Play吝牢 Index
	int nRepeatIndex_;			// 泅犁 Repeat 吝牢 Index

	uint8 *playPriority_;		// Play 秦具且 快急 鉴困
	//int nGapDelay_;				// 荤款靛 楷林 Gap 狼 Delay
	int nWaitStartTime_;


#ifdef LOAD_FROM_FILE
	int *pSoundStart_;
	int *pSoundSize_;
	int *pSoundRealSize_;
	byte **pSoundBuf_;			// Sound Data甫 淬绊 乐绰 Buffer

	char *pSoundFileName_;
	boolean createSoundFileHead(char *pRefFileName);
#else
	CMBinary **pSoundRes_;		// Sound Data甫 淬绊 乐绰 Buffer
#endif	// LOAD_FROM_FILE

#ifdef _6160_EXCEPTION
	boolean	bIs6160_;	// LG-KP6160狼 咯何
	boolean Is6160();
#endif

#ifndef USE_CALLBACK
	int *totalPlayTimeMs_;		// Total Play Time
	uint32 startPlayTime_;
	uint32 checkPlayTime_;
#endif	// USE_CALLBACK
};

#endif	// _MSOUNDPLAYER_H

⌨️ 快捷键说明

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