From 9cb2636ee36e4042283da1d6c7bd1ad6bd6af370 Mon Sep 17 00:00:00 2001 From: pschatzmann Date: Thu, 3 Oct 2024 10:51:40 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20doxygen=20from=20@=20pschatzma?= =?UTF-8?q?nn/arduino-audio-tools@a1ecd881e2cfbf430289c19e4723badbf8d409dd?= =?UTF-8?q?=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _codec_helix_8h_source.html | 2 +- _codec_w_a_v_8h_source.html | 973 +++++++++--------- _jupyter_audio_8h_source.html | 4 +- ...audio__tools_1_1_w_a_v_header-members.html | 10 +- classaudio__tools_1_1_w_a_v_header.html | 14 +- functions.html | 5 +- functions_func.html | 13 +- functions_func_g.html | 5 +- functions_g.html | 5 +- search/all_1.js | 32 +- search/all_10.js | 176 ++-- search/all_11.js | 16 +- search/all_12.js | 166 +-- search/all_13.js | 616 +++++------ search/all_14.js | 126 +-- search/all_15.js | 36 +- search/all_16.js | 152 +-- search/all_17.js | 68 +- search/all_18.js | 2 +- search/all_19.js | 4 +- search/all_1a.js | 50 +- search/all_7.js | 63 +- search/all_8.js | 52 +- search/all_9.js | 214 ++-- search/all_a.js | 6 +- search/all_b.js | 8 +- search/all_c.js | 76 +- search/all_d.js | 168 +-- search/all_e.js | 50 +- search/all_f.js | 48 +- search/classes_0.js | 216 ++-- search/classes_1.js | 44 +- search/classes_10.js | 16 +- search/classes_11.js | 64 +- search/classes_12.js | 134 +-- search/classes_13.js | 58 +- search/classes_14.js | 18 +- search/classes_15.js | 120 +-- search/classes_16.js | 26 +- search/classes_2.js | 92 +- search/classes_3.js | 50 +- search/classes_4.js | 30 +- search/classes_5.js | 86 +- search/classes_6.js | 48 +- search/classes_7.js | 32 +- search/classes_8.js | 60 +- search/classes_9.js | 6 +- search/classes_a.js | 2 +- search/classes_b.js | 42 +- search/classes_c.js | 74 +- search/classes_d.js | 30 +- search/classes_e.js | 28 +- search/classes_f.js | 54 +- search/enums_0.js | 6 +- search/enums_1.js | 2 +- search/enums_2.js | 2 +- search/enums_3.js | 2 +- search/enums_4.js | 2 +- search/enums_5.js | 8 +- search/enums_6.js | 8 +- search/enums_7.js | 2 +- search/enums_8.js | 2 +- search/enums_9.js | 2 +- search/files_0.js | 10 +- search/files_1.js | 16 +- search/files_2.js | 2 +- search/files_3.js | 2 +- search/functions_0.js | 2 +- search/functions_1.js | 144 +-- search/functions_10.js | 2 +- search/functions_11.js | 90 +- search/functions_12.js | 478 ++++----- search/functions_13.js | 52 +- search/functions_14.js | 14 +- search/functions_15.js | 22 +- search/functions_16.js | 44 +- search/functions_17.js | 50 +- search/functions_2.js | 26 +- search/functions_3.js | 102 +- search/functions_4.js | 64 +- search/functions_5.js | 32 +- search/functions_6.js | 66 +- search/functions_7.js | 81 +- search/functions_8.js | 22 +- search/functions_9.js | 126 +-- search/functions_a.js | 4 +- search/functions_b.js | 38 +- search/functions_c.js | 76 +- search/functions_d.js | 18 +- search/functions_e.js | 28 +- search/functions_f.js | 110 +- search/groups_0.js | 2 +- search/groups_1.js | 4 +- search/groups_2.js | 14 +- search/groups_3.js | 4 +- search/groups_4.js | 10 +- search/groups_5.js | 6 +- search/groups_6.js | 2 +- search/groups_7.js | 2 +- search/groups_8.js | 6 +- search/groups_9.js | 2 +- search/groups_a.js | 6 +- search/groups_b.js | 4 +- search/groups_c.js | 4 +- search/groups_d.js | 2 +- search/groups_e.js | 6 +- search/groups_f.js | 4 +- search/namespaces_0.js | 4 +- search/namespaces_1.js | 2 +- search/namespaces_2.js | 2 +- search/pages_0.js | 2 +- search/related_0.js | 2 +- search/typedefs_0.js | 2 +- search/typedefs_1.js | 2 +- search/typedefs_2.js | 2 +- search/variables_0.js | 6 +- search/variables_1.js | 12 +- search/variables_10.js | 6 +- search/variables_11.js | 2 +- search/variables_12.js | 4 +- search/variables_2.js | 14 +- search/variables_3.js | 14 +- search/variables_4.js | 4 +- search/variables_5.js | 18 +- search/variables_6.js | 28 +- search/variables_7.js | 2 +- search/variables_8.js | 18 +- search/variables_9.js | 2 +- search/variables_a.js | 8 +- search/variables_b.js | 12 +- search/variables_c.js | 18 +- search/variables_d.js | 12 +- search/variables_e.js | 8 +- search/variables_f.js | 10 +- 134 files changed, 3291 insertions(+), 3250 deletions(-) diff --git a/_codec_helix_8h_source.html b/_codec_helix_8h_source.html index 48830e6d8..a5b1d69ed 100644 --- a/_codec_helix_8h_source.html +++ b/_codec_helix_8h_source.html @@ -179,7 +179,7 @@
void resetDecoder()
Deletes the decoder.
Definition: CodecHelix.h:101
MP3 Decoder using libhelix: https://github.com/pschatzmann/arduino-libhelix This is basically just a ...
Definition: CodecMP3Helix.h:17
Definition: NoArduino.h:58
-
A simple WAVDecoder: We parse the header data on the first record to determine the format....
Definition: CodecWAV.h:245
+
A simple WAVDecoder: We parse the header data on the first record to determine the format....
Definition: CodecWAV.h:263
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition: AnalogAudioArduino.h:12
Basic Audio information which drives e.g. I2S.
Definition: AudioTypes.h:50
diff --git a/_codec_w_a_v_8h_source.html b/_codec_w_a_v_8h_source.html index 9ebee6d9f..c9a5f3ea4 100644 --- a/_codec_w_a_v_8h_source.html +++ b/_codec_w_a_v_8h_source.html @@ -76,7 +76,7 @@
5 #include "AudioBasic/Str.h"
6 
7 #define READ_BUFFER_SIZE 512
-
8 #define MAX_WAV_HEADER_LEN 50
+
8 #define MAX_WAV_HEADER_LEN 200
9 
10 namespace audio_tools {
11 
@@ -137,477 +137,496 @@
81  }
82 
84  bool isDataComplete() {
-
85  int pos = getDataPos();
-
86  return pos > 0 && buffer.available() >= pos;;
+
85  int pos = getDataPos();
+
86  return pos > 0 && buffer.available() >= pos;
87  }
88 
-
89  int getDataPos() {
-
90  int pos = Str((char*)buffer.data(),MAX_WAV_HEADER_LEN, buffer.size()).indexOf("data");
-
91  return pos > 0 ? pos + 8 : 0;
+
90  size_t available(){
+
91  return buffer.available();
92  }
93 
-
95  WAVAudioInfo &audioInfo() { return headerInfo; }
-
96 
-
98  void setAudioInfo(WAVAudioInfo info){
-
99  headerInfo = info;
-
100  }
-
101 
-
103  int writeHeader(Print *out) {
-
104  writeRiffHeader(buffer);
-
105  writeFMT(buffer);
-
106  writeDataHeader(buffer);
-
107  int len = buffer.available();
-
108  out->write(buffer.data(), buffer.available());
-
109  return len;
-
110  }
-
111 
-
112  void clear() {
-
113  data_pos = 0;
-
114  memset(&headerInfo,0,sizeof(WAVAudioInfo));
-
115  buffer.setClearWithZero(true);
-
116  buffer.reset();
-
117  }
-
118 
-
119 
-
120  protected:
-
121  struct WAVAudioInfo headerInfo;
-
122  SingleBuffer<uint8_t> buffer{MAX_WAV_HEADER_LEN};
-
123  size_t data_pos = 0;
+
95  int getDataPos() {
+
96  int pos = Str((char*)buffer.data(),MAX_WAV_HEADER_LEN, buffer.available()).indexOf("data");
+
97  return pos > 0 ? pos + 8 : 0;
+
98  }
+
99 
+
101  WAVAudioInfo &audioInfo() { return headerInfo; }
+
102 
+
104  void setAudioInfo(WAVAudioInfo info){
+
105  headerInfo = info;
+
106  }
+
107 
+
109  int writeHeader(Print *out) {
+
110  writeRiffHeader(buffer);
+
111  writeFMT(buffer);
+
112  writeDataHeader(buffer);
+
113  int len = buffer.available();
+
114  out->write(buffer.data(), buffer.available());
+
115  return len;
+
116  }
+
117 
+
118  void clear() {
+
119  data_pos = 0;
+
120  memset(&headerInfo,0,sizeof(WAVAudioInfo));
+
121  buffer.setClearWithZero(true);
+
122  buffer.reset();
+
123  }
124 
-
125  bool setPos(const char*id){
-
126  int id_len = strlen(id);
-
127  int pos = indexOf(id);
-
128  if (pos < 0) return false;
-
129  data_pos = pos + id_len;
-
130  return true;
-
131  }
-
132 
-
133  int indexOf(const char* str){
-
134  return Str((char*)buffer.data(),MAX_WAV_HEADER_LEN, buffer.available()).indexOf(str);
+
125  void dumpHeader() {
+
126  char msg[buffer.available()+1] = {0};
+
127  for (int j = 0; j< buffer.available();j++){
+
128  char c = (char)buffer.data()[j];
+
129  if (!isalpha(c)){
+
130  c = '.';
+
131  }
+
132  msg[j] = c;
+
133  }
+
134  LOGI("Header: %s", msg);
135  }
136 
-
137  uint32_t read_tag() {
-
138  uint32_t tag = 0;
-
139  tag = (tag << 8) | getChar();
-
140  tag = (tag << 8) | getChar();
-
141  tag = (tag << 8) | getChar();
-
142  tag = (tag << 8) | getChar();
-
143  return tag;
-
144  }
-
145 
-
146  uint32_t getChar32() { return getChar(); }
-
147 
-
148  uint32_t read_int32() {
-
149  uint32_t value = 0;
-
150  value |= getChar32() << 0;
-
151  value |= getChar32() << 8;
-
152  value |= getChar32() << 16;
-
153  value |= getChar32() << 24;
-
154  return value;
-
155  }
-
156 
-
157  uint16_t read_int16() {
-
158  uint16_t value = 0;
-
159  value |= getChar() << 0;
-
160  value |= getChar() << 8;
-
161  return value;
+
137 
+
138  protected:
+
139  struct WAVAudioInfo headerInfo;
+
140  SingleBuffer<uint8_t> buffer{MAX_WAV_HEADER_LEN};
+
141  size_t data_pos = 0;
+
142 
+
143  bool setPos(const char*id){
+
144  int id_len = strlen(id);
+
145  int pos = indexOf(id);
+
146  if (pos < 0) return false;
+
147  data_pos = pos + id_len;
+
148  return true;
+
149  }
+
150 
+
151  int indexOf(const char* str){
+
152  return Str((char*)buffer.data(),MAX_WAV_HEADER_LEN, buffer.available()).indexOf(str);
+
153  }
+
154 
+
155  uint32_t read_tag() {
+
156  uint32_t tag = 0;
+
157  tag = (tag << 8) | getChar();
+
158  tag = (tag << 8) | getChar();
+
159  tag = (tag << 8) | getChar();
+
160  tag = (tag << 8) | getChar();
+
161  return tag;
162  }
163 
-
164  void skip(int n) {
-
165  int i;
-
166  for (i = 0; i < n; i++) getChar();
-
167  }
-
168 
-
169  int getChar() {
-
170  if (data_pos < buffer.size())
-
171  return buffer.data()[data_pos++];
-
172  else
-
173  return -1;
-
174  }
-
175 
-
176  void seek(long int offset, int origin) {
-
177  if (origin == SEEK_SET) {
-
178  data_pos = offset;
-
179  } else if (origin == SEEK_CUR) {
-
180  data_pos += offset;
-
181  }
-
182  }
-
183 
-
184  size_t tell() { return data_pos; }
-
185 
-
186  bool eof() { return data_pos >= buffer.size() - 1; }
-
187 
-
188  void logInfo() {
-
189  LOGI("WAVHeader sound_pos: %d", getDataPos());
-
190  LOGI("WAVHeader channels: %d ", headerInfo.channels);
-
191  LOGI("WAVHeader bits_per_sample: %d", headerInfo.bits_per_sample);
-
192  LOGI("WAVHeader sample_rate: %d ", (int) headerInfo.sample_rate);
-
193  LOGI("WAVHeader format: %d", (int)headerInfo.format);
-
194  }
-
195 
-
196  void writeRiffHeader(BaseBuffer<uint8_t> &buffer) {
-
197  buffer.writeArray((uint8_t *)"RIFF", 4);
-
198  write32(buffer, headerInfo.file_size - 8);
-
199  buffer.writeArray((uint8_t *)"WAVE", 4);
+
164  uint32_t getChar32() { return getChar(); }
+
165 
+
166  uint32_t read_int32() {
+
167  uint32_t value = 0;
+
168  value |= getChar32() << 0;
+
169  value |= getChar32() << 8;
+
170  value |= getChar32() << 16;
+
171  value |= getChar32() << 24;
+
172  return value;
+
173  }
+
174 
+
175  uint16_t read_int16() {
+
176  uint16_t value = 0;
+
177  value |= getChar() << 0;
+
178  value |= getChar() << 8;
+
179  return value;
+
180  }
+
181 
+
182  void skip(int n) {
+
183  int i;
+
184  for (i = 0; i < n; i++) getChar();
+
185  }
+
186 
+
187  int getChar() {
+
188  if (data_pos < buffer.size())
+
189  return buffer.data()[data_pos++];
+
190  else
+
191  return -1;
+
192  }
+
193 
+
194  void seek(long int offset, int origin) {
+
195  if (origin == SEEK_SET) {
+
196  data_pos = offset;
+
197  } else if (origin == SEEK_CUR) {
+
198  data_pos += offset;
+
199  }
200  }
201 
-
202  void writeFMT(BaseBuffer<uint8_t> &buffer) {
-
203  uint16_t fmt_len = 16;
-
204  buffer.writeArray((uint8_t *)"fmt ", 4);
-
205  write32(buffer, fmt_len);
-
206  write16(buffer, (uint16_t)headerInfo.format); // PCM
-
207  write16(buffer, headerInfo.channels);
-
208  write32(buffer, headerInfo.sample_rate);
-
209  write32(buffer, headerInfo.byte_rate);
-
210  write16(buffer, headerInfo.block_align); // frame size
-
211  write16(buffer, headerInfo.bits_per_sample);
+
202  size_t tell() { return data_pos; }
+
203 
+
204  bool eof() { return data_pos >= buffer.size() - 1; }
+
205 
+
206  void logInfo() {
+
207  LOGI("WAVHeader sound_pos: %d", getDataPos());
+
208  LOGI("WAVHeader channels: %d ", headerInfo.channels);
+
209  LOGI("WAVHeader bits_per_sample: %d", headerInfo.bits_per_sample);
+
210  LOGI("WAVHeader sample_rate: %d ", (int) headerInfo.sample_rate);
+
211  LOGI("WAVHeader format: %d", (int)headerInfo.format);
212  }
213 
-
214  void write32(BaseBuffer<uint8_t> &buffer, uint64_t value) {
-
215  buffer.writeArray((uint8_t *)&value, 4);
-
216  }
-
217 
-
218  void write16(BaseBuffer<uint8_t> &buffer, uint16_t value) {
-
219  buffer.writeArray((uint8_t *)&value, 2);
-
220  }
-
221 
-
222  void writeDataHeader(BaseBuffer<uint8_t> &buffer) {
-
223  buffer.writeArray((uint8_t *)"data", 4);
-
224  write32(buffer, headerInfo.file_size);
-
225  int offset = headerInfo.offset;
-
226  if (offset > 0) {
-
227  uint8_t empty[offset];
-
228  memset(empty, 0, offset);
-
229  buffer.writeArray(empty, offset); // resolve issue with wrong aligment
-
230  }
-
231  }
-
232 
-
233 };
-
234 
-
245 class WAVDecoder : public AudioDecoder {
-
246  public:
-
250  WAVDecoder() = default;
-
251 
-
256  WAVDecoder(AudioDecoderExt &dec, AudioFormat fmt) {
-
257  setDecoder(dec, fmt);
-
258  }
-
259 
-
261  void setDecoder(AudioDecoderExt &dec, AudioFormat fmt) {
-
262  TRACED();
-
263  decoder_format = fmt;
-
264  p_decoder = &dec;
-
265  }
-
266 
-
268  void setOutput(Print &out_stream) override { this->p_print = &out_stream; }
+
214  void writeRiffHeader(BaseBuffer<uint8_t> &buffer) {
+
215  buffer.writeArray((uint8_t *)"RIFF", 4);
+
216  write32(buffer, headerInfo.file_size - 8);
+
217  buffer.writeArray((uint8_t *)"WAVE", 4);
+
218  }
+
219 
+
220  void writeFMT(BaseBuffer<uint8_t> &buffer) {
+
221  uint16_t fmt_len = 16;
+
222  buffer.writeArray((uint8_t *)"fmt ", 4);
+
223  write32(buffer, fmt_len);
+
224  write16(buffer, (uint16_t)headerInfo.format); // PCM
+
225  write16(buffer, headerInfo.channels);
+
226  write32(buffer, headerInfo.sample_rate);
+
227  write32(buffer, headerInfo.byte_rate);
+
228  write16(buffer, headerInfo.block_align); // frame size
+
229  write16(buffer, headerInfo.bits_per_sample);
+
230  }
+
231 
+
232  void write32(BaseBuffer<uint8_t> &buffer, uint64_t value) {
+
233  buffer.writeArray((uint8_t *)&value, 4);
+
234  }
+
235 
+
236  void write16(BaseBuffer<uint8_t> &buffer, uint16_t value) {
+
237  buffer.writeArray((uint8_t *)&value, 2);
+
238  }
+
239 
+
240  void writeDataHeader(BaseBuffer<uint8_t> &buffer) {
+
241  buffer.writeArray((uint8_t *)"data", 4);
+
242  write32(buffer, headerInfo.file_size);
+
243  int offset = headerInfo.offset;
+
244  if (offset > 0) {
+
245  uint8_t empty[offset];
+
246  memset(empty, 0, offset);
+
247  buffer.writeArray(empty, offset); // resolve issue with wrong aligment
+
248  }
+
249  }
+
250 
+
251 };
+
252 
+
263 class WAVDecoder : public AudioDecoder {
+
264  public:
+
268  WAVDecoder() = default;
269 
-
270  bool begin() override {
-
271  TRACED();
-
272  header.clear();
-
273  setupEncodedAudio();
-
274  buffer24.reset();
-
275  isFirst = true;
-
276  active = true;
-
277  return true;
-
278  }
-
279 
-
280  void end() override {
-
281  TRACED();
-
282  buffer24.reset();
-
283  active = false;
-
284  }
-
285 
-
286  const char *mime() { return wav_mime; }
+
274  WAVDecoder(AudioDecoderExt &dec, AudioFormat fmt) {
+
275  setDecoder(dec, fmt);
+
276  }
+
277 
+
279  void setDecoder(AudioDecoderExt &dec, AudioFormat fmt) {
+
280  TRACED();
+
281  decoder_format = fmt;
+
282  p_decoder = &dec;
+
283  }
+
284 
+
286  void setOutput(Print &out_stream) override { this->p_print = &out_stream; }
287 
-
288  WAVAudioInfo &audioInfoEx() { return header.audioInfo(); }
-
289 
-
290  AudioInfo audioInfo() override { return header.audioInfo(); }
-
291 
-
292  virtual size_t write(const uint8_t *data, size_t len) override {
-
293  TRACED();
-
294  size_t result = 0;
-
295  if (active) {
-
296  if (isFirst) {
-
297  int data_start = decodeHeader((uint8_t*) data, len);
-
298  // we do not have the complete header yet: need more data
-
299  if (data_start == 0) return len;
-
300  // process the outstanding data
-
301  result = data_start + write_out((uint8_t *)data+data_start, len-data_start);
-
302 
-
303  } else if (isValid) {
-
304  result = write_out((uint8_t *)data, len);
-
305  }
-
306  }
-
307  return result;
-
308  }
+
288  bool begin() override {
+
289  TRACED();
+
290  header.clear();
+
291  setupEncodedAudio();
+
292  buffer24.reset();
+
293  isFirst = true;
+
294  active = true;
+
295  return true;
+
296  }
+
297 
+
298  void end() override {
+
299  TRACED();
+
300  buffer24.reset();
+
301  active = false;
+
302  }
+
303 
+
304  const char *mime() { return wav_mime; }
+
305 
+
306  WAVAudioInfo &audioInfoEx() { return header.audioInfo(); }
+
307 
+
308  AudioInfo audioInfo() override { return header.audioInfo(); }
309 
-
310  virtual operator bool() override { return active; }
-
311 
-
312  protected:
-
313  WAVHeader header;
-
314  bool isFirst = true;
-
315  bool isValid = true;
-
316  bool active = false;
-
317  AudioFormat decoder_format = AudioFormat::PCM;
-
318  AudioDecoderExt *p_decoder = nullptr;
-
319  EncodedAudioOutput dec_out;
-
320  SingleBuffer<uint8_t> buffer24;
-
321 
-
322  Print& out() {
-
323  return p_decoder==nullptr ? *p_print : dec_out;
-
324  }
-
325 
-
326  virtual size_t write_out(const uint8_t *in_ptr, size_t in_size) {
-
327  // check if we need to convert int24 data from 3 bytes to 4 bytes
-
328  size_t result = 0;
-
329  if (header.audioInfo().format == AudioFormat::PCM
-
330  && header.audioInfo().bits_per_sample == 24 && sizeof(int24_t)==4){
-
331  write_out_24(in_ptr, in_size);
-
332  result = in_size;
-
333  } else {
-
334  result = out().write(in_ptr, in_size);
-
335  }
-
336  return result;
-
337  }
-
338 
-
339  // convert int24 to int32
-
340  size_t write_out_24(const uint8_t *in_ptr, size_t in_size) {
-
341  // make sure we can store a frame of 24bit (3bytes)
-
342  AudioInfo& info = header.audioInfo();
-
343  // in_size might be not a multiple of 3, so we use a buffer for a single frame
-
344  buffer24.resize(info.channels*3);
-
345  int result = 0;
-
346  int32_t frame[info.channels];
-
347  uint8_t val24[3]={0};
-
348 
-
349  // add all bytes to buffer
-
350  for (int j=0;j<in_size;j++){
-
351  buffer24.write(in_ptr[j]);
-
352  // if buffer is full convert and output
-
353  if (buffer24.availableForWrite()==0){
-
354  for (int ch=0;ch<info.channels;ch++){
-
355  buffer24.readArray((uint8_t*)&val24[0], 3);
-
356  frame[ch] = interpret24bitAsInt32(val24);
-
357  //LOGW("%d", frame[ch]);
-
358  }
-
359  assert(buffer24.available()==0);
-
360  buffer24.reset();
-
361  size_t written = out().write((uint8_t*)frame,sizeof(frame));
-
362  assert(written==sizeof(frame));
-
363  result += written;
-
364  }
-
365  }
-
366  return result;
-
367  }
-
368 
-
369  int32_t interpret24bitAsInt32(uint8_t* byteArray) {
-
370  return (
-
371  (static_cast<int32_t>(byteArray[2]) << 24)
-
372  | (static_cast<int32_t>(byteArray[1]) << 16)
-
373  | (static_cast<int32_t>(byteArray[0]) << 8)
-
374  );
-
375  }
-
376 
-
378  int decodeHeader(uint8_t *in_ptr, size_t in_size) {
-
379  int result = in_size;
-
380  // we expect at least the full header
-
381  int written = header.write(in_ptr, in_size);
-
382  if (!header.isDataComplete()) {
-
383  return 0;
-
384  }
-
385  // parse header
-
386  if (!header.parse()){
-
387  return 0;
-
388  }
-
389 
-
390  isFirst = false;
-
391  isValid = header.audioInfo().is_valid;
-
392 
-
393  LOGI("WAV sample_rate: %d", (int) header.audioInfo().sample_rate);
-
394  LOGI("WAV data_length: %u", (unsigned)header.audioInfo().data_length);
-
395  LOGI("WAV is_streamed: %d", header.audioInfo().is_streamed);
-
396  LOGI("WAV is_valid: %s",
-
397  header.audioInfo().is_valid ? "true" : "false");
-
398 
-
399  // check format
-
400  AudioFormat format = header.audioInfo().format;
-
401  isValid = format == decoder_format;
-
402  if (isValid) {
-
403  // update blocksize
-
404  if(p_decoder!=nullptr){
-
405  int block_size = header.audioInfo().block_align;
-
406  p_decoder->setBlockSize(block_size);
-
407  }
-
408 
-
409  // update sampling rate if the target supports it
-
410  AudioInfo bi;
-
411  bi.sample_rate = header.audioInfo().sample_rate;
-
412  bi.channels = header.audioInfo().channels;
-
413  bi.bits_per_sample = header.audioInfo().bits_per_sample;
-
414  notifyAudioChange(bi);
-
415  } else {
-
416  LOGE("WAV format not supported: %d", (int)format);
-
417  }
-
418  return header.getDataPos();
-
419  }
-
420 
-
421  void setupEncodedAudio() {
-
422  if (p_decoder!=nullptr){
-
423  assert(p_print!=nullptr);
-
424  dec_out.setOutput(p_print);
-
425  dec_out.setDecoder(p_decoder);
-
426  dec_out.begin(info);
-
427  }
-
428  }
-
429 };
-
430 
-
440 class WAVEncoder : public AudioEncoder {
-
441  public:
-
445  WAVEncoder() = default;
-
446 
-
450  WAVEncoder(AudioEncoderExt &enc, AudioFormat fmt) {
-
451  setEncoder(enc, fmt);
-
452  };
-
453 
-
454  void setEncoder(AudioEncoderExt &enc, AudioFormat fmt) {
-
455  TRACED();
-
456  audioInfo.format = fmt;
-
457  p_encoder = &enc;
-
458  }
-
459 
-
461  void setOutput(Print &out) override {
-
462  TRACED();
-
463  p_print = &out;
-
464  }
-
465 
-
467  const char *mime() override { return wav_mime; }
-
468 
-
469  // Provides the default configuration
-
470  WAVAudioInfo defaultConfig() {
-
471  WAVAudioInfo info;
-
472  info.format = AudioFormat::PCM;
-
473  info.sample_rate = DEFAULT_SAMPLE_RATE;
-
474  info.bits_per_sample = DEFAULT_BITS_PER_SAMPLE;
-
475  info.channels = DEFAULT_CHANNELS;
-
476  info.is_streamed = true;
-
477  info.is_valid = true;
-
478  info.data_length = 0x7fff0000;
-
479  info.file_size = info.data_length + 36;
-
480  return info;
-
481  }
-
482 
-
484  virtual void setAudioInfo(AudioInfo from) override {
-
485  audioInfo.sample_rate = from.sample_rate;
-
486  audioInfo.channels = from.channels;
-
487  audioInfo.bits_per_sample = from.bits_per_sample;
-
488  // recalculate byte rate, block align...
-
489  setAudioInfo(audioInfo);
-
490  }
-
491 
-
493  virtual void setAudioInfo(WAVAudioInfo ai) {
-
494  AudioEncoder::setAudioInfo(ai);
-
495  if (p_encoder) p_encoder->setAudioInfo(ai);
-
496  audioInfo = ai;
-
497  LOGI("sample_rate: %d", (int)audioInfo.sample_rate);
-
498  LOGI("channels: %d", audioInfo.channels);
-
499  // bytes per second
-
500  audioInfo.byte_rate = audioInfo.sample_rate * audioInfo.channels * audioInfo.bits_per_sample / 8;
-
501  if (audioInfo.format == AudioFormat::PCM){
-
502  audioInfo.block_align = audioInfo.bits_per_sample / 8 * audioInfo.channels;
-
503  }
-
504  if (audioInfo.is_streamed || audioInfo.data_length == 0 ||
-
505  audioInfo.data_length >= 0x7fff0000) {
-
506  LOGI("is_streamed! because length is %u",
-
507  (unsigned)audioInfo.data_length);
-
508  audioInfo.is_streamed = true;
-
509  audioInfo.data_length = ~0;
-
510  } else {
-
511  size_limit = audioInfo.data_length;
-
512  LOGI("size_limit is %d", (int)size_limit);
-
513  }
-
514  }
-
515 
-
517  bool begin(WAVAudioInfo ai) {
-
518  header.clear();
-
519  setAudioInfo(ai);
-
520  return begin();
-
521  }
-
522 
-
524  virtual bool begin() override {
-
525  TRACED();
-
526  setupEncodedAudio();
-
527  header_written = false;
-
528  is_open = true;
-
529  return true;
-
530  }
-
531 
-
533  void end() override { is_open = false; }
-
534 
-
536  virtual size_t write(const uint8_t *data, size_t len) override {
-
537  if (!is_open) {
-
538  LOGE("The WAVEncoder is not open - please call begin()");
-
539  return 0;
-
540  }
-
541 
-
542  if (p_print == nullptr) {
-
543  LOGE("No output stream was provided");
-
544  return 0;
-
545  }
-
546 
-
547  if (!header_written) {
-
548  LOGI("Writing Header");
-
549  header.setAudioInfo(audioInfo);
-
550  int len = header.writeHeader(p_print);
-
551  audioInfo.file_size -= len;
-
552  header_written = true;
-
553  }
-
554 
-
555  int32_t result = 0;
-
556  Print *p_out = p_encoder==nullptr ? p_print : &enc_out;;
-
557  if (audioInfo.is_streamed) {
-
558  result = p_out->write((uint8_t *)data, len);
-
559  } else if (size_limit > 0) {
-
560  size_t write_size = min((size_t)len, (size_t)size_limit);
-
561  result = p_out->write((uint8_t *)data, write_size);
-
562  size_limit -= result;
-
563 
-
564  if (size_limit <= 0) {
-
565  LOGI("The defined size was written - so we close the WAVEncoder now");
-
566  is_open = false;
-
567  }
-
568  }
-
569  return result;
-
570  }
-
571 
-
572  operator bool() override { return is_open; }
-
573 
-
574  bool isOpen() { return is_open; }
+
310  virtual size_t write(const uint8_t *data, size_t len) override {
+
311  TRACED();
+
312  size_t result = 0;
+
313  if (active) {
+
314  if (isFirst) {
+
315  int data_start = decodeHeader((uint8_t*) data, len);
+
316  // we do not have the complete header yet: need more data
+
317  if (data_start == 0) return len;
+
318  // process the outstanding data
+
319  result = data_start + write_out((uint8_t *)data+data_start, len-data_start);
+
320 
+
321  } else if (isValid) {
+
322  result = write_out((uint8_t *)data, len);
+
323  }
+
324  }
+
325  return result;
+
326  }
+
327 
+
328  virtual operator bool() override { return active; }
+
329 
+
330  protected:
+
331  WAVHeader header;
+
332  bool isFirst = true;
+
333  bool isValid = true;
+
334  bool active = false;
+
335  AudioFormat decoder_format = AudioFormat::PCM;
+
336  AudioDecoderExt *p_decoder = nullptr;
+
337  EncodedAudioOutput dec_out;
+
338  SingleBuffer<uint8_t> buffer24;
+
339 
+
340  Print& out() {
+
341  return p_decoder==nullptr ? *p_print : dec_out;
+
342  }
+
343 
+
344  virtual size_t write_out(const uint8_t *in_ptr, size_t in_size) {
+
345  // check if we need to convert int24 data from 3 bytes to 4 bytes
+
346  size_t result = 0;
+
347  if (header.audioInfo().format == AudioFormat::PCM
+
348  && header.audioInfo().bits_per_sample == 24 && sizeof(int24_t)==4){
+
349  write_out_24(in_ptr, in_size);
+
350  result = in_size;
+
351  } else {
+
352  result = out().write(in_ptr, in_size);
+
353  }
+
354  return result;
+
355  }
+
356 
+
357  // convert int24 to int32
+
358  size_t write_out_24(const uint8_t *in_ptr, size_t in_size) {
+
359  // make sure we can store a frame of 24bit (3bytes)
+
360  AudioInfo& info = header.audioInfo();
+
361  // in_size might be not a multiple of 3, so we use a buffer for a single frame
+
362  buffer24.resize(info.channels*3);
+
363  int result = 0;
+
364  int32_t frame[info.channels];
+
365  uint8_t val24[3]={0};
+
366 
+
367  // add all bytes to buffer
+
368  for (int j=0;j<in_size;j++){
+
369  buffer24.write(in_ptr[j]);
+
370  // if buffer is full convert and output
+
371  if (buffer24.availableForWrite()==0){
+
372  for (int ch=0;ch<info.channels;ch++){
+
373  buffer24.readArray((uint8_t*)&val24[0], 3);
+
374  frame[ch] = interpret24bitAsInt32(val24);
+
375  //LOGW("%d", frame[ch]);
+
376  }
+
377  assert(buffer24.available()==0);
+
378  buffer24.reset();
+
379  size_t written = out().write((uint8_t*)frame,sizeof(frame));
+
380  assert(written==sizeof(frame));
+
381  result += written;
+
382  }
+
383  }
+
384  return result;
+
385  }
+
386 
+
387  int32_t interpret24bitAsInt32(uint8_t* byteArray) {
+
388  return (
+
389  (static_cast<int32_t>(byteArray[2]) << 24)
+
390  | (static_cast<int32_t>(byteArray[1]) << 16)
+
391  | (static_cast<int32_t>(byteArray[0]) << 8)
+
392  );
+
393  }
+
394 
+
396  int decodeHeader(uint8_t *in_ptr, size_t in_size) {
+
397  int result = in_size;
+
398  // we expect at least the full header
+
399  int written = header.write(in_ptr, in_size);
+
400  if (!header.isDataComplete()) {
+
401  LOGW("WAV header misses 'data' section in len: %d", header.available());
+
402  header.dumpHeader();
+
403  return 0;
+
404  }
+
405  // parse header
+
406  if (!header.parse()){
+
407  LOGE("WAV header parsing failed");
+
408  return 0;
+
409  }
+
410 
+
411  isFirst = false;
+
412  isValid = header.audioInfo().is_valid;
+
413 
+
414  LOGI("WAV sample_rate: %d", (int) header.audioInfo().sample_rate);
+
415  LOGI("WAV data_length: %u", (unsigned)header.audioInfo().data_length);
+
416  LOGI("WAV is_streamed: %d", header.audioInfo().is_streamed);
+
417  LOGI("WAV is_valid: %s",
+
418  header.audioInfo().is_valid ? "true" : "false");
+
419 
+
420  // check format
+
421  AudioFormat format = header.audioInfo().format;
+
422  isValid = format == decoder_format;
+
423  if (isValid) {
+
424  // update blocksize
+
425  if(p_decoder!=nullptr){
+
426  int block_size = header.audioInfo().block_align;
+
427  p_decoder->setBlockSize(block_size);
+
428  }
+
429 
+
430  // update sampling rate if the target supports it
+
431  AudioInfo bi;
+
432  bi.sample_rate = header.audioInfo().sample_rate;
+
433  bi.channels = header.audioInfo().channels;
+
434  bi.bits_per_sample = header.audioInfo().bits_per_sample;
+
435  notifyAudioChange(bi);
+
436  } else {
+
437  LOGE("WAV format not supported: %d", (int)format);
+
438  }
+
439  return header.getDataPos();
+
440  }
+
441 
+
442  void setupEncodedAudio() {
+
443  if (p_decoder!=nullptr){
+
444  assert(p_print!=nullptr);
+
445  dec_out.setOutput(p_print);
+
446  dec_out.setDecoder(p_decoder);
+
447  dec_out.begin(info);
+
448  }
+
449  }
+
450 };
+
451 
+
461 class WAVEncoder : public AudioEncoder {
+
462  public:
+
466  WAVEncoder() = default;
+
467 
+
471  WAVEncoder(AudioEncoderExt &enc, AudioFormat fmt) {
+
472  setEncoder(enc, fmt);
+
473  };
+
474 
+
475  void setEncoder(AudioEncoderExt &enc, AudioFormat fmt) {
+
476  TRACED();
+
477  audioInfo.format = fmt;
+
478  p_encoder = &enc;
+
479  }
+
480 
+
482  void setOutput(Print &out) override {
+
483  TRACED();
+
484  p_print = &out;
+
485  }
+
486 
+
488  const char *mime() override { return wav_mime; }
+
489 
+
490  // Provides the default configuration
+
491  WAVAudioInfo defaultConfig() {
+
492  WAVAudioInfo info;
+
493  info.format = AudioFormat::PCM;
+
494  info.sample_rate = DEFAULT_SAMPLE_RATE;
+
495  info.bits_per_sample = DEFAULT_BITS_PER_SAMPLE;
+
496  info.channels = DEFAULT_CHANNELS;
+
497  info.is_streamed = true;
+
498  info.is_valid = true;
+
499  info.data_length = 0x7fff0000;
+
500  info.file_size = info.data_length + 36;
+
501  return info;
+
502  }
+
503 
+
505  virtual void setAudioInfo(AudioInfo from) override {
+
506  audioInfo.sample_rate = from.sample_rate;
+
507  audioInfo.channels = from.channels;
+
508  audioInfo.bits_per_sample = from.bits_per_sample;
+
509  // recalculate byte rate, block align...
+
510  setAudioInfo(audioInfo);
+
511  }
+
512 
+
514  virtual void setAudioInfo(WAVAudioInfo ai) {
+
515  AudioEncoder::setAudioInfo(ai);
+
516  if (p_encoder) p_encoder->setAudioInfo(ai);
+
517  audioInfo = ai;
+
518  LOGI("sample_rate: %d", (int)audioInfo.sample_rate);
+
519  LOGI("channels: %d", audioInfo.channels);
+
520  // bytes per second
+
521  audioInfo.byte_rate = audioInfo.sample_rate * audioInfo.channels * audioInfo.bits_per_sample / 8;
+
522  if (audioInfo.format == AudioFormat::PCM){
+
523  audioInfo.block_align = audioInfo.bits_per_sample / 8 * audioInfo.channels;
+
524  }
+
525  if (audioInfo.is_streamed || audioInfo.data_length == 0 ||
+
526  audioInfo.data_length >= 0x7fff0000) {
+
527  LOGI("is_streamed! because length is %u",
+
528  (unsigned)audioInfo.data_length);
+
529  audioInfo.is_streamed = true;
+
530  audioInfo.data_length = ~0;
+
531  } else {
+
532  size_limit = audioInfo.data_length;
+
533  LOGI("size_limit is %d", (int)size_limit);
+
534  }
+
535  }
+
536 
+
538  bool begin(WAVAudioInfo ai) {
+
539  header.clear();
+
540  setAudioInfo(ai);
+
541  return begin();
+
542  }
+
543 
+
545  virtual bool begin() override {
+
546  TRACED();
+
547  setupEncodedAudio();
+
548  header_written = false;
+
549  is_open = true;
+
550  return true;
+
551  }
+
552 
+
554  void end() override { is_open = false; }
+
555 
+
557  virtual size_t write(const uint8_t *data, size_t len) override {
+
558  if (!is_open) {
+
559  LOGE("The WAVEncoder is not open - please call begin()");
+
560  return 0;
+
561  }
+
562 
+
563  if (p_print == nullptr) {
+
564  LOGE("No output stream was provided");
+
565  return 0;
+
566  }
+
567 
+
568  if (!header_written) {
+
569  LOGI("Writing Header");
+
570  header.setAudioInfo(audioInfo);
+
571  int len = header.writeHeader(p_print);
+
572  audioInfo.file_size -= len;
+
573  header_written = true;
+
574  }
575 
-
577  void setDataOffset(uint16_t offset) { audioInfo.offset = offset; }
-
578 
-
579  protected:
-
580  WAVHeader header;
-
581  Print *p_print = nullptr; // final output CopyEncoder copy; // used for PCM
-
582  AudioEncoderExt *p_encoder = nullptr;
-
583  EncodedAudioOutput enc_out;
-
584  WAVAudioInfo audioInfo = defaultConfig();
-
585  int64_t size_limit = 0;
-
586  bool header_written = false;
-
587  volatile bool is_open = false;
-
588 
-
589  void setupEncodedAudio() {
-
590  if (p_encoder!=nullptr){
-
591  assert(p_print!=nullptr);
-
592  enc_out.setOutput(p_print);
-
593  enc_out.setEncoder(p_encoder);
-
594  enc_out.setAudioInfo(audioInfo);
-
595  enc_out.begin();
-
596  // block size only available after begin(): update block size
-
597  audioInfo.block_align = p_encoder->blockSize();
-
598  }
-
599  }
-
600 };
-
601 
-
602 } // namespace audio_tools
+
576  int32_t result = 0;
+
577  Print *p_out = p_encoder==nullptr ? p_print : &enc_out;;
+
578  if (audioInfo.is_streamed) {
+
579  result = p_out->write((uint8_t *)data, len);
+
580  } else if (size_limit > 0) {
+
581  size_t write_size = min((size_t)len, (size_t)size_limit);
+
582  result = p_out->write((uint8_t *)data, write_size);
+
583  size_limit -= result;
+
584 
+
585  if (size_limit <= 0) {
+
586  LOGI("The defined size was written - so we close the WAVEncoder now");
+
587  is_open = false;
+
588  }
+
589  }
+
590  return result;
+
591  }
+
592 
+
593  operator bool() override { return is_open; }
+
594 
+
595  bool isOpen() { return is_open; }
+
596 
+
598  void setDataOffset(uint16_t offset) { audioInfo.offset = offset; }
+
599 
+
600  protected:
+
601  WAVHeader header;
+
602  Print *p_print = nullptr; // final output CopyEncoder copy; // used for PCM
+
603  AudioEncoderExt *p_encoder = nullptr;
+
604  EncodedAudioOutput enc_out;
+
605  WAVAudioInfo audioInfo = defaultConfig();
+
606  int64_t size_limit = 0;
+
607  bool header_written = false;
+
608  volatile bool is_open = false;
+
609 
+
610  void setupEncodedAudio() {
+
611  if (p_encoder!=nullptr){
+
612  assert(p_print!=nullptr);
+
613  enc_out.setOutput(p_print);
+
614  enc_out.setEncoder(p_encoder);
+
615  enc_out.setAudioInfo(audioInfo);
+
616  enc_out.begin();
+
617  // block size only available after begin(): update block size
+
618  audioInfo.block_align = p_encoder->blockSize();
+
619  }
+
620  }
+
621 };
+
622 
+
623 } // namespace audio_tools
WAV Audio Formats used by Microsoft e.g. in AVI video files.
Definition: AudioCodecsBase.h:102
Docoding of encoded audio into PCM data.
Definition: AudioCodecsBase.h:16
@@ -627,32 +646,34 @@
void reset() override
clears the buffer
Definition: Buffers.h:254
A simple wrapper to provide string functions on char*. If the underlying char* is a const we do not a...
Definition: Str.h:27
virtual int indexOf(const char c, int start=0)
Definition: Str.h:271
-
A simple WAVDecoder: We parse the header data on the first record to determine the format....
Definition: CodecWAV.h:245
-
void setOutput(Print &out_stream) override
Defines the output Stream.
Definition: CodecWAV.h:268
-
void setDecoder(AudioDecoderExt &dec, AudioFormat fmt)
Defines an optional decoder if the format is not PCM.
Definition: CodecWAV.h:261
-
int decodeHeader(uint8_t *in_ptr, size_t in_size)
Decodes the header data: Returns the start pos of the data.
Definition: CodecWAV.h:378
+
A simple WAVDecoder: We parse the header data on the first record to determine the format....
Definition: CodecWAV.h:263
+
void setOutput(Print &out_stream) override
Defines the output Stream.
Definition: CodecWAV.h:286
+
void setDecoder(AudioDecoderExt &dec, AudioFormat fmt)
Defines an optional decoder if the format is not PCM.
Definition: CodecWAV.h:279
+
int decodeHeader(uint8_t *in_ptr, size_t in_size)
Decodes the header data: Returns the start pos of the data.
Definition: CodecWAV.h:396
WAVDecoder()=default
Construct a new WAVDecoder object for PCM data.
-
WAVDecoder(AudioDecoderExt &dec, AudioFormat fmt)
Construct a new WAVDecoder object for ADPCM data.
Definition: CodecWAV.h:256
-
AudioInfo audioInfo() override
provides the actual input AudioInfo
Definition: CodecWAV.h:290
-
A simple WAV file encoder. If no AudioEncoderExt is specified the WAV file contains PCM data,...
Definition: CodecWAV.h:440
-
virtual size_t write(const uint8_t *data, size_t len) override
Writes PCM data to be encoded as WAV.
Definition: CodecWAV.h:536
-
void setOutput(Print &out) override
Defines the otuput stream.
Definition: CodecWAV.h:461
-
virtual bool begin() override
starts the processing using the actual WAVAudioInfo
Definition: CodecWAV.h:524
-
bool begin(WAVAudioInfo ai)
starts the processing
Definition: CodecWAV.h:517
-
const char * mime() override
Provides "audio/wav".
Definition: CodecWAV.h:467
-
void end() override
stops the processing
Definition: CodecWAV.h:533
-
virtual void setAudioInfo(WAVAudioInfo ai)
Defines the WAVAudioInfo.
Definition: CodecWAV.h:493
+
WAVDecoder(AudioDecoderExt &dec, AudioFormat fmt)
Construct a new WAVDecoder object for ADPCM data.
Definition: CodecWAV.h:274
+
AudioInfo audioInfo() override
provides the actual input AudioInfo
Definition: CodecWAV.h:308
+
A simple WAV file encoder. If no AudioEncoderExt is specified the WAV file contains PCM data,...
Definition: CodecWAV.h:461
+
virtual size_t write(const uint8_t *data, size_t len) override
Writes PCM data to be encoded as WAV.
Definition: CodecWAV.h:557
+
void setOutput(Print &out) override
Defines the otuput stream.
Definition: CodecWAV.h:482
+
virtual bool begin() override
starts the processing using the actual WAVAudioInfo
Definition: CodecWAV.h:545
+
bool begin(WAVAudioInfo ai)
starts the processing
Definition: CodecWAV.h:538
+
const char * mime() override
Provides "audio/wav".
Definition: CodecWAV.h:488
+
void end() override
stops the processing
Definition: CodecWAV.h:554
+
virtual void setAudioInfo(WAVAudioInfo ai)
Defines the WAVAudioInfo.
Definition: CodecWAV.h:514
WAVEncoder()=default
Construct a new WAVEncoder object for PCM data.
-
void setDataOffset(uint16_t offset)
Adds n empty bytes at the beginning of the data.
Definition: CodecWAV.h:577
-
WAVEncoder(AudioEncoderExt &enc, AudioFormat fmt)
Construct a new WAVEncoder object for ADPCM data.
Definition: CodecWAV.h:450
-
virtual void setAudioInfo(AudioInfo from) override
Update actual WAVAudioInfo.
Definition: CodecWAV.h:484
+
void setDataOffset(uint16_t offset)
Adds n empty bytes at the beginning of the data.
Definition: CodecWAV.h:598
+
WAVEncoder(AudioEncoderExt &enc, AudioFormat fmt)
Construct a new WAVEncoder object for ADPCM data.
Definition: CodecWAV.h:471
+
virtual void setAudioInfo(AudioInfo from) override
Update actual WAVAudioInfo.
Definition: CodecWAV.h:505
Parser for Wav header data for details see https://de.wikipedia.org/wiki/RIFF_WAVE.
Definition: CodecWAV.h:45
bool parse()
Call begin when header data is complete to parse the data.
Definition: CodecWAV.h:55
-
bool isDataComplete()
Returns true if the header is complete (with 44 bytes): contains data + 4 byte len.
Definition: CodecWAV.h:84
-
void setAudioInfo(WAVAudioInfo info)
Sets the info in the header.
Definition: CodecWAV.h:98
+
bool isDataComplete()
Returns true if the header is complete (containd data tag)
Definition: CodecWAV.h:84
+
void setAudioInfo(WAVAudioInfo info)
Sets the info in the header.
Definition: CodecWAV.h:104
+
size_t available()
number of bytes available in the header buffer
Definition: CodecWAV.h:90
+
int getDataPos()
Determines the data start position using the data tag.
Definition: CodecWAV.h:95
int write(uint8_t *data, size_t data_len)
Adds data to the 44 byte wav header data buffer and make it available for parsing.
Definition: CodecWAV.h:50
-
int writeHeader(Print *out)
Just write a wav header to the indicated outputbu.
Definition: CodecWAV.h:103
-
WAVAudioInfo & audioInfo()
provides the info from the header
Definition: CodecWAV.h:95
+
int writeHeader(Print *out)
Just write a wav header to the indicated outputbu.
Definition: CodecWAV.h:109
+
WAVAudioInfo & audioInfo()
provides the info from the header
Definition: CodecWAV.h:101
AudioFormat
Audio format codes used by Microsoft e.g. in avi or wav files.
Definition: AudioFormat.h:19
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition: AnalogAudioArduino.h:12
Basic Audio information which drives e.g. I2S.
Definition: AudioTypes.h:50
diff --git a/_jupyter_audio_8h_source.html b/_jupyter_audio_8h_source.html index 47578e5a1..88fc1836e 100644 --- a/_jupyter_audio_8h_source.html +++ b/_jupyter_audio_8h_source.html @@ -284,8 +284,8 @@
AudioInfo audioInfo()
provides the actual input AudioInfo
Definition: JupyterAudio.h:181
Definition: NoArduino.h:58
Typed Stream Copy which supports the conversion from channel to 2 channels. We make sure that we allw...
Definition: StreamCopy.h:23
-
A simple WAV file encoder. If no AudioEncoderExt is specified the WAV file contains PCM data,...
Definition: CodecWAV.h:440
-
virtual void setAudioInfo(AudioInfo from) override
Update actual WAVAudioInfo.
Definition: CodecWAV.h:484
+
A simple WAV file encoder. If no AudioEncoderExt is specified the WAV file contains PCM data,...
Definition: CodecWAV.h:461
+
virtual void setAudioInfo(AudioInfo from) override
Update actual WAVAudioInfo.
Definition: CodecWAV.h:505
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition: AnalogAudioArduino.h:12
Basic Audio information which drives e.g. I2S.
Definition: AudioTypes.h:50
uint16_t channels
Number of channels: 2=stereo, 1=mono.
Definition: AudioTypes.h:55
diff --git a/classaudio__tools_1_1_w_a_v_header-members.html b/classaudio__tools_1_1_w_a_v_header-members.html index eaf3685d0..e87e4a8ef 100644 --- a/classaudio__tools_1_1_w_a_v_header-members.html +++ b/classaudio__tools_1_1_w_a_v_header-members.html @@ -73,13 +73,15 @@

This is the complete list of members for WAVHeader, including all inherited members.

- - - + + + + + - + diff --git a/classaudio__tools_1_1_w_a_v_header.html b/classaudio__tools_1_1_w_a_v_header.html index 83935f994..fb72ca056 100644 --- a/classaudio__tools_1_1_w_a_v_header.html +++ b/classaudio__tools_1_1_w_a_v_header.html @@ -86,15 +86,23 @@ WAVAudioInfo &  + + + + + +int  + - + @@ -170,7 +178,7 @@ +SingleBuffer< uint8_t >  diff --git a/functions.html b/functions.html index 844dff2a6..966327dfa 100644 --- a/functions.html +++ b/functions.html @@ -324,7 +324,7 @@

- a -

audioInfo()WAVHeaderinline
buffer (defined in WAVHeader)WAVHeaderprotected
clear() (defined in WAVHeader)WAVHeaderinline
data_pos (defined in WAVHeader)WAVHeaderprotected
available()WAVHeaderinline
buffer (defined in WAVHeader)WAVHeaderprotected
clear() (defined in WAVHeader)WAVHeaderinline
data_pos (defined in WAVHeader)WAVHeaderprotected
dumpHeader() (defined in WAVHeader)WAVHeaderinline
eof() (defined in WAVHeader)WAVHeaderinlineprotected
getChar() (defined in WAVHeader)WAVHeaderinlineprotected
getChar32() (defined in WAVHeader)WAVHeaderinlineprotected
getDataPos() (defined in WAVHeader)WAVHeaderinline
getDataPos()WAVHeaderinline
headerInfo (defined in WAVHeader)WAVHeaderprotected
indexOf(const char *str) (defined in WAVHeader)WAVHeaderinlineprotected
isDataComplete()WAVHeaderinline
audioInfo ()
 provides the info from the header
 
+size_t available ()
 number of bytes available in the header buffer
 
void clear ()
 
+void dumpHeader ()
 
-int getDataPos ()
getDataPos ()
 Determines the data start position using the data tag.
 
bool isDataComplete ()
 Returns true if the header is complete (with 44 bytes): contains data + 4 byte len.
 Returns true if the header is complete (containd data tag)
 
bool parse ()

Protected Attributes

-SingleBuffer< uint8_t > buffer { 50 }
buffer { 200 }
 
size_t data_pos = 0