#include <wav_reader.h>
Public Methods | |
| CWAVReader () | |
| Standard constructor doing nothing. | |
| CWAVReader (const char *pszFilename) | |
| Constructor for opening a file during construction. | |
| CWAVReader (const std::string &sFilename) | |
| Constructor for opening a file during construction. | |
| ~CWAVReader () | |
| Standard destructor. | |
| void | OpenFile (const std::string &sFilename) |
| Opens a WAV-file. | |
| void | OpenFile (const char *pszFilename) |
| Opens a WAV-file. | |
| void | CloseFile () |
| Closes the WAV-file if it is open. | |
| void | GetSamplesAs8Bit (UINT32 nCount, UINT16 nChannel, UINT8 *pnBuffer, UINT32 nStart=(UINT32)-1) |
| Stores the specified number of samples into a buffer as 8 bit samples. | |
| void | GetSamplesAs16Bit (UINT32 nCount, UINT16 nChannel, INT16 *pnBuffer, UINT32 nStart=(UINT32)-1) |
| Stores the specified number of samples into a buffer as 16 bit samples. | |
| void | GetSamplesAs24Bit (UINT32 nCount, UINT16 nChannel, INT32 *pnBuffer, UINT32 nStart=(UINT32)-1) |
| Stores the specified number of samples into a buffer as 24 bit samples. | |
| void | GetSamplesAs32Bit (UINT32 nCount, UINT16 nChannel, INT32 *pnBuffer, UINT32 nStart=(UINT32)-1) |
| Stores the specified number of samples into a buffer as 8 bit samples. | |
| void | SetChannelPos (UINT16 nChannel, UINT32 nNewPos) |
| Sets the position in the specified channel. | |
| UINT32 | GetChannelPos (UINT16 nChannel) |
| Returns the position in the specified channel. | |
| UINT32 | GetSampleRate () const |
| Returns the sample rate of the WAV-file. | |
| UINT16 | GetChannelCount () const |
| Returns the number of channels contained in the WAV-file. | |
| UINT16 | GetBitsPerSample () const |
| Returns the number of bits per sample. | |
| UINT32 | GetSampleCount () const |
| Returns the number of samples per channel contained in the WAV-file. | |
| UINT32 | TimeToSample (double dSec) const |
| Returns the sample number of the specified time. | |
| double | SampleToTime (UINT32 nSample) const |
| Returns the time of the specified sample number. | |
You can use this class to read 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 supply information on the WAV-file and to store the PCM data of any channel into a buffer in resolution of 8, 16, 24 or 32 bit per sample. The class will perform the conversion if necessary.
If there occurs an error during any function the class will throw an exception of type CWAVReaderException.
Definition at line 78 of file wav_reader.h.
|
|
Returns the number of bits per sample.
Definition at line 434 of file wav_reader.cpp. References ac3::UINT16. |
|
|
Returns the number of channels contained in the WAV-file.
Definition at line 424 of file wav_reader.cpp. References ac3::UINT16. |
|
|
Returns the position in the specified channel.
Definition at line 402 of file wav_reader.cpp. References ac3::UINT16, and ac3::UINT32. |
|
|
Returns the number of samples per channel contained in the WAV-file.
Definition at line 445 of file wav_reader.cpp. References ac3::UINT32. |
|
|
Returns the sample rate of the WAV-file.
Definition at line 414 of file wav_reader.cpp. References ac3::UINT32. |
|
||||||||||||||||||||
|
Stores the specified number of samples into a buffer as 16 bit samples.
The samples are converted to 16 bit if necessary. 16 bit samples are signed. "Silent" samples (samples with volume 0) have value 0. Definition at line 208 of file wav_reader.cpp. References ac3::INT16, ac3::UINT16, and ac3::UINT32. |
|
||||||||||||||||||||
|
Stores the specified number of samples into a buffer as 24 bit samples.
The samples are converted to 24 bit if necessary. 24 bit samples are signed. "Silent" samples (samples with volume 0) have value 0. Note that 32 bit signed integers are used as buffer, but only the 24 least significant bits are used so the range is from -0x800000 to 0x7FFFFF. Definition at line 273 of file wav_reader.cpp. References ac3::INT32, ac3::UINT16, and ac3::UINT32. |
|
||||||||||||||||||||
|
Stores the specified number of samples into a buffer as 8 bit samples.
The samples are converted to 8 bit if necessary. 32 bit samples are signed. "Silent" samples (samples with volume 0) have value 0. Definition at line 336 of file wav_reader.cpp. References ac3::INT32, ac3::UINT16, and ac3::UINT32. |
|
||||||||||||||||||||
|
Stores the specified number of samples into a buffer as 8 bit samples.
The samples are converted to 8 bit if necessary. 8 bit samples are unsigned. Note that "silent" samples (samples with volume 0) have the value 0x80. Therefore 8 bit samples differs from 16, 24 and 32 bit samples. Definition at line 145 of file wav_reader.cpp. References ac3::UINT16, ac3::UINT32, and ac3::UINT8. |
|
|
Opens a WAV-file.
Definition at line 109 of file wav_reader.cpp. References CloseFile(). |
|
|
Opens a WAV-file.
Definition at line 98 of file wav_reader.cpp. |
|
|
Returns the time of the specified sample number.
Definition at line 471 of file wav_reader.cpp. References ac3::UINT32. |
|
||||||||||||
|
Sets the position in the specified channel.
Definition at line 385 of file wav_reader.cpp. References ac3::UINT16, and ac3::UINT32. |
|
|
Returns the sample number of the specified time.
Definition at line 460 of file wav_reader.cpp. References ac3::UINT32. |
1.2.18