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

📄 record.h

📁 好记星的控件,包括button,list,对文件操作
💻 H
字号:
/*************************************************************************/
/*                                                                       */
/* Copyright (c) 2005, 名人电脑科技有限公司深圳研发中心                  */
/* All rights reserved.                                                  */
/*                                                                       */
/* 文件名称: Record.h                                                    */
/* 文件描述: 录音模块                                                    */
/*                                                                       */
/* 当前版本: 1.0                                                         */
/* 作    者: Bingle                                                      */
/* 完成日期: 2005年05月25日                                              */
/*                                                                       */
/* 函数列表:                                                             */
/*                                                                       */
/* 更改记录:                                                             */
/* ===================================================================== */
/*    日期       人员       版本   描述                                  */
/* ===================================================================== */
/* 2005-02-22   Bingle      1.0    create                                */
/* 2005-05-21   Bingle      2.0    modified for ed136                    */
/*************************************************************************/
#ifndef __RECORD_H
#define __RECORD_H

#define RECORD_FILE_FORMAT_ERROR    -1

#ifndef WIN32
#define ADPCM_FORMAT
#ifndef __packed		// DennyHan added this MACRO for ERROR
#define	__packed
#endif
#endif

#ifdef ADPCM_FORMAT
//****************************************************************************
//
// This structure contains the coefficients used by the MS ADPCM algorithm as
// stored in the wave format structure in the "fmt " chunk of the WAVE file.
//
//****************************************************************************
typedef __packed struct
{
    short iCoef1;
    short iCoef2;
} ADPCMCoefSet;

//****************************************************************************
//
// This structure contains the definition of the wave format structure as
// stored in the "fmt " chunk of the WAVE file.  
//
//****************************************************************************
typedef __packed struct
{
    unsigned short wFormatTag;
    unsigned short nChannels;
    unsigned long nSamplesPerSec;
    unsigned long nAvgBytesPerSec;
    unsigned short nBlockAlign;
    unsigned short wBitsPerSample;
    unsigned short cbSize;
    unsigned short wSamplesPerBlock;
    unsigned short wNumCoef;
    ADPCMCoefSet aCoef[7];
} ADPCMWaveFormat;

typedef __packed struct tagAdpcmWaveFileHeader{
	UINT8 RIFF[4];
	UINT32 uFileLen;
	UINT8 Format[8];
	UINT32 uWFMT_Size;
	ADPCMWaveFormat wfx;
	UINT8 data[4];
	UINT8 uDataLen[4];
} ADPCM_WAVEFILEHEADER;

#endif// ADPCM_FORMAT


#define RECORD_STATUS_STOP      1
#define RECORD_STATUS_RECORD    2
#define RECORD_STATUS_PAUSE     4

#define	RECORD_BUFLEN	    16000
#define RECORD_HEAD_LEN     (4000 / 2)

#define RECORD_REFRESH      201     //刷新消息,每写一秒数据发送一次
#define RECORD_BUFFER1_FULL 202     //第一块缓冲已满
#define RECORD_BUFFER2_FULL 203     //第二块缓冲已满
#define RECORD_DISK_FULL    204     //磁盘已满

#define RECORD_MODE_APPEND  1                   //添加模式
#define RECORD_MODE_REPLACE 2                   //替换模式,清除原有数据

typedef struct tagMRecord {
    UINT32      status;                         //录音状态
    NU_DRIVER   *pRecordDrv;                    //录音驱动
    INT         hFile;                          //录音文件句柄
    UINT32      dwTotalLen;                     //录音数据长度
    UINT32      dwBytesPerSec;                  //每秒字节数
    UINT32      dwSumTime;                      //录音时间
    WAVEHDR	    recordHdr1;                     //录音缓冲1
    WAVEHDR     recordHdr2;                     //录音缓冲2
    UINT8       *pCallBackFunc;                 //回调函数
    UINT8       writeData;
    UINT8       fileName[FILE_MAX_NAMELEN];     //文件名
    UINT8	    recordBuf1[RECORD_BUFLEN];      //录音缓冲1
    UINT8	    recordBuf2[RECORD_BUFLEN];      //录音缓冲2
}MRecord;

BOOL    RecordInit(void);
MRecord *RecordOpen(UINT8 *fileName, UINT16 wMode);
BOOL    RecordStart(MRecord *handle);
BOOL    RecordPause(MRecord *handle);
BOOL    RecordResume(MRecord *handle);
BOOL    RecordStop(MRecord *handle);
BOOL    RecordClose(MRecord *handle);
BOOL    RecordWrite(MRecord *handle, WAVEHDR *pwh);
BOOL    RecordIsRun(void);
VOID    SendVoiceMsg(UINT wParam);
int		RecordGetError(void);
UINT32  RecordGetBPS(void);
void    RecordSetCallBack(MRecord *handle, UINT8 *pCallBack);

#ifdef ADPCM_FORMAT
extern unsigned char Adpcm_EncStart(void);
extern unsigned char Adpcm_EncInit(WAVEFORMATEX *pSrcWfx, ADPCMWaveFormat *pDstWfx);
#endif

#endif

⌨️ 快捷键说明

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