Skip to content

Commit 2bd8c2a

Browse files
committed
Remove AutoCenter from AnalogAudioStream examples
1 parent 14a50a7 commit 2bd8c2a

File tree

4 files changed

+17
-21
lines changed

4 files changed

+17
-21
lines changed

examples/examples-basic-api/base-adc-a2dp/base-adc-a2dp.ino

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,12 @@
1818

1919
AnalogAudioStream adc;
2020
BluetoothA2DPSource a2dp_source;
21-
// The data has a center of around 26427, so we we need to shift it down to bring the center to 0
22-
ConverterScaler<int16_t> scaler(1.0, -26427, 32700 );
2321

2422
// callback used by A2DP to provide the sound data
2523
int32_t get_sound_data(Frame* frames, int32_t frameCount) {
2624
uint8_t *data = (uint8_t*)frames;
2725
int frameSize = 4;
2826
size_t resultBytes = adc.readBytes(data, frameCount*frameSize);
29-
scaler.convert(data, resultBytes);
3027
return resultBytes/frameSize;
3128
}
3229

examples/examples-stream/streams-adc-i2s/streams-adc-i2s.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ AudioInfo info(44100, 2, 16);
1313
AnalogAudioStream in;
1414
I2SStream out;
1515
StreamCopy copier(out, in); // copy in to out
16-
ConverterAutoCenter converter(info);
1716

1817
// Arduino Setup
1918
void setup(void) {
@@ -34,5 +33,5 @@ void setup(void) {
3433

3534
// Arduino loop - copy data
3635
void loop() {
37-
copier.copy(converter);
36+
copier.copy();
3837
}

examples/examples-stream/streams-memory_mp3-analog/streams-memory_mp3-analog.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* @file stream-memory_mp3-analog.ino
2+
* @file stream-memory_mp3-out.ino
33
* @author Phil Schatzmann
4-
* @brief decode MP3 stream and output as analog signal
4+
* @brief decode MP3 stream and output as out signal
55
* @version 0.1
66
* @date 2021-01-24
77
*
@@ -17,20 +17,20 @@
1717

1818

1919
MemoryStream mp3(BabyElephantWalk60_mp3, BabyElephantWalk60_mp3_len);
20-
AnalogAudioStream analog; // Analog output
21-
EncodedAudioStream out(&analog, new MP3DecoderHelix()); // output to decoder
22-
StreamCopy copier(out, mp3); // copy in to analog
20+
AnalogAudioStream out; // Analog output
21+
EncodedAudioStream out(&out, new MP3DecoderHelix()); // output to decoder
22+
StreamCopy copier(out, mp3); // copy in to out
2323

2424
void setup(){
2525
Serial.begin(115200);
2626
AudioLogger::instance().begin(Serial, AudioLogger::Info);
2727

2828
// update audio info with info from decoder
29-
out.setNotifyAudioChange(analog);
29+
out.setNotifyAudioChange(out);
3030

3131
// begin processing
32-
auto cfg = analog.defaultConfig();
33-
analog.begin(cfg);
32+
auto cfg = out.defaultConfig();
33+
out.begin(cfg);
3434

3535
out.begin();
3636
}
@@ -42,7 +42,7 @@ void loop(){
4242
auto info = out.decoder().audioInfo();
4343
LOGI("The audio rate from the mp3 file is %d", info.sample_rate);
4444
LOGI("The channels from the mp3 file is %d", info.channels);
45-
analog.end();
45+
out.end();
4646
stop();
4747
}
4848
}

examples/examples-stream/streams-url_mp3-analog/streams-url_mp3-analog.ino

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file streams-url_mp3-analog.ino
2+
* @file streams-url_mp3-out.ino
33
* @author Phil Schatzmann
44
* @brief decode MP3 stream from url and output it on I2S
55
* @version 0.1
@@ -15,21 +15,21 @@
1515

1616

1717
URLStream url("ssid","password");
18-
AnalogAudioStream analog; // final output of decoded stream
19-
EncodedAudioStream dec(&analog, new MP3DecoderHelix()); // Decoding stream
18+
AnalogAudioStream out; // final output of decoded stream
19+
EncodedAudioStream dec(&out, new MP3DecoderHelix()); // Decoding stream
2020
StreamCopy copier(dec, url); // copy url to decoder
2121

2222

2323
void setup(){
2424
Serial.begin(115200);
2525
AudioLogger::instance().begin(Serial, AudioLogger::Info);
2626

27-
// setup analog
28-
auto config = analog.defaultConfig(TX_MODE);
29-
analog.begin(config);
27+
// setup out
28+
auto config = out.defaultConfig(TX_MODE);
29+
out.begin(config);
3030

3131
// setup I2S based on sampling rate provided by decoder
32-
dec.setNotifyAudioChange(analog);
32+
dec.setNotifyAudioChange(out);
3333
dec.begin();
3434

3535
// mp3 radio

0 commit comments

Comments
 (0)