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

📄 sndoperation.h

📁 linux下用c++编写的录音放音程序
💻 H
字号:
// SndOperation.h: interface for the CSndOperation class.
//
//////////////////////////////////////////////////////////////////////

#ifndef _SNDOPERATION_H_
#define _SNDOPERATION_H_

#include <sys/ioctl.h>
#include <linux/soundcard.h>
#include <unistd.h>

#define FMT8BITS AFMT_U8 /*unsigned 8 bits(for almost PC) */
#define FMT16BITS AFMT_S16_LE /*signed 16 bits,little endian */

#define DFT_SND_FMT  FMT16BITS
#define DFT_SND_SPD  FMT48K
#define DFT_SND_CHN  STEREO

#define TRUE  1
#define FALSE  0

#define FMT8K    8000 /*default sampling rate */
#define FMT11K   11025 /*11,22,44,48 are three pop rate */
#define FMT22K   22050
#define FMT44K   44100
#define FMT48K  48000

#define MONO     1
#define STEREO   2

class CSndOperation  
{
public:
	CSndOperation();
	virtual ~CSndOperation();
	bool OpenDev(unsigned int flag);
	bool CloseDev();
	bool SetFormat(unsigned int bits, unsigned int chn,unsigned int hz);
	int Record(char *buf, int size);
	int Play(char *buf, int size);

	unsigned int m_devfd;
};

#endif

⌨️ 快捷键说明

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