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

📄 voicepool.cpp

📁 MDF监控源码2
💻 CPP
字号:
// VoicePool.cpp: implementation of the CVoicePool class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "mdf.h"
#include "VoicePool.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

#define VOICE_MAX 500 ;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
extern CMDFApp theApp ;

//##ModelId=44B6F88301C6
CVoicePool::CVoicePool()
{
	hEvent = CreateEvent ( NULL , FALSE , TRUE , NULL ) ; //建立信号状态

	m_nCount = 0 ;

	m_nMax = VOICE_MAX ;
}

//##ModelId=44B6F88301C7
CVoicePool::~CVoicePool()
{

}

//##ModelId=44B6F88301A9
int CVoicePool::AddVoice(CString strEQName, CString strAddr, int nPort, HWND hWnd,CString strName,CString strPhone)
{
	CString strTip ;
	sVoice f_Voice ;
	f_Voice.strEQName = strEQName ;
	f_Voice.strEQAddr = strAddr ;
	f_Voice.strName = strName ;
	f_Voice.strPhone = strPhone ;
	f_Voice.nEQPort = nPort ;
	f_Voice.nFault = 0 ;
	f_Voice.hWnd = hWnd ;

	WaitForSingleObject ( hEvent , INFINITE ) ;

	strTip.Format("程序:添加一条语音 接收:%s",f_Voice.strName) ;
	theApp.TestWriteLog(strTip) ;

	m_VoiceList.AddTail(f_Voice) ;

	m_nCount = m_VoiceList.GetCount() ;

	SetEvent ( hEvent ) ;

	return 0 ;
}

//##ModelId=44B6F88301A8
int CVoicePool::DelVoice()
{
	CString strTip ;
	sVoice f_Voice ;

	WaitForSingleObject( hEvent , INFINITE ) ;

	if( !m_VoiceList.IsEmpty() )
	{
		f_Voice = m_VoiceList.GetHead() ;
		strTip.Format("程序:删除一条语音 接收:%s",f_Voice.strName) ;
		theApp.TestWriteLog(strTip) ;
		m_VoiceList.RemoveHead() ;
	}

	m_nCount = m_VoiceList.GetCount() ;

	SetEvent( hEvent ) ;

	return 0 ;
}

//##ModelId=44B6F88301A6
int CVoicePool::GetVoice(sVoice &f_Voice)
{
	WaitForSingleObject( hEvent,INFINITE) ;
	if( !m_VoiceList.IsEmpty() )
		f_Voice = m_VoiceList.GetHead() ;
	else
		return -1 ;
	SetEvent( hEvent ) ;
	return 0 ;
}

//##ModelId=44B6F88301A5
int CVoicePool::GetCount()
{
	return m_nCount ;
}

//##ModelId=44B6F8830197
int CVoicePool::AddSVoice(sVoice f_Voice)
{
	CString strTip ;

	WaitForSingleObject ( hEvent , INFINITE ) ;

	strTip.Format("程序:添加一条语音 接收:%s",f_Voice.strName) ;
	theApp.TestWriteLog(strTip) ;

	m_VoiceList.AddTail(f_Voice) ;
	m_nCount = m_VoiceList.GetCount() ;

	SetEvent ( hEvent ) ;

	return 0 ;
}

⌨️ 快捷键说明

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