Skip to content

Commit 805cb27

Browse files
committed
RingBufferFile
1 parent bf6995d commit 805cb27

File tree

16 files changed

+599
-644
lines changed

16 files changed

+599
-644
lines changed

examples/build-examples-log.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@
9090
../examples/examples-audiokit/streams-audiokit-sd-audiokit -> rc=0
9191
../examples/examples-audiokit/streams-audiokit-serial -> rc=0
9292
../examples/examples-audiokit/streams-audiokit-tf -> rc=0
93-
../examples/examples-audiokit/streams-audiokit-webserver_aac -> rc=0
94-
../examples/examples-audiokit/streams-audiokit-webserver_mp3 -> rc=0
9593
../examples/examples-audiokit/streams-audiokit-webserver_wav -> rc=0
9694
../examples/examples-audiokit/streams-file_loop-audiokit -> rc=0
9795
../examples/examples-audiokit/streams-generator-audiokit -> rc=0
@@ -134,7 +132,7 @@
134132
../examples/examples-maximilian/18-DrumMachine -> rc=0
135133
../examples/examples-maximilian/19-Enveloping2 -> rc=0
136134
../examples/examples-maximilian/20-FFT -> rc=0
137-
../examples/examples-tts/streams-azure_tts-i2s.ino -> rc=1
135+
../examples/examples-tts/streams-azure_tts-i2s -> rc=0
138136
../examples/examples-tts/streams-espeak-audiokit -> rc=0
139137
../examples/examples-tts/streams-espeak-i2s -> rc=0
140138
../examples/examples-tts/streams-flite-audiokit -> rc=0
@@ -147,11 +145,9 @@
147145
../examples/examples-faust/streams-faust_noise-i2s -> rc=0
148146
../examples/examples-faust/streams-generator-faust-i2s -> rc=0
149147
../examples/examples-faust/streams-i2s-faust_guitarix-i2s -> rc=0
150-
../examples/examples-communication/esp-now/communication-espnow-receive -> rc=0
151-
../examples/examples-communication/esp-now/communication-espnow-receive_csv -> rc=0
152-
../examples/examples-communication/esp-now/communication-espnow-receive_measure -> rc=0
153-
../examples/examples-communication/esp-now/communication-espnow-send -> rc=0
154-
../examples/examples-communication/esp-now-codec/* -> rc=1
148+
../examples/examples-communication/esp-now/codec -> rc=1/0
149+
../examples/examples-communication/esp-now/pcm -> rc=1/0
150+
../examples/examples-communication/esp-now/speed-test -> rc=1/0
155151
../examples/examples-communication/ip/communication-ip-receive -> rc=0
156152
../examples/examples-communication/ip/communication-ip-receive_measure -> rc=0
157153
../examples/examples-communication/ip/communication-ip-send -> rc=0
@@ -182,10 +178,13 @@
182178
../examples/tests/codecs/test-codec-gsm -> rc=0
183179
../examples/tests/codecs/test-codec-iLBC -> rc=0
184180
../examples/tests/codecs/test-codec-lc3 -> rc=0
181+
../examples/tests/codecs/test-codec-ogg -> rc=0
185182
../examples/tests/codecs/test-codec-opus -> rc=0
186183
../examples/tests/codecs/test-codec-opusogg -> rc=0
187184
../examples/tests/codecs/test-codec-sbc -> rc=0
185+
../examples/tests/codecs/test-container-binary -> rc=0
188186
../examples/tests/codecs/test-mp3-helix -> rc=0
187+
../examples/tests/codecs/test-mp3-helix-reading -> rc=0
189188
../examples/tests/codecs/test-mp3-mad -> rc=0
190189
../examples/tests/concurrency/NBuffer -> rc=0
191190
../examples/tests/concurrency/synchBufferRTOS -> rc=0

examples/build-examples.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ compile_example "esp32:esp32:esp32" "../examples/examples-audiokit/*"
3737
compile_example "esp32:esp32:esp32" "../examples/examples-maximilian/*"
3838
compile_example "esp32:esp32:esp32" "../examples/examples-tts/streams*"
3939
compile_example "esp32:esp32:esp32" "../examples/examples-faust/streams*"
40-
compile_example "esp32:esp32:esp32" "../examples/examples-communication/esp-now/codec"
41-
compile_example "esp32:esp32:esp32" "../examples/examples-communication/esp-now/pcm"
42-
compile_example "esp32:esp32:esp32" "../examples/examples-communication/esp-now/speed-test"
40+
compile_example "esp32:esp32:esp32" "../examples/examples-communication/esp-now/codec/*"
41+
compile_example "esp32:esp32:esp32" "../examples/examples-communication/esp-now/pcm/*"
42+
compile_example "esp32:esp32:esp32" "../examples/examples-communication/esp-now/speed-test/*"
4343
compile_example "esp32:esp32:esp32" "../examples/examples-communication/ip/*"
4444
compile_example "esp32:esp32:esp32" "../examples/examples-communication/rtsp/*"
4545
compile_example "esp32:esp32:esp32" "../examples/tests/test*"

examples/sandbox/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11

2-
These folder contains some work in progress, experiments and tests, so do not expect them to work.
2+
These folder contains some work in progress, experiments and tests, so do not expect them to work!
3+
34
But it might still serve as a source of inspiration...
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/**
2+
* @file test-ringbufferfile.ino
3+
* @author Phil Schatzmann
4+
* @brief genTest for the file backed ringbuffer
5+
* @version 0.1
6+
* @date 2023-04-30
7+
*
8+
* @copyright Copyright (c) 2022
9+
*
10+
*/
11+
/**
12+
* Test for the file backed ringbuffer
13+
*/
14+
#include "AudioTools.h"
15+
#include <SdFat.h>
16+
// SD pins
17+
#define PIN_SD_CARD_CS 13
18+
#define PIN_SD_CARD_MISO 2
19+
#define PIN_SD_CARD_MOSI 15
20+
#define PIN_SD_CARD_CLK 14
21+
22+
const char* file_name = "/tmp.bin";
23+
SdFs SD;
24+
FsFile file;
25+
RingBufferFile<FsFile, int16_t> buffer(file);
26+
27+
28+
void setup() {
29+
Serial.begin(115200);
30+
AudioLogger::instance().begin(Serial, AudioLogger::Info);
31+
32+
// setup SD
33+
SPI.begin(PIN_SD_CARD_CLK, PIN_SD_CARD_MISO, PIN_SD_CARD_MOSI, PIN_SD_CARD_CS);
34+
while (!SD.begin(PIN_SD_CARD_CS, SPI_HALF_SPEED)) {
35+
Serial.println("Card Mount Failed");
36+
delay(500);
37+
}
38+
39+
// create file and setup buffer
40+
file = SD.open(file_name, O_RDWR | O_CREAT );
41+
if (!file) {
42+
Serial.println("Failed to open file for writing");
43+
return;
44+
}
45+
46+
// test write
47+
for (int j = 0; j < 10; j++) {
48+
buffer.write(j);
49+
}
50+
51+
// test write array
52+
int16_t tmp[10];
53+
for (int j = 0; j < 10; j++) {
54+
tmp[j] = j;
55+
}
56+
buffer.writeArray(tmp, 10);
57+
58+
// test read
59+
Serial.println("read");
60+
for (int j = 0; j < 10; j++) {
61+
int16_t result = buffer.read();
62+
Serial.print(result);
63+
Serial.print(" ");
64+
assert(result == j);
65+
}
66+
Serial.println();
67+
68+
// test read array
69+
Serial.print("readArray");
70+
Serial.print(" ");
71+
Serial.println(buffer.available());
72+
memset(tmp, 0, 10 * sizeof(int16_t));
73+
74+
int max = buffer.readArray(tmp, buffer.available());
75+
for (int j = 0; j < max; j++) {
76+
Serial.print(tmp[j]);
77+
Serial.print(" ");
78+
assert(j == tmp[j]);
79+
}
80+
Serial.println();
81+
82+
file.close();
83+
Serial.println("Test success!");
84+
85+
// cleanup
86+
SD.remove(file_name);
87+
}
88+
89+
void loop() {}

examples/tests/codecs/test-ogg-write/test-write-ogg.ino

Lines changed: 0 additions & 27 deletions
This file was deleted.

examples/tests/conversion/channel-converter-increase-out/channel-converter-increase-out.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void setup(){
1313
AudioLogger::instance().begin(Serial, AudioLogger::Info);
1414

1515
sine_wave.begin(info, N_B4);
16-
conv.begin(from, to_channels);
16+
conv.begin(info, to_channels);
1717
in_stream.begin();
1818

1919
out.begin();

src/AudioFilter/Equilizer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22
#include <math.h>
3+
#include "AudioTools/AudioStreams.h"
34
#include "AudioTools/AudioOutput.h"
45
#include "AudioBasic/Int24.h"
56

src/AudioTools.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#include "AudioTools/AudioStreamsConverter.h"
6666
#include "AudioTools/AudioOutput.h"
6767
#include "AudioTools/VolumeStream.h"
68+
#include "AudioTools/AudioIO.h"
6869
#include "AudioTools/ResampleStream.h"
6970
#include "AudioTools/StreamCopy.h"
7071
#include "AudioCodecs/AudioEncoded.h"

0 commit comments

Comments
 (0)