Пример #1
0
//Audio data of the audio talk callback 
void CClientDlg::AudioData(LONG lTalkHandle, char *pDataBuf, DWORD dwBufSize, BYTE byAudioFlag)
{
	if(m_hTalkHandle == lTalkHandle)
	{
		if(0 == byAudioFlag)
		{
			//It means it is the audio data from the local reocrd library
			//TRACE("The audio data lenght to be sent:%d \n",dwBufSize);
			long lSendLen = CLIENT_TalkSendData(lTalkHandle, pDataBuf, dwBufSize);
			if(lSendLen != (long)dwBufSize)
			{
				//Error occurred when sending the user audio data to the device
				
			}
		}
		else if(1 == byAudioFlag)
		{
			//It means it has received the audio data from the device.
			CLIENT_AudioDec(pDataBuf, dwBufSize);
			//TRACE("The audio data lenght received:%d \n",dwBufSize);
#ifdef _DEBUG
			FILE *stream;
			if( (stream = fopen("E:\\Talk.txt", "a+b")) != NULL )
			{
				int numwritten = fwrite( pDataBuf, sizeof( char ), dwBufSize, stream );
				fclose( stream );
			}
#endif
		}
	}
}
Пример #2
0
static void 
dah_audio_data_callback(LLONG talk_handle, char *data_buf, DWORD buf_size, 
								BYTE audio_flag, LDWORD user)
{
    if(!user)
        return;
    talk_info_t *talk = (talk_info_t*)user;
    talk_handle_t *hdl = talk->hdl;
    if(1 == audio_flag)//设备发过来的数据
    {
        CLIENT_AudioDec(data_buf, buf_size);

        dah_send_audio_data(hdl, data_buf, buf_size, talk->frm);
    }
}