Skip to content

Commit 4eebff1

Browse files
committed
VBANStream errors
1 parent 01b6e9c commit 4eebff1

File tree

4 files changed

+23
-159
lines changed

4 files changed

+23
-159
lines changed

examples/examples-communication/vban/streams-audiokit-vban/streams-audiokit-vban.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "AudioLibs/AudioBoardStream.h" // comment out when not using AudioKit
1010

1111
AudioInfo info(44100, 2, 16);
12-
AudioBoardStream in; // Audio source e.g. replace with I2SStream
12+
AudioBoardStream in(AudioKitEs8388V1); // Audio source e.g. replace with I2SStream
1313
VBANStream out;
1414
StreamCopy copier(out, in, 2048); // copies sound into i2s
1515

examples/sandbox/ggwave/receive/receive.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
int sample_rate = GGWAVE_DEFAULT_SAMPLE_RATE;
1818
int channels = 1;
19-
AudioBoardStream in; // or AudioBoardStream
19+
AudioBoardStream in(AudioKitEs8388V1); // or e.g. I2SStream
2020
GGWaveDecoder dec;
2121
EncodedAudioStream encoder_stream(Serial, dec); // decode and write to I2S - ESP Now is limited to 256 bytes
2222
StreamCopy copier(encoder_stream, in, GGWAVE_DEFAULT_BYTES_PER_FRAME); // copy mic to tfl

src/AudioLibs/VBANStream.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class VBANStream : public AudioStream {
9191

9292
// limit output speed
9393
if (cfg.throttle_active){
94-
throttle.delaySamples(samples / cfg.channels);
94+
throttle.delayFrames(samples / cfg.channels);
9595
}
9696

9797
for (int j=0; j<samples; j++){
@@ -159,6 +159,11 @@ class VBANStream : public AudioStream {
159159
return false;
160160
}
161161
WiFi.setSleep(false);
162+
// connect to target
163+
if (!udp.connect(cfg.target_ip, cfg.udp_port)){
164+
LOGE("Could not connect to '%s:%d' target", toString(cfg.target_ip), cfg.udp_port);
165+
}
166+
// handle data
162167
udp.onPacket([this](AsyncUDPPacket packet) {
163168
receive_udp(packet);
164169
});
@@ -200,10 +205,10 @@ class VBANStream : public AudioStream {
200205

201206
// Setup the packet header:
202207
strncpy(vban.hdr->preamble, "VBAN", 4);
203-
vban.hdr->sample_rate = VBAN_PROTOCOL_AUDIO | rate; // 11025 Hz, which matches default sample rate for soundmodem
208+
vban.hdr->sample_rate = static_cast<int>(VBAN_PROTOCOL_AUDIO) | rate; // 11025 Hz, which matches default sample rate for soundmodem
204209
vban.hdr->num_samples = (VBAN_PACKET_NUM_SAMPLES / cfg.channels)-1; // 255 = 256 samples
205210
vban.hdr->num_channels = cfg.channels - 1; // 0 = 1 channel
206-
vban.hdr->sample_format = VBAN_BITFMT_16_INT | VBAN_CODEC_PCM; // int16 PCM
211+
vban.hdr->sample_format = static_cast<int>(VBAN_BITFMT_16_INT) | VBAN_CODEC_PCM; // int16 PCM
207212
strncpy(vban.hdr->stream_name, cfg.stream_name, min((int)strlen(cfg.stream_name),VBAN_STREAM_NAME_SIZE));
208213

209214
vban.packet_data_bytes = (vban.hdr->num_samples+1) * (vban.hdr->num_channels+1) * ((vban.hdr->sample_format & VBAN_BIT_RESOLUTION_MASK)+1);
@@ -281,6 +286,12 @@ class VBANStream : public AudioStream {
281286
return result;
282287
}
283288

289+
const char* toString(IPAddress adr){
290+
static char str[11] = {0};
291+
snprintf(str,11, "%d.%d.%d.%d", adr[0],adr[1],adr[2],adr[3]);
292+
return str;
293+
}
294+
284295
/**
285296
* @brief VBAN adjusts the number of samples per packet according to sample rate.
286297
* Assuming 16-bit PCM mono, sample rates 11025, 22050, 44100, and 88200 yield

src/AudioLibs/arduino-audio-tools.code-workspace

Lines changed: 7 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -2,168 +2,21 @@
22
"folders": [
33
{
44
"path": "../.."
5-
},
6-
{
7-
"path": "../../.."
85
}
96
],
107
"settings": {
118
"files.associations": {
12-
"functional": "cpp",
139
"array": "cpp",
14-
"initializer_list": "cpp",
15-
"string_view": "cpp",
16-
"utility": "cpp",
17-
"atomic": "cpp",
18-
"*.tcc": "cpp",
19-
"cctype": "cpp",
20-
"chrono": "cpp",
21-
"clocale": "cpp",
22-
"cmath": "cpp",
23-
"compare": "cpp",
24-
"complex": "cpp",
25-
"concepts": "cpp",
26-
"cstdint": "cpp",
27-
"cstdio": "cpp",
28-
"cstdlib": "cpp",
29-
"ctime": "cpp",
30-
"cwchar": "cpp",
31-
"cwctype": "cpp",
3210
"deque": "cpp",
33-
"unordered_map": "cpp",
34-
"vector": "cpp",
35-
"exception": "cpp",
36-
"iosfwd": "cpp",
37-
"iostream": "cpp",
38-
"istream": "cpp",
39-
"limits": "cpp",
40-
"new": "cpp",
41-
"numbers": "cpp",
42-
"ostream": "cpp",
43-
"ratio": "cpp",
44-
"semaphore": "cpp",
45-
"sstream": "cpp",
46-
"stdexcept": "cpp",
47-
"stop_token": "cpp",
48-
"streambuf": "cpp",
49-
"string": "cpp",
50-
"system_error": "cpp",
51-
"thread": "cpp",
52-
"type_traits": "cpp",
53-
"tuple": "cpp",
54-
"typeinfo": "cpp",
55-
"valarray": "cpp",
56-
"condition_variable": "cpp",
57-
"future": "cpp",
58-
"bitset": "cpp",
59-
"hash_map": "cpp",
60-
"hashtable": "cpp",
61-
"regex": "cpp",
62-
"bufferobject": "cpp",
63-
"image": "cpp",
64-
"mixinvector": "cpp",
65-
"texture": "cpp",
66-
"vertexarraystate": "cpp",
67-
"buffered_value": "cpp",
68-
"fast_back_stack": "cpp",
69-
"random": "cpp",
70-
"vec3b": "cpp",
71-
"vec3i": "cpp",
72-
"vec3s": "cpp",
73-
"vec3ub": "cpp",
74-
"vec3ui": "cpp",
75-
"vec3us": "cpp",
76-
"vec4b": "cpp",
77-
"vec4d": "cpp",
78-
"vec4f": "cpp",
79-
"vec4i": "cpp",
80-
"vec4s": "cpp",
81-
"vec4ub": "cpp",
82-
"vec4ui": "cpp",
83-
"vec4us": "cpp",
84-
"mutex": "cpp",
11+
"forward_list": "cpp",
8512
"list": "cpp",
13+
"string": "cpp",
14+
"unordered_map": "cpp",
8615
"unordered_set": "cpp",
87-
"attributedispatchers": "cpp",
88-
"types": "cpp",
89-
"optional": "cpp",
90-
"variant": "cpp",
91-
"valueobject": "cpp",
92-
"cullsettings": "cpp",
93-
"fstream": "cpp",
94-
"graphicscontext": "cpp",
95-
"object": "cpp",
96-
"operationthread": "cpp",
97-
"stats": "cpp",
98-
"valuemap": "cpp",
99-
"valuestack": "cpp",
100-
"primitiveset": "cpp",
101-
"quat": "cpp",
102-
"vec2d": "cpp",
103-
"vec2f": "cpp",
104-
"vec3d": "cpp",
105-
"vec3f": "cpp",
106-
"matrixd": "cpp",
107-
"matrixf": "cpp",
108-
"plane": "cpp",
109-
"uniform": "cpp",
110-
"vec2b": "cpp",
111-
"vec2i": "cpp",
112-
"vec2s": "cpp",
113-
"vec2ub": "cpp",
114-
"vec2ui": "cpp",
115-
"vec2us": "cpp",
116-
"polytope": "cpp",
117-
"light": "cpp",
118-
"affinity": "cpp",
119-
"program": "cpp",
120-
"cstdarg": "cpp",
121-
"cstddef": "cpp",
122-
"cstring": "cpp",
123-
"iomanip": "cpp",
124-
"memory": "cpp",
125-
"cfenv": "cpp",
126-
"cinttypes": "cpp",
127-
"bit": "cpp",
128-
"map": "cpp",
129-
"set": "cpp",
130-
"algorithm": "cpp",
131-
"iterator": "cpp",
132-
"memory_resource": "cpp",
133-
"numeric": "cpp",
134-
"__bit_reference": "cpp",
135-
"__hash_table": "cpp",
136-
"__split_buffer": "cpp",
137-
"__tree": "cpp",
138-
"filesystem": "cpp",
139-
"*.ipp": "cpp",
140-
"coroutine": "cpp",
141-
"locale": "cpp",
142-
"__functional_base": "cpp",
143-
"__memory": "cpp",
144-
"__locale": "cpp",
145-
"ios": "cpp",
146-
"__string": "cpp",
147-
"notify": "cpp",
148-
"__tuple": "cpp",
149-
"queue": "cpp",
150-
"__mutex_base": "cpp",
151-
"observer_ptr": "cpp",
152-
"export": "cpp",
153-
"viewport": "cpp",
154-
"stateset": "cpp",
155-
"displaysettings": "cpp",
156-
"timer": "cpp",
157-
"forward_list": "cpp",
158-
"ranges": "cpp",
159-
"typeindex": "cpp",
160-
"__config": "cpp",
161-
"__debug": "cpp",
162-
"__errc": "cpp",
163-
"__node_handle": "cpp",
164-
"__nullptr": "cpp",
165-
"__threading_support": "cpp",
166-
"stack": "cpp"
16+
"vector": "cpp",
17+
"string_view": "cpp",
18+
"initializer_list": "cpp",
19+
"regex": "cpp"
16720
}
16821
}
16922
}

0 commit comments

Comments
 (0)