aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2020-08-28 19:59:28 +0100
committerdakkar <dakkar@thenautilus.net>2020-08-28 19:59:28 +0100
commitcc3e4431599de81f82d5f5039443825c071bc599 (patch)
treef8a48137292b71fda3db1ce3d18ec5e4d5913fc5
parentbetter buffer sizing (diff)
downloadlego-piano-cc3e4431599de81f82d5f5039443825c071bc599.tar.gz
lego-piano-cc3e4431599de81f82d5f5039443825c071bc599.tar.bz2
lego-piano-cc3e4431599de81f82d5f5039443825c071bc599.zip
IT WORKS NOW!
it was (almost) all a problem of signed vs unsigned
-rw-r--r--esp32/lego-piano.ino2
1 files changed, 1 insertions, 1 deletions
diff --git a/esp32/lego-piano.ino b/esp32/lego-piano.ino
index 120792e..01b3bb7 100644
--- a/esp32/lego-piano.ino
+++ b/esp32/lego-piano.ino
@@ -160,7 +160,7 @@ void loop() {
// we don't want to drop an element from the buffer if we then
// can't write it! so we peek at the buffer, try to write, and pop
// if successful
- value=buffer[0];
+ value=buffer[0] + 32768; // tsf produces *signed* shorts, i2s wants *unsigned*
i2s_write(i2sPort, &value, sizeof(value), &written, 0);
if (written > 0) buffer.pop(value);
}