Record.h
资源名称:111.rar [点击查看]
上传用户:mony888
上传日期:2022-07-26
资源大小:1247k
文件大小:2k
源码类别:
Windows CE
开发平台:
Visual C++
- #ifndef _RECORD_H_
- #define _RECORD_H_
- #include <windows.h>
- #include <dsound.h>
- #include "codectypes.h"
- #include "AudioFile.h"
- #define WM_RECDING WM_USER + 800
- #define WM_STOPRECD WM_USER + 801
- typedef struct {
- // RiffHdr riffHdr;
- char fileID[4];
- DWORD fileleth;
- char wavTag[4];
- char FmtHdrID[4];
- DWORD FmtHdrLeth;
- // ChunkHdr FmtHdr;
- WORD FormatTag;
- WORD Channels;
- DWORD SamplesPerSec;
- DWORD AvgBytesPerSec;
- WORD BlockAlign;
- WORD BitsPerSample;
- // ChunkFmtBody FmtBody;
- char DataHdrID[4];
- DWORD DataHdrLeth;
- // ChunkHdr DataHdr;
- } WaveHdr;
- struct buf_Mode {
- BYTE ucSize;
- BYTE ucUsed;
- };
- enum BufMode { _2to4, _4to8, _8to16 };
- class Record
- {
- public:
- virtual ~Record();
- MMRESULT ToRec();
- MMRESULT InitRecord(WAVEFORMATEX & wfx);
- MMRESULT OpenMic();
- MMRESULT SetBufSiz(DWORD dwBufSiz);
- MMRESULT ClosMic();
- MMRESULT ClosRecord();
- MMRESULT ToPlay(LPCTSTR pszFileName);
- MMRESULT ToPaus();
- MMRESULT ToStop();
- void SetCodecInterface(CodecInterfaceType& CodecInterf);
- friend extern Record & Recorder(BufMode ModeKey = _4to8, DWORD dwBufSiz = 1600 /* 100ms sample data */);
- HANDLE m_fh;
- DWORD m_dwPCMSiz;
- protected:
- Record(BufMode ModeKey, DWORD dwBufSiz);
- CodecInterfaceType* m_pCodecInterf;
- const BYTE m_BUFBLKSIZE;
- const BYTE m_BUFBLKUSED;
- DWORD m_BufSiz;
- UINT m_uiDeviceId;
- WAVEFORMATEX m_wfx;
- DWORD m_dwWaitTime; // The time wait to check buffer.
- PWAVEHDR m_pDataHdr; // Pointer to waveHeader(wave data header) array.
- BYTE m_BufNO;
- HWAVEIN m_hwi; // Handle of the wave in device.
- HANDLE m_hevDone; // Handle of the event in recording.
- PBYTE m_pEncData;
- DWORD m_EncDataSiz;
- CodecContext m_Data;
- private:
- };
- #endif