Main Page   Namespace List   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

ac3::CWAVWriter Class Reference

A class for writing WAV-files. More...

#include <wav_writer.h>

List of all members.

Public Methods

 CWAVWriter ()
 Standard constructor doing nothing.

 CWAVWriter (const char *pszFilename, UINT32 nSampleRate, UINT16 nChannelNum, UINT16 nBitResolution)
 Contructor for opening a WAV-file during construction.

 CWAVWriter (const std::string &sFilename, UINT32 nSampleRate, UINT16 nChannelNum, UINT16 nBitResolution)
 Contructor for opening a WAV-file during construction.

 ~CWAVWriter ()
 Standard destructor.

void OpenFile (const char *pszFilename, UINT32 nSampleRate, UINT16 nChannelNum, UINT16 nBitResolution)
 Opens a WAV-file.

void OpenFile (const std::string &sFilename, UINT32 nSampleRate, UINT16 nChannelNum, UINT16 nBitResolution)
 Opens a WAV-file.

void CloseFile ()
 Closes the the opened WAV-file.

void Write8BitSamples (UINT8 **ppSource, UINT32 nCount)
 Writes 8 bit samples to the WAV-file.

void Write16BitSamples (INT16 **ppSource, UINT32 nCount)
 Writes 16 bit samples to the WAV-file.

void Write24BitSamples (INT32 **ppSource, UINT32 nCount)
 Writes 24 bit samples to the WAV-file.

void Write32BitSamples (INT32 **ppSource, UINT32 nCount)
 Writes 32 bit samples to the WAV-file.


Detailed Description

A class for writing WAV-files.

Todo:
Optimize for speed.

You can use this class to write WAV-files. Currently PCM WAV-files with 8, 16, 24 or 32 bits per sample, any channel number (at least one) and any sample rate (greater 0) are supported. The class is able to write the samples in the passed buffers (one buffer for each channel) to the WAV-file. It will perform the bit rate conversion if necessary.

If there occurs an error during any function the class will throw an exception of type CWAVWriterException.

Definition at line 74 of file wav_writer.h.


Member Function Documentation

void ac3::CWAVWriter::CloseFile  
 

Closes the the opened WAV-file.

Use this function if you have finished writing data to the WAV-file.

Definition at line 140 of file wav_writer.cpp.

Referenced by OpenFile().

void ac3::CWAVWriter::OpenFile const std::string &    sFilename,
UINT32    nSampleRate,
UINT16    nChannelNum,
UINT16    nBitResolution
 

Opens a WAV-file.

Parameters:
sFilename  Name of file to open.
nSampleRate  Sample rate the WAV-file is to have.
nChannelNum  Number of channels the WAV-file is to have.
nBitResolution  Bit per sample the WAV-file is to have (8, 16, 24 or 32)
When calling this function a new WAV-file with the passed properties is created. After calling this function you can repeatly use one of the WritexxBitSamples functions to write data to the file.

Definition at line 92 of file wav_writer.cpp.

References OpenFile(), ac3::UINT16, and ac3::UINT32.

void ac3::CWAVWriter::OpenFile const char *    pszFilename,
UINT32    nSampleRate,
UINT16    nChannelNum,
UINT16    nBitResolution
 

Opens a WAV-file.

Parameters:
sFilename  Name of file to open.
nSampleRate  Sample rate the WAV-file is to have.
nChannelNum  Number of channels the WAV-file is to have.
nBitResolution  Bit per sample the WAV-file is to have (8, 16, 24 or 32)
When calling this function a new WAV-file with the passed properties is created. After calling this function you can repeatly use one of the WritexxBitSamples functions to write data to the file.

Definition at line 109 of file wav_writer.cpp.

References CloseFile(), ac3::UINT16, and ac3::UINT32.

Referenced by OpenFile().

void ac3::CWAVWriter::Write16BitSamples INT16 **    ppSource,
UINT32    nCount
 

Writes 16 bit samples to the WAV-file.

Parameters:
ppSource  Array of buffers containing the samples.
nCount  Number of samples in each buffer.
Use this function to write 16 bit samples to the WAV-file. If the bit rate of the WAV-file is different from 16 bit the conversion is automatically performed.

The function expects an array of buffers (one buffer for each channel) containing the samples to write. Each sample is a signed 16 bit integer. "Silent" samples (-inf db) have value 0.

Definition at line 239 of file wav_writer.cpp.

References ac3::INT16, ac3::UINT16, and ac3::UINT32.

void ac3::CWAVWriter::Write24BitSamples INT32 **    ppSource,
UINT32    nCount
 

Writes 24 bit samples to the WAV-file.

Parameters:
ppSource  Array of buffers containing the samples.
nCount  Number of samples in each buffer.
Use this function to write 24 bit samples to the WAV-file. If the bit rate of the WAV-file is different from 246 bit the conversion is automatically performed.

The function expects an array of buffers (one buffer for each channel) containing the samples to write. Each sample is a signed 32 bit integer, but only the 24 least significant bis are written. "Silent" samples (-inf db) have value 0.

Definition at line 306 of file wav_writer.cpp.

References ac3::INT32, ac3::UINT16, and ac3::UINT32.

void ac3::CWAVWriter::Write32BitSamples INT32 **    ppSource,
UINT32    nCount
 

Writes 32 bit samples to the WAV-file.

Parameters:
ppSource  Array of buffers containing the samples.
nCount  Number of samples in each buffer.
Use this function to write 32 bit samples to the WAV-file. If the bit rate of the WAV-file is different from 32 bit the conversion is automatically performed.

The function expects an array of buffers (one buffer for each channel) containing the samples to write. Each sample is a signed 32 bit integer. "Silent" samples (-inf db) have value 0.

Definition at line 372 of file wav_writer.cpp.

References ac3::INT32, ac3::UINT16, and ac3::UINT32.

void ac3::CWAVWriter::Write8BitSamples UINT8 **    ppSource,
UINT32    nCount
 

Writes 8 bit samples to the WAV-file.

Parameters:
ppSource  Array of buffers containing the samples.
nCount  Number of samples in each buffer.
Use this function to write 8 bit samples to the WAV-file. If the bit rate of the WAV-file is different from 8 bit the conversion is automatically performed.

The function expects an array of buffers (one buffer for each channel) containing the samples to write. Each sample is an unsigned 8 bit integer. "Silent" samples (-inf db) have value 0x80.

Definition at line 173 of file wav_writer.cpp.

References ac3::UINT16, ac3::UINT32, and ac3::UINT8.


The documentation for this class was generated from the following files:
Generated on Sat Sep 25 14:06:55 2004 for ac3 by doxygen1.2.18