Libcwav -- Waveform I/O Library -- Functions


File Access Functions

opnwav(char *file, char mode, WDB *wdb)
Open a waveform file for I/O
clswav(WVFILE *wfp)
Close a waveform file opened with opnwav()

Waveform I/O Functions

osam(WVFILE *wfp, short iv)
Output a sample
outwav(WVFILE *wfp, long nrecs, short *wavbuf)
Output waveform from buffer
isam(WVFILE *wfp, int *eof)
Input one sample
inwav(WVFILE *wfp, long nrecs, short *wavbuf)
Input waveform from file
setwnr(WVFILE *wfp, float wleng, int type)
Random I/O windowing routines
windoc(WVFILE *wfp, float *data, float time)
Random I/O windowing routines
windor(WVFILE *wfp, float *data, float time)
Random I/O windowing routines
freewnr()
Random I/O windowing routines
dac(u_short isr, long nsam, short *buf)
Play buffer of raw data through specific audio hardware
wavpos(WVFILE *wfp, long record)
Postion the I/O pointer within the waveform

Query Functions

lenwav(WVFILE *w)
Return the length of the waveform
currecd(WVFILE *w)
Current location of the wavefile pointer
numsegs(WVFILE *w)
Report the number of segments defined in the waveform
seginfo(WVFILE *w)
Return the end-point values for a given segment
isseg(WVFILE *w)
Determine whether waveform is part of a larger file
locseg(WVFILE *wfp,char *segnam,long *begbyt,long *endbyt)
Locate a segment in the given wave file
isallchan(WVFILE *w)
Return whether I/O is set to read/write all channels
numchan(WVFILE *w)
Return number of channels in the waveform
whichchan(WVFILE *w)
Return the active channel number
iwvbps(WVFILE *w)
Return the bits/sample stored in the waveform file
iwvintbps(WVFILE *w)
Return the bits/sample stored internally for the waveform
iwvtyp(WVFILE *w)
Return the file storage format of the waveform
iwvinttyp(WVFILE *w)
Return the internal storage format of the waveform
wvbias(WVFILE *w)
Return the bias of the data in the wavefile
wvscale(WVFILE *w)
Return the scale of the data in the wavefile
iwvlvl(WVFILE *w)
Return the reference level of the wavefile
iwvsrt(WVFILE *w)
Return the sample rate of the current waveform
islenchgd(WVFILE *w)
Determine whether waveform file has changed in length
isprotected(WVFILE *w)
Determine whether waveform file is write-protected
iswavchgd(WVFILE *w)
Determine whether waveform has been changed

Labeling Functions

Notes
Notes on segment labels and segment tables
addseg(WVFILE *wfp, char *segnam, long begbyt, long endby)
Add segment definition to waveform
addsega(WVFILE *wfp, char *segnam, long begbyt, long endby)
Add segment definition to waveform
delseg(WVFILE *wfp, char *segnam)
Delete segment definition
replseg(WVFILE *wfp,char *segnam, long begbyt, long endbyt)
Replace endpoints of a segment definition
SEGETBL *wavcpyest(WVFILE *wfp, SEGETBL *fm_etbl)
WAVeform CoPY Extended Segment Table
wavmrgest(WVFILE *wfp, SEGETBL *segetbl, long offset)
WAVeform MeRGe Extended Segment Table
SEGETBL *wavgest(WVFILE *wfp)
Read (get) extended segment table
wavgst(WVFILE *wfp, SEGTABLE *table)
Read (get) segment table
wavpest(WVFILE *wfp, SEGETBL *segetbl)
Write (put) extended segment table
wavpst(WVFILE *wfp, SEGTABLE *table)
Write (put) segment table

Data Manipulation & Conversion Functions

allchan(WVFILE *w)
Determine the active channel(s) for I/O
wavchan(WVFILE *wfp, short channel)
Determine the active channel(s) for I/O
chgnchan(WVFILE *wfp, int nchan)
Change total number of channels in an open waveform
chg_active_fmt(WVFILE *wfp,short new_fmt,short new_smplbits)
Change format & bits/sample of active waveform
wfpfrmt(WVFILE *w, int x)
Change format & bits/sample of active waveform
chg_def_fmt(short new_fmt, short new_smplbits)
Change default internal data format & bits/sample
wavfrm(int format)
Change default internal data format & bits/sample

File Maintenence Functions

defwdb(WDB x)
Set WDB structure defaults
NPdefwdb(WDB x)
Set WDB structure defaults
Pdefwdb(WDB *x)
Set WDB structure defaults
hamming(int np, float *w)
Waveform windowing functions
hanning(int np, float *w)
Waveform windowing functions
wav_error(int condition, char *prog, char *message)
Print an error message
free_segetbl(SEGETBL **segetbl)
Deallocate a SEGETBL structure
freeptr(void **ptr)
Deallocate pointer and set it to NULL

Data Structures

WDB
A data structure for describing waveform properties
SEGTBL
A data structure containing an array of up to 48 SEGMENT structures.
SEGETBL
A data structure containing an arbitrary number of SEGMENT structures.
SEGMENT
A data structure containing the name and the endpoints of a single segment of a waveform.