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

📄 audiofile.h

📁 转换音频Wav到PCM PCM -> G723 G729 Gsm iLBC G723 G729 Gsm iLBC -> PCM 需要p_voice库支持
💻 H
字号:
// AudioFile.h: interface for the CAudioFile class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_AUDIOFILE_H__D8A0CB41_EB04_11D4_A31E_5254AB104E6A__INCLUDED_)
#define AFX_AUDIOFILE_H__D8A0CB41_EB04_11D4_A31E_5254AB104E6A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CAudioFile : public CFile 
{
	DECLARE_DYNAMIC(CAudioFile)
public:
	CAudioFile();
	~CAudioFile();

	virtual BOOL Open(LPCTSTR lpszFileName, UINT nOpenFlags = CFile::modeRead, CFileException* pError = NULL);
	virtual UINT Read(void* lpBuf, UINT nCount);
	virtual void Write(const void* lpBuf, UINT nCount);
	virtual void Close(); 

	int SetOptions(int iType, BOOL bUseAcm, BOOL bUseVAD, BOOL bUseHighRate);

public:
	static int EncodeG711a(short * pSample, unsigned char * pCode, int iSampleLength);
	static int EncodeG711u(short * pSample, unsigned char * pCode, int iSampleLength);
	static int DecodeG711a(unsigned char * pCode, short * pSample, int iCodeLength);
	static int DecodeG711u(unsigned char * pCode, short * pSample, int iCodeLength);

	static void InitG721();
	static int EncodeG721(short * pSample, unsigned char * pCode, int iSampleLength);
	static int DecodeG721(unsigned char * pCode, short * pSample, int iCodeLength);

	static void InitGSM();
	static void FreeGSM();
	static int EncodeGSM(short * pSample, unsigned char * pCode, int iSampleLength);
	static int DecodeGSM(unsigned char * pCode, short * pSample, int iCodeLength);

	static void InitG729cp(BOOL bUseVAD);
	static int EncodeG729cp(short * pSample, unsigned char * pCode, int iSampleLength);
	static int DecodeG729cp(unsigned char * pCode, short * pSample, int iCodeLength);

	static void InitG723f(BOOL bUseVAD, BOOL bUseHighRate);
	static int EncodeG723f(short * pSample, unsigned char * pCode, int iSampleLength);
	static int DecodeG723f(unsigned char * pCode, short * pSample, int iCodeLength);

	static void InitILBCf();
	static int EncodeILBCf(short * pSample, unsigned char * pCode, int iSampleLength);
	static int DecodeILBCf(unsigned char * pCode, short * pSample, int iCodeLength);

protected:
	int Decode(unsigned char * pCode, short * pSample, int iCodeLength);
	int Encode(short * pSample, unsigned char * pCode, int iSampleLength);

protected:
	int m_iType;
	BOOL m_bUseAcm;
};

#endif // !defined(AFX_AUDIOFILE_H__D8A0CB41_EB04_11D4_A31E_5254AB104E6A__INCLUDED_)

⌨️ 快捷键说明

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