Browse Source

Fix audible click at end of Wav file playing

dds
PaulStoffregen 10 years ago
parent
commit
f84e0017ab
2 changed files with 3 additions and 8 deletions
  1. +0
    -5
      play_sd_wav.cpp
  2. +3
    -3
      play_sd_wav.h

+ 0
- 5
play_sd_wav.cpp View File

@@ -202,7 +202,6 @@ start:
memcpy((uint8_t *)header + header_offset, p, len);
header_offset += len;
buffer_offset += len;
buffer_length -= len;
data_length -= len;
if (data_length > 0) return false;
// parse the header...
@@ -232,7 +231,6 @@ start:
memcpy((uint8_t *)header + header_offset, p, len);
header_offset += len;
buffer_offset += len;
buffer_length -= len;
data_length -= len;
if (data_length > 0) return false;
if (parse_format()) {
@@ -254,7 +252,6 @@ start:
memcpy((uint8_t *)header + header_offset, p, len);
header_offset += len;
buffer_offset += len;
buffer_length -= len;
data_length -= len;
if (data_length > 0) return false;
//Serial.print("chunk id = ");
@@ -289,13 +286,11 @@ start:
if (size < data_length) {
data_length -= size;
buffer_offset += size;
buffer_length -= size;
return false;
}
p += data_length;
size -= data_length;
buffer_offset += data_length;
buffer_length -= data_length;
data_length = 8;
header_offset = 0;
state = STATE_PARSE3;

+ 3
- 3
play_sd_wav.h View File

@@ -51,10 +51,10 @@ private:
uint32_t bytes2millis;
audio_block_t *block_left;
audio_block_t *block_right;
uint16_t block_offset;
uint16_t block_offset; // how much data is in block_left & block_right
uint8_t buffer[512]; // buffer one block of data
uint16_t buffer_offset;
uint16_t buffer_length;
uint16_t buffer_offset; // where we're at consuming "buffer"
uint16_t buffer_length; // how much data is in "buffer" (512 until last read)
uint8_t header_offset; // number of bytes in header[]
uint8_t state;
uint8_t state_play;

Loading…
Cancel
Save