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

📄 mci.h

📁 用MFC写的RPG游戏
💻 H
字号:
//
//	MCI 类别/CD-DA/Wave 类别
//
//		Copyright (c) 2000-2001 Chihiro.SAKAMOTO (HyperWorks)
//
#ifndef __MUSIC_H__
#define __MUSIC_H__

class CWindow;

//
//	MCI 类别
//
class CMci	{
  public:
	CMci(const char *_device, const char *_errTitle);
	~CMci();

	virtual bool Open(CWindow *win);
	virtual bool Close();

	virtual bool Play(int no);
	virtual bool Play(const char *name);
	virtual bool Replay();
	virtual bool Stop();

	DWORD GetId() const { return Id; }

  protected:
	void MciErrorMessageBox(DWORD err);
	bool MciOpen(const char *command);
	bool MciOpen();
	bool MciOpen(const char *dev, const char *element);
	bool MciClose();
	bool MciPlay(const char *request);
	bool MciStop();
	bool MciSet(const char *request);
	bool MciStatus(const char *request, char *result, int resultlen);

  protected:
	CWindow *Window;
	const char *device;
	const char *errTitle;
	DWORD	Id;
} ;

// inline 成员函式

inline CMci::CMci(const char *_device, const char *_errTitle)
	: Id(0), device(_device), errTitle(_errTitle)
{
}

inline CMci::~CMci()
{
	Close();
}

//
// CD Audio class
//
class CDAudio: public CMci {
  public:
	CDAudio(): CMci("cdaudio", "CD Audio 发生错误"), IsOpen(false), PlayTrack(0) {}

	virtual bool Open(CWindow *win);
	virtual bool Close();

	virtual bool Play(const char *name);
	virtual bool Play(int no);
	virtual bool Replay();
	virtual bool Stop();

  protected:
	int MediaChk();

  protected:
	int		PlayTrack;
	bool	IsOpen;
} ;

//
//	Wave Class
//
class WaveOut: public CMci {
  public:
	WaveOut(): CMci("sound", "Wave Audio 发生错误"), playing(false) {}

	virtual bool Play(const char *name);
	virtual bool Play(int no);
	virtual bool Stop();

  protected:
	bool	playing;
} ;

#endif

⌨️ 快捷键说明

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