Skip to content

Commit eff1536

Browse files
committed
rename writeCodecConfig to setCodecConfig
1 parent 514309d commit eff1536

File tree

4 files changed

+229
-74
lines changed

4 files changed

+229
-74
lines changed

examples/tests/codecs/test-codec-alac/test-codec-alac.ino

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313

1414
SET_LOOP_TASK_STACK_SIZE(16*1024); // 16KB
1515

16-
AudioInfo info(8000, 1, 16);
16+
AudioInfo info(44100, 2, 16);
1717
SineWaveGenerator<int16_t> sineWave( 32000); // subclass of SoundGenerator with max amplitude of 32000
1818
GeneratedSoundStream<int16_t> sound( sineWave); // Stream generated from sine wave
1919
AudioBoardStream out(AudioKitEs8388V1);
2020
//I2SStream out;
2121
//CsvOutput<int16_t> out(Serial);
22-
EncoderALAC enc_alac(1024 * 4);
22+
EncoderALAC enc_alac;
2323
DecoderALAC dec_alac;
24+
CodecNOP dec_nop;
2425
EncodedAudioStream decoder(&out, &dec_alac); // encode and write
2526
EncodedAudioStream encoder(&decoder, &enc_alac); // encode and write
2627
StreamCopy copier(encoder, sound);
@@ -42,10 +43,12 @@ void setup() {
4243
encoder.begin(info);
4344

4445
// start decoder
45-
decoder.begin();
46+
decoder.begin(info);
4647

47-
// copy config from encoder to decoder
48-
dec_alac.writeCodecInfo(enc_alac.config());
48+
// optionally copy config from encoder to decoder
49+
// since decoder already has audio info and frames
50+
// dec_alac.setCodecConfig(enc_alac.config());
51+
// dec_alac.setCodecConfig(enc_alac.binaryConfig());
4952

5053
Serial.println("Test started...");
5154
}

src/AudioTools/AudioCodecs/AudioCodecsBase.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ class AudioDecoder : public AudioWriter, public AudioInfoSource {
6666
}
6767

6868
/// Some decoders need e.g. a magic cookie to provide the relevant info for decoding
69-
virtual size_t writeCodecConfig(const uint8_t* data, size_t len){
69+
virtual bool setCodecConfig(const uint8_t* data, size_t len){
7070
LOGE("not implemented");
71-
return 0;
71+
return false;
7272
}
7373

7474
protected:

0 commit comments

Comments
 (0)