This class reads and hold wave file header information. More...
#include <wave-reader.h>
Public Member Functions | |
WaveInfo () | |
bool | IsStreamed () const |
Is stream size unknown? Duration and SampleCount not valid if true. More... | |
BaseFloat | SampFreq () const |
Sample frequency, Hz. More... | |
uint32 | SampleCount () const |
Number of samples in stream. Invalid if IsStreamed() is true. More... | |
BaseFloat | Duration () const |
Approximate duration, seconds. Invalid if IsStreamed() is true. More... | |
int32 | NumChannels () const |
Number of channels, 1 to 16. More... | |
size_t | BlockAlign () const |
Bytes per sample. More... | |
size_t | DataBytes () const |
Wave data bytes. Invalid if IsStreamed() is true. More... | |
bool | ReverseBytes () const |
Is data file byte order different from machine byte order? More... | |
void | Read (std::istream &is) |
'is' should be opened in binary mode. More... | |
Private Attributes | |
BaseFloat | samp_freq_ |
int32 | samp_count_ |
uint8 | num_channels_ |
bool | reverse_bytes_ |
This class reads and hold wave file header information.
Definition at line 65 of file wave-reader.h.
|
inline |
|
inline |
Bytes per sample.
Definition at line 86 of file wave-reader.h.
References WaveInfo::num_channels_.
Referenced by WaveInfo::DataBytes(), and WaveData::Read().
|
inline |
Wave data bytes. Invalid if IsStreamed() is true.
Definition at line 89 of file wave-reader.h.
References WaveInfo::BlockAlign(), and WaveInfo::samp_count_.
Referenced by WaveData::Read().
|
inline |
Approximate duration, seconds. Invalid if IsStreamed() is true.
Definition at line 80 of file wave-reader.h.
References WaveInfo::samp_count_, and WaveInfo::samp_freq_.
Referenced by main().
|
inline |
Is stream size unknown? Duration and SampleCount not valid if true.
Definition at line 71 of file wave-reader.h.
References WaveInfo::samp_count_.
Referenced by main(), and WaveData::Read().
|
inline |
Number of channels, 1 to 16.
Definition at line 83 of file wave-reader.h.
References WaveInfo::num_channels_.
Referenced by WaveData::Read().
void Read | ( | std::istream & | is | ) |
'is' should be opened in binary mode.
Read() will throw on error. On success 'is' will be positioned at the beginning of wave data.
Definition at line 114 of file wave-reader.cc.
References WaveHeaderReadGofer::Expect4ByteTag(), rnnlm::i, KALDI_ASSERT, KALDI_ERR, KALDI_VLOG, KALDI_WARN, WaveHeaderReadGofer::Read4ByteTag(), WaveHeaderReadGofer::ReadUint16(), WaveHeaderReadGofer::ReadUint32(), WaveHeaderReadGofer::swap, and WaveHeaderReadGofer::tag.
Referenced by WaveData::Read(), WaveInfo::ReverseBytes(), and WaveData::WaveData().
|
inline |
Is data file byte order different from machine byte order?
Definition at line 92 of file wave-reader.h.
References WaveInfo::Read(), and WaveInfo::reverse_bytes_.
Referenced by WaveData::Read().
|
inline |
Sample frequency, Hz.
Definition at line 74 of file wave-reader.h.
References WaveInfo::samp_freq_.
Referenced by WaveData::Read().
|
inline |
Number of samples in stream. Invalid if IsStreamed() is true.
Definition at line 77 of file wave-reader.h.
References WaveInfo::samp_count_.
|
private |
Definition at line 101 of file wave-reader.h.
Referenced by WaveInfo::BlockAlign(), and WaveInfo::NumChannels().
|
private |
Definition at line 102 of file wave-reader.h.
Referenced by WaveInfo::ReverseBytes().
|
private |
Definition at line 100 of file wave-reader.h.
Referenced by WaveInfo::DataBytes(), WaveInfo::Duration(), WaveInfo::IsStreamed(), and WaveInfo::SampleCount().
|
private |
Definition at line 99 of file wave-reader.h.
Referenced by WaveData::Clear(), WaveData::CopyFrom(), WaveInfo::Duration(), WaveData::Duration(), WaveInfo::SampFreq(), WaveData::SampFreq(), and WaveData::Swap().