Skip to content

Commit eeaf492

Browse files
committed
doxygen
1 parent 56d5e9a commit eeaf492

File tree

7 files changed

+19
-9
lines changed

7 files changed

+19
-9
lines changed

examples/sandbox/communication/communication-serial-receive/communication-serial-receive.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#define RXD2 16
1616
#define TXD2 17
1717

18-
uint16_t sample_rate = 44100;
18+
uint16_t sample_rate = 28800;
1919
uint8_t channels = 2; // The stream will have 2 channels
2020
I2SStream out;
2121
StreamCopy copier(out, Serial2);

examples/sandbox/communication/communication-serial-send/communication-serial-send.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#define RXD2 16
1616
#define TXD2 17
1717

18-
uint16_t sample_rate = 44100;
18+
uint16_t sample_rate = 28800;
1919
uint8_t channels = 2; // The stream will have 2 channels
2020
SineWaveGenerator<int16_t> sineWave( 32000); // subclass of SoundGenerator with max amplitude of 32000
2121
GeneratedSoundStream<int16_t> sound( sineWave); // Stream generated from sine wave

examples/sandbox/communication/communication-udp-receive/communication-udp-receive.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ void setup() {
2626
Serial.begin(115200);
2727
AudioLogger::instance().begin(Serial, AudioLogger::Info);
2828

29-
3029
// connect to WIFI
3130
WiFi.begin(ssid, password);
3231
while (WiFi.status() != WL_CONNECTED) {

examples/sandbox/communication/communication-udp-send/communication-udp-send.ino

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ uint8_t channels = 2; // The stream will have 2 channels
1818
SineWaveGenerator<int16_t> sineWave( 32000); // subclass of SoundGenerator with max amplitude of 32000
1919
GeneratedSoundStream<int16_t> sound( sineWave); // Stream generated from sine wave
2020
UDPStream udp;
21+
Throttle throttle;
2122
IPAddress udpAddress(192, 168, 1, 255);
2223
const int udpPort = 7000;
2324
StreamCopy copier(udp, sound); // copies sound into i2s
@@ -41,12 +42,18 @@ void setup() {
4142

4243
// Define udp address and port
4344
udp.begin(udpAddress, udpPort);
45+
auto cfg = throttle.defaultConfig();
46+
cfg.channels = channels;
47+
cfg.sample_rate = sample_rate;
48+
throttle.begin(cfg);
4449

4550
// Setup sine wave
4651
sineWave.begin(channels, sample_rate, N_B4);
4752
Serial.println("started...");
4853
}
4954

5055
void loop() {
51-
copier.copy();
56+
throttle.startDelay();
57+
int bytes = copier.copy();
58+
throttle.delayBytes(bytes);
5259
}

src/AudioAnalog/AnalogAudioESP32.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ class AnalogAudioStream : public AudioStreamX {
264264
if (i2s_set_pin(port_no, nullptr) != ESP_OK) LOGE("i2s_set_pin");
265265
if (i2s_set_dac_mode( I2S_DAC_CHANNEL_BOTH_EN) != ESP_OK) LOGE("i2s_set_dac_mode");
266266
if (i2s_set_sample_rates(port_no, cfg.sample_rate) != ESP_OK) LOGE("i2s_set_sample_rates");
267+
//if (i2s_set_clk(port_no, cfg.sample_rate, cfg.bits_per_sample, I2S_CHANNEL_STEREO)) LOGE("i2s_set_clk");
268+
267269
break;
268270

269271
default:

src/AudioLibs/Communication.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,13 @@ class Throttle {
241241
}
242242

243243
// starts the timing
244-
void start() { start_time = millis(); }
244+
void startDelay() { start_time = millis(); }
245245

246246
// delay
247-
void throttle(size_t bytes) { throttleSamples(bytes / bytesPerSample); }
247+
void delayBytes(size_t bytes) { throttleSamples(bytes / bytesPerSample); }
248248

249249
// delay
250-
void throttleSamples(size_t samples) {
250+
void delaySamples(size_t samples) {
251251
int durationMsEff = millis() - start_time;
252252
int durationToBe = (samples * 1000) / info.sample_rate;
253253
int waitMs = durationToBe - durationMsEff + correction_ms;

src/AudioTools/AudioStreams.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,15 +633,17 @@ class VolumeStream : public AudioStreamX {
633633
/// Default Constructor
634634
VolumeStream() = default;
635635

636+
/// Destructor
636637
~VolumeStream() {
637-
cleanup();
638+
cleanup();
638639
};
639640

641+
/// Constructor which assigns Print output
640642
VolumeStream(Print &out) {
641643
setTarget(out);
642644
}
643645

644-
/// Constructor which automatically calls begin(Print out)!
646+
/// Constructor which assigns Stream input or output
645647
VolumeStream(Stream &in) {
646648
setTarget(in);
647649
}

0 commit comments

Comments
 (0)