From f5b952cccac218a1bffb8dee50699fb7988f1a7b Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Fri, 21 Apr 2017 22:52:14 +0200 Subject: [PATCH] minor fixes --- src/main.cpp | 2 +- src/sound.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 40a5ae4..43788c1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,7 +25,7 @@ static const char *soundFile[3][3] = {{"/T0.wav", "/T1.wav", "/T2.wav"}, {"/T6.wav", "/T7.wav", "/T8.wav"}}; unsigned long lastDebounceTime = 0; // the last time the output pin was toggled -unsigned long debounceDelay = 100; // the debounce time +unsigned long debounceDelay = 250; // the debounce time void setup() { diff --git a/src/sound.cpp b/src/sound.cpp index f97acce..1951440 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -136,7 +136,7 @@ void Sound::play_task(void *pvParameter) { while (buf_pos < BUF_LENGTH) { // Serial.print("i2s_push free stack: "); Serial.println(uxTaskGetStackHighWaterMark( NULL ), DEC); // DEBUG uint16_t *buf16 = (uint16_t *) buf; - int buf16_pos = buf_pos/4; // ToDo: why not 2? + int buf16_pos = buf_pos/(sizeof(uint16_t)*2); // ToDo: read number of channels samplerate etc // convert data //unsigned int sample = ((unsigned short) DataSource::buffer[DataSource::buf_pos] << 16 & 0xffff0000) | ((unsigned short) DataSource::buffer[DataSource::buf_pos]); unsigned int sample = ((unsigned short) buf16[buf16_pos] << 16 & 0xffff0000) | ((unsigned short) buf16[buf16_pos]);