📄 wavfile.h
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -