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

📄 wavplay.h

📁 使用在嵌入式linux平台或pc机上的wave文件录制和播放软件
💻 H
📖 第 1 页 / 共 2 页
字号:
 * associated with the open WAV file, given a (WAVFILE *). */#define WAV_FD(wfile) (wfile->fd)		/* Return file descriptor *//* * This structure manages an opened DSP device. */typedef struct {	int	fd;				/* Open fd of /dev/dsp */	int	dspblksiz;			/* Size of the DSP buffer */	char	*dspbuf;			/* The buffer */} DSPFILE;/* * This structure manages server information and state: */typedef struct {	UInt32	SamplingRate;			/* Sampling rate in Hz */	Chan	Channels;			/* Mono or Stereo */	UInt32	Samples;			/* Sample count */		UInt16	DataBits;			/* Sample bit size (8/12/16) */	char	WavType[16];			/* "PCM" */	char	bOvrSampling;			/* True if sampling is overrided */	char	bOvrMode;			/* True if mode is overrided */	char	bOvrBits;			/* True if bits is overrided */} SVRINF;/* * This is the function type that is called between blocks * of I/O with the DSP. */typedef int (*DSPPROC)(DSPFILE *dfile);		/* DSP work procedure *//* * Client/Server Message Types. These definitions must be coordinated with * source module msg.c, function msg_name(), for their corresponding * message texts. */typedef enum {	ToClnt_Fatal=0,				/* Fatal server error */	ToClnt_Ready=1,				/* Tell client that server is ready */	ToSvr_Bye=2,				/* Client tells server to exit */	ToSvr_Path=3,				/* Client tells server a pathname */	ToClnt_Path=4,				/* Client tells server a pathname */	ToClnt_Stat=5,				/* Response: Svr->Clnt to ToSvr_Path */	ToClnt_WavInfo=6,			/* Server tells client wav info */	ToSvr_Play=7,				/* Client tells server to play */	ToSvr_Pause=8,				/* Tell server to pause */	ToSvr_Stop=9,				/* Tell server to stop */	ToSvr_Bits=10,				/* Tell server to use 8 bits */	ToClnt_Bits=11,				/* Server tells what bit setting is in effect */	ToClnt_Settings=12,			/* Current server settings */	ToSvr_SamplingRate=13,			/* Tell server new sampling rate */	ToSvr_Restore=14,			/* Clear overrides: restore original settings */	ToSvr_Chan=15,				/* Change Stereo/Mono mode */	ToSvr_Record=16,			/* Tell server to start recording */	ToSvr_Debug=17,				/* Tell server debug mode setting */	ToClnt_ErrMsg=18,			/* Pass back to client, an error message string */	ToSvr_SemReset=19,			/* Reset locking semaphores */        ToSvr_StartSample=20,                   /* Start playback at requested sample */        ToClnt_PlayState=21,                    /* Playback status */        ToClnt_RecState=22,                     /* Record status */        MSGTYP_Last=23,                         /* This is not really a message type */} MSGTYP;/* * Client/Server Message Structure: This consists of a common header * component, and then a union of specific format variations according * to the message type. */typedef struct {	long	type;				/* Message Type: 1=server, 0=client */	MSGTYP	msg_type;			/* Client/Server message type */	UInt16	bytes;				/* Byte length of the union */	union	{		/*		 * Message from server to client, to convey a fatal error that		 * has occured in the server.		 */		struct	{			int	Errno;		/* Error code */			char	msg[128];	/* Error message text */		} toclnt_fatal;		/*		 * Message from the X client, to the server, to indicate that		 * a new pathname is to be referenced.		 */		struct	{			char	path[1024];	/* Pathname */		} tosvr_path;			/* Tell server a pathname */		/*		 * Message from the server to the X client, to indicate		 * that the indicated pathname has been accepted and		 * ready (the pathname may be canonicalized at some future		 * revision of the server)		 */		struct	{			char	path[1024];	/* Pathname */		} toclnt_path;			/* ..from server as confirmation */		/*		 * Message to X client, from the server, indicating a		 * stat() error when Errno != 0, or stat() information		 * when Errno == 0.		 */		struct	{			int	Errno;		/* Zero if OK, else errno from stat() */			struct stat sbuf;	/* Path's stat info */		} toclnt_stat;		/*		 * Message to X client, from server, indicating an		 * error if errno != 0, or successfully obtained		 * WAV file info if errno == 0.		 */		struct	{			int	Errno;		/* Zero if OK, else errno value */			WAVINF	wavinfo;	/* WAV file info */			char	errmsg[256];	/* Error message */		} toclnt_wavinfo;		/*		 * Message from X client, to server, indicating how		 * many bits per sample to use (request).		 */		struct	{			int	DataBits;	/* 8/12/16 bit override requested */		} tosvr_bits;		/*		 * Message to X client, from server, indicating		 * the accepted number of bits per sample (response		 * to request).		 */		struct	{			int	DataBits;	/* Server says this # of bits in effect */		} toclnt_bits;		/*		 * Message to X client, from server, indicating the		 * current server settings.		 */		SVRINF	toclnt_settings;	/* Current server settings */		/*		 * Message from X client, to server, indicating the		 * requested sampling rate to use (request).		 */		struct S_SvrSampRate {			UInt32	SamplingRate;	/* In Hz */		} tosvr_sampling_rate;		/*		 * Message from X client, to server, indicating the		 * number of channels to use (request).		 */		struct	{			Chan	Channels;	/* New channel mode: Stereo/Mono */		} tosvr_chan;                /*                 * Message from X client, to server, indicating the sample to                 * start playback at (request).                 */                struct  {                        UInt32  StartSample;    /* New origin */                } tosvr_start_sample;		/*		 * Message from X client, to server, indicating the		 * channels to use, the sampling rate to use, and		 * the data bits per channel to use (request).		 */		struct	{			Chan	Channels;	/* Stereo or Mono */			UInt32	SamplingRate;	/* Start recording at this rate */			UInt16	DataBits;	/* 8/12/16 data bits */		} tosvr_record;		/*		 * Message from X client to server, to set the server's		 * debug mode global (cmdopt_x).		 */		struct	{			char	bDebugMode;	/* True if debug mode set, else not debug mode */		} tosvr_debug;		/*		 * Message from server to client, to convey a NON-fatal error that		 * has occured in the server.		 */		struct	{			int	Errno;		/* Error code */			char	msg[512];	/* Error message text */		} toclnt_errmsg;                /*                 * Message from server to client with playback status.                 */                struct {                        int     CurrentSample;  /* Currently playing sample */                        int     SamplesLeft;    /* Samples left */                } toclnt_playstate;                /*                 * Message from server to client with record status.                 */                struct {                        int     bytes_written;  /* Number of bytes sampled */                        int     num_samples;    /* Samples taken */                } toclnt_recstate;	} u;					/* The message union of all message types */} SVRMSG;extern char *ProcTerm(int procstat);extern int MsgCreate(void);extern int MsgSend(int ipcid,SVRMSG *msg,int flags,long msgtype);extern int MsgRecv(int ipcid,SVRMSG *msg,int flags,long msgtype);extern int MsgClose(int ipcid);extern char *msg_name(MSGTYP mtyp);extern void msg_dump(const char *desc,MSGTYP mtyp);#define MSGNO_CLNT	3L#define MSGNO_SRVR	2L#define MsgToClient(ipcid,msg,flags) MsgSend(ipcid,msg,flags,MSGNO_CLNT)#define MsgToServer(ipcid,msg,flags) MsgSend(ipcid,msg,flags,MSGNO_SRVR)#define MsgFromClient(ipcid,msg,flags) MsgRecv(ipcid,msg,flags,MSGNO_SRVR)#define MsgFromServer(ipcid,msg,flags) MsgRecv(ipcid,msg,flags,MSGNO_CLNT)extern int OpenDSPLocks(key_t LockIPCKey,int SemUndoFlag,ErrFunc erf);extern int LockDSP(int ipc,int playrecx,ErrFunc erf,unsigned timeout_secs);extern int UnlockDSP(int ipc,int playrecx,ErrFunc erf);extern WAVFILE *WavOpenForRead(const char *Pathname,ErrFunc erf);extern WAVFILE *WavOpenForWrite(const char *Pathname,OprMode m,UInt32 sample_rate,UInt16 bits,UInt32 samples,ErrFunc erf);extern void WavReadOverrides(WAVFILE *wfile,WavPlayOpts *wavopts);extern int WavClose(WAVFILE *wfile,ErrFunc erf);extern DSPFILE *OpenDSP(WAVFILE *wfile,int omode,ErrFunc erf);extern int PlayDSP(DSPFILE *dfile,WAVFILE *wfile,DSPPROC work_proc,ErrFunc erf);extern int RecordDSP(DSPFILE *dfile,WAVFILE *wfile,UInt32 samples,DSPPROC work_proc,ErrFunc erf);extern int CloseDSP(DSPFILE *dfile,ErrFunc erf);extern int recplay(WavPlayOpts *wavopts,char **argv,ErrFunc erf);extern int wavplay(WavPlayOpts *wavopts,char **argv,ErrFunc erf);extern int wavrecd(WavPlayOpts *wavopts,char *Pathname,ErrFunc erf);extern void RegisterSigHandlers(void);extern char *env_WAVPLAYPATH;			/* Default pathname of executable /usr/local/bin/wavplay */extern char *env_AUDIODEV;			/* Default compiled in audio device */extern unsigned long env_AUDIOLCK;		/* Default compiled in locking semaphore */extern int cmdopt_x;				/* Debug option flag */#endif /* _wavplay_h_ *//* $Source: /home/cvs/wavplay/wavplay.h,v $ */

⌨️ 快捷键说明

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