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

📄 keycmd.h

📁 miXo is a buzz machine (www.buzzmachines.com) - a plugin for the freely available jeskola buzz track
💻 H
字号:
// KeyCmd.h: interface for the CKeyCmd class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_KEYCMD_H__3B54C944_4437_11D5_8DCF_EC6FE8470C3D__INCLUDED_)
#define AFX_KEYCMD_H__3B54C944_4437_11D5_8DCF_EC6FE8470C3D__INCLUDED_
#include "Key.h"
#include <assert.h>
#include <deque>
using namespace std;
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
class CMixerKeyDef;
class CKey;
class CMixerTrack;
class CKeyCmd
{
	CKey *m_pcKey;
	unsigned m_uPos;
	int m_iKeyDefId;
//	CMixerTrack *m_pTrack;
	unsigned m_uId;
	int m_iToMode;
	unsigned long m_ulEventTime;
	unsigned m_uRepeat;
	unsigned m_uRepeatPos;
	bool m_bDone;
	bool m_bKeyUpped;
public:
	CKeyCmd():m_pcKey(NULL),m_uPos(0),m_uId(0),
		m_iToMode(cmd::ToMe),m_ulEventTime(0),m_uRepeat(0),
		m_bDone(false),m_bKeyUpped(false),m_uRepeatPos(0),
		m_iKeyDefId(-1)	{}
	CKeyCmd(const CKeyCmd &c) : m_pcKey(c.m_pcKey),m_uPos(c.m_uPos),
		m_uId(c.m_uId),m_uRepeat(c.m_uRepeat),
		m_ulEventTime(c.m_ulEventTime),m_iToMode(c.m_iToMode),
		m_bDone(c.m_bDone),m_bKeyUpped(c.m_bKeyUpped),
		m_uRepeatPos(c.m_uRepeatPos),m_iKeyDefId(c.m_iKeyDefId) {}
	CKeyCmd(CKey *pKey,int iKeyDefId,unsigned id)
		: m_pcKey(pKey),m_uId(id),m_uPos(0),
		m_iToMode(cmd::ToMe),m_ulEventTime(0),m_uRepeat(0),
		m_bDone(false),m_bKeyUpped(false),m_uRepeatPos(0),
		m_iKeyDefId(iKeyDefId) {}
	virtual ~CKeyCmd() {}
	CKey *GetMixerKey() const { return m_pcKey; }
	void PressedAgain(int iKey,long lData) {}
	cmd::TCmd Get() { return m_pcKey->GetCmd().Get(m_uPos++); }
	unsigned GetId()const {return m_uId; }
//	CMixerTrack *GetMixerTrack() const { return m_pTrack; }
	int GetKeyDefId() const { return m_iKeyDefId; }
	void SetToMode(int m) { m_iToMode=m; }
	int GetToMode() { return m_iToMode; }
	void SetPosition(unsigned u) {m_uPos=u; }
	void SetTime(unsigned long ul) { m_ulEventTime=ul; }
	unsigned long GetTime() const { return m_ulEventTime; }
	void SetRepeat(unsigned r) { m_uRepeat=r; }
	unsigned GetRepeat() const { return m_uRepeat; }
	void Repeated() { m_uRepeat--; m_uPos=m_uRepeatPos; }
	bool IsDone() const { return m_bDone; }
	void SetDone(bool b=true)  { m_bDone=b; }
	bool IsKeyUp() const { return m_bKeyUpped; }
	void SetKeyUp(bool b=true) { m_bKeyUpped=b; }
	unsigned GetRepeatPos() const { return m_uRepeatPos; }
	void SetRepeatPos(unsigned u) {m_uRepeatPos=u; }
	void SetRepeatPos() {m_uRepeatPos=m_uPos; }
};
class CMixerStatus;
class CMixDlg;
class CMixerKeyTable;
class CKeyHandler
{
	int m_iListLock;
	unsigned m_uIdRun;
	CMixerKeyTable *m_pcKeyTable;
	CMixerStatus*m_pcMixerStatus;
	CMixDlg *m_pcMixDlg;
	typedef deque<CKeyCmd> TLstKeyCmd;
	TLstKeyCmd m_lstKeyCmd;
	static const char m_cszGlobal[];
	enum { defaultKeyRetrig=100 };
public:
	CKeyHandler(CMixerKeyTable*,CMixerStatus*,CMixDlg*);
	virtual ~CKeyHandler();
	bool KeyDown(int iKey,long lData);
	bool KeyUp(int iKey,long lData);
	TLstKeyCmd::iterator GetFromListByKey(int iKey);
	void ProcessPendingEvents();
	void ClearPendingEvents();
//	void ProcessCmd(unsigned);
protected:
	void ScheduleKeyEvent(CKeyCmd,unsigned long);
	void StartProcessCmd(int,CMixerKeyDef *,int);
	void ProcessCmd(CKeyCmd );
	void LockList() { assert(m_iListLock>=0); m_iListLock++; }
	void UnLockList() { assert(m_iListLock>=0); m_iListLock--; }
	bool IsListLock() const { assert(m_iListLock>=0); return ((m_iListLock > 0)?true:false); }
	void WaitListLock() const { assert(m_iListLock>=0); while(m_iListLock > 0) {}; }
};


#endif // !defined(AFX_KEYCMD_H__3B54C944_4437_11D5_8DCF_EC6FE8470C3D__INCLUDED_)

⌨️ 快捷键说明

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