Wav audio support
[Public API functions]

Collaboration diagram for Wav audio support:

Classes

struct  VPB_VLOG
 Additional data that may be included in a wav file. More...

Defines

#define VPB_VLOG_CHUNK   0x4000
 May be added to the Wave file mode to include a VPB_VLOG chunk when recording.

Wave file output



void WINAPI vpb_wave_open_write (WFILE **wav, const std::string &filename, int mode)
 Open a RIFF wave file for writing.
int WINAPI vpb_wave_write (WFILE *wav, const char *buf, long n)
 Write a block of audio samples to a RIFF wave file.
void WINAPI vpb_wave_close_write (WFILE *wav)
 Close a RIFF wave file after writing.

Wave file input



void WINAPI vpb_wave_open_read (WFILE **wav, const std::string &filename)
 Open a RIFF wave file for reading.
int WINAPI vpb_wave_read (WFILE *wav, char *buf, unsigned long n)
 Read a block of audio samples from a RIFF wave file.
void WINAPI vpb_wave_close_read (WFILE *wav)
 Close a RIFF wave file after reading.

Miscellaneous wave file operations



size_t vpb_wave_get_size (WFILE *wav)
 Return the size of wave file data in bytes.
AudioCompress WINAPI vpb_wave_get_mode (WFILE *wav)
 Return the compression mode of wav.
void WINAPI vpb_wave_set_sample_rate (WFILE *wav, unsigned short rate)
 Change the sample rate of a wav file.
int WINAPI vpb_wave_seek (WFILE *wav, long offset)
 Move the wave pointer to a specified location in the samples.

Wave file VLOG data



int WINAPI vpb_wave_set_vlog (WFILE *wav, VPB_VLOG *buf)
 Set VPB_VLOG information for inclusion in a wave file.
int WINAPI vpb_wave_get_vlog (WFILE *wav, VPB_VLOG *buf)
 Get VPB_VLOG information from a wave file.

Detailed Description

Todo:
Add appropriate bits of the sgml documentation here.

Function Documentation

void WINAPI vpb_wave_close_read ( WFILE wav  ) 

Close a RIFF wave file after reading.

Parameters:
wav The pointer returned by a call to vpb_wave_open_read().
void WINAPI vpb_wave_close_write ( WFILE wav  ) 

Close a RIFF wave file after writing.

Parameters:
wav The pointer returned by a call to vpb_wave_open_write().
int WINAPI vpb_wave_get_vlog ( WFILE wav,
VPB_VLOG buf 
)

Get VPB_VLOG information from a wave file.

Parameters:
wav The pointer returned by a call to vpb_wave_open_*
buf A pointer to storage for the VPB_VLOG data.
Returns:
VPB_OK if successful, else a non-zero error code.

References VPB_VLOG::channel, VPB_VLOG::cidn, VPB_VLOG::cidt, VPB_VLOG::endtime, VPB_VLOG::filename, VPB_VLOG::inout, VPB_VLOG::statime, and VPB_VLOG::term.

void WINAPI vpb_wave_open_read ( WFILE **  wav,
const std::string &  filename 
)

Open a RIFF wave file for reading.

Parameters:
wav Pointer to a pointer where encoding state may be stored. This pointer should be passed to other vpb_wave_* functions that will operate on the opened file.
filename The full path to the file to read.
Exceptions:
various exceptions may be thrown in the event of an error.
void WINAPI vpb_wave_open_write ( WFILE **  wav,
const std::string &  filename,
int  mode 
)

Open a RIFF wave file for writing.

Parameters:
wav Pointer to a pointer where encoding state may be stored. This pointer should be passed to other vpb_wave_* functions that will operate on the opened file.
filename The full path to the file to write.
mode The AudioCompress mode to use for the file. It may optionally be or'd with VPB_VLOG_CHUNK to record additional data in the wav file headers.
Exceptions:
various exceptions may be thrown in the event of an error.

References VPB_ALAW, VPB_LINEAR, VPB_MULAW, and VPB_VLOG_CHUNK.

int WINAPI vpb_wave_read ( WFILE wav,
char *  buf,
unsigned long  n 
)

Read a block of audio samples from a RIFF wave file.

Parameters:
wav The pointer returned by a call to vpb_wave_open_read().
buf The buffer to store samples in.
n The size of the buffer in bytes.
Returns:
The number of bytes actually stored in buf.
int WINAPI vpb_wave_seek ( WFILE wav,
long  offset 
)

Move the wave pointer to a specified location in the samples.

Parameters:
wav The pointer returned by a call to vpb_wave_open_*.
offset The offset from the start of the audio samples.
Returns:
VPB_OK if the operation succeeded. Otherwise -1 will be returned and errno will be set to indicate the error.
void WINAPI vpb_wave_set_sample_rate ( WFILE wav,
unsigned short  rate 
)

Change the sample rate of a wav file.

Parameters:
wav The pointer returned by a call to vpb_wave_open_*.
rate The new sampling rate to use.
int WINAPI vpb_wave_set_vlog ( WFILE wav,
VPB_VLOG buf 
)

Set VPB_VLOG information for inclusion in a wave file.

Parameters:
wav The pointer returned by a call to vpb_wave_open_write().
buf The VPB_VLOG data to include.
Returns:
VPB_OK if successful, else a non-zero error code.

References VPB_VLOG::channel, VPB_VLOG::cidn, VPB_VLOG::cidt, VPB_VLOG::endtime, VPB_VLOG::filename, VPB_VLOG::inout, VPB_VLOG::statime, and VPB_VLOG::term.

int WINAPI vpb_wave_write ( WFILE wav,
const char *  buf,
long  n 
)

Write a block of audio samples to a RIFF wave file.

Parameters:
wav The pointer returned by a call to vpb_wave_open_write().
buf The buffer of samples to write.
n The number of bytes to write.
Returns:
The number of bytes actually written.

Generated by  doxygen 1.6.2