30 typedef int32_t int32;
31 typedef int16_t int16;
35 #define SWAP_32(in) ( \
36 (((int32) in) << 24) | \
37 ((((int32) in) & 0x0000FF00L) << 8) | \
38 ((((int32) in) & 0x00FF0000L) >> 8) | \
41 #define SWAP_16(in) ( \
42 (((int16) in) << 8) | \
54 struct RIFF_CHUNK_HEADER
64 friend std::ostream &
operator<<(std::ostream & os,
const RIFF_CHUNK_HEADER & s);
66 friend std::istream & operator>>(std::istream & is, RIFF_CHUNK_HEADER & s);
69 std::ostream &
operator<<(std::ostream & os,
const RIFF_CHUNK_HEADER & s){
70 os <<
"RiffChunkId= " << s.chunk_id <<
" | ";
71 os <<
"RiffChunkSize= " << s.chunk_size <<
" | ";
72 os <<
"RiffFormat= " << s.format <<
'\n';
76 std::istream & operator>>(std::istream & is, RIFF_CHUNK_HEADER & s){
78 is >> buf >> s.chunk_id >> buf;
79 is >> buf >> s.chunk_size >> buf;
80 is >> buf >> s.format;
90 struct FORMAT_CHUNK_HEADER
107 int16 bits_per_sample;
109 friend std::ostream &
operator<<(std::ostream & os,
const FORMAT_CHUNK_HEADER & s);
111 friend std::istream & operator>>(std::istream & is, FORMAT_CHUNK_HEADER & s);
114 std::ostream &
operator<<(std::ostream & os,
const FORMAT_CHUNK_HEADER & s){
115 os <<
"FmtChunkId= " << s.chunk_id <<
" | ";
116 os <<
"FmtChunkSize= " << s.chunk_size <<
" | ";
117 os <<
"FmtFormat= " << s.format <<
" | ";
118 os <<
"FmtNumChannels= " << s.num_channels <<
" | ";
119 os <<
"FmtSampleRate= " << s.sample_rate <<
" | ";
120 os <<
"FmtByteRate= " << s.byte_rate <<
" | ";
121 os <<
"FmtAlign= " << s.align <<
" | ";
122 os <<
"FmtBitsPerSample= " << s.bits_per_sample <<
'\n';
126 std::istream & operator>>(std::istream & is, FORMAT_CHUNK_HEADER & s){
128 is >> buf >> s.chunk_id >> buf;
129 is >> buf >> s.chunk_size >> buf;
130 is >> buf >> s.format >> buf;
131 is >> buf >> s.num_channels >> buf;
132 is >> buf >> s.sample_rate >> buf;
133 is >> buf >> s.byte_rate >> buf;
134 is >> buf >> s.align >> buf;
135 is >> buf >> s.bits_per_sample;
145 struct DATA_CHUNK_HEADER
152 friend std::ostream &
operator<<(std::ostream & os,
const DATA_CHUNK_HEADER & s);
154 friend std::istream & operator>>(std::istream & is, DATA_CHUNK_HEADER & s);
157 std::ostream &
operator<<(std::ostream & os,
const DATA_CHUNK_HEADER & s){
158 os <<
"DataChunkId= " << s.chunk_id <<
" | ";
159 os <<
"DataChunkSize= " << s.chunk_size <<
'\n';
163 std::istream & operator>>(std::istream & is, DATA_CHUNK_HEADER & s){
165 is >> buf >> s.chunk_id >> buf;
166 is >> buf >> s.chunk_size;
181 RIFF_CHUNK_HEADER riff_header;
182 FORMAT_CHUNK_HEADER format_header;
183 DATA_CHUNK_HEADER data_header;
185 friend std::ostream &
operator<<(std::ostream & os,
const WAVE_HEADER & s);
187 friend std::istream & operator>>(std::istream & is, WAVE_HEADER & s);
190 std::ostream &
operator<<(std::ostream & os,
const WAVE_HEADER & s){
191 os << s.riff_header << s.format_header << s.data_header;
195 std::istream & operator>>(std::istream & is, WAVE_HEADER & s){
197 is >> s.format_header;
Provides SLIP error messages.
std::ostream & operator<<(std::ostream &out, const Array< T > &a)