wavfile.h

来自「音频压缩解压缩软件」· C头文件 代码 · 共 71 行

H
71
字号

#ifndef _WAVfile_h_
#define _WAVfile_h_

#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>

#include "WAVint.h"
#include "def.h"


/*
 * These are the wavplay command operation modes.
 */
typedef enum {
	OprNoMode=0,				/* No mode given (not determined yet) */
	OprRecord=1,				/* wavplay command is in "Record Mode" */
	OprPlay=2,				/* wavplay command is in "Play Mode" */
} OprMode;

/*
 * This enumerated type, selects between monophonic sound and
 * stereo sound (1 or 2 channels).
 */
typedef enum {
	Mono,					/* Monophonic sound (1 channel) */
	Stereo					/* Stereo sound (2 channels) */
} Chan;

/*
 * This structure holds the command line options for the wavplay command.
 * It is also used to pass option values around (in server mode etc.)
 */
typedef struct {
	
	OprMode	 Mode;				/* Operation Mode: OprRecord or OprPlay */
	UInt32	SamplingRate;			/* -s rate ; sampling rate in Hz */
	Chan       Channels;			/* -S ; or no -S option (stereo/mono respectively) */
	UInt16	DataBits;			/* -b bits ; number of bits per sample */
	UInt32	Seconds;			/* Time limited to this many seconds, else zero */
	
} WavPlayOpts;



/*
 * This structure manages an open WAV file.
 */
typedef struct {
	char	rw;				/* 'R' for read, 'W' for write */
	char	*Pathname;			/* Pathname of wav file */
	int	fd;				/* Open file descriptor or -1 */
	UInt32	SamplingRate;			/* Sampling rate in Hz */
	Chan	Channels;			/* Mono or Stereo */
	UInt32	Samples;			/* Sample count */	
	UInt16	DataBits;			/* Sample bit size (8/12/16) */
	UInt32	DataStart;			/* Offset to wav data */
	UInt32	DataBytes;			/* Data bytes in current chunk */

} WAVFILE;


extern WAVFILE *WavOpenForRead(const char *Pathname);
extern WAVFILE *WavOpenForWrite(const char *Pathname,Chan chmode,UInt32 sample_rate,UInt16 bits,UInt32 samples);
extern int WavClose(WAVFILE *wfile);



#endif /* _wavplay_h_ */

⌨️ 快捷键说明

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