install and use a global audioLogger instead of Serial (#198)

* use of global audioLogger-> instead of Serial.

* default to silence

* initialize logger in examples
This commit is contained in:
david gauchard authored and Earle F. Philhower, III committed 2019-07-24 10:02:21 -07:00
1 parent 598163dd59
commit 4fed6a230f
25 files changed
+74 -31

No files matched your search

+4 -4
View File
@@ -34,13 +34,13 @@ AudioGeneratorAAC::AudioGeneratorAAC()
buff = (uint8_t*)malloc(buffLen);
outSample = (int16_t*)malloc(1024 * 2 * sizeof(uint16_t));
if (!buff || !outSample) {
Serial.printf_P(PSTR("ERROR: Out of memory in AAC\n"));
audioLogger->printf_P(PSTR("ERROR: Out of memory in AAC\n"));
Serial.flush();
}
hAACDecoder = AACInitDecoder();
if (!hAACDecoder) {
Serial.printf_P(PSTR("Out of memory error! hAACDecoder==NULL\n"));
audioLogger->printf_P(PSTR("Out of memory error! hAACDecoder==NULL\n"));
Serial.flush();
}
@@ -69,12 +69,12 @@ AudioGeneratorAAC::AudioGeneratorAAC(void *preallocateData, int preallocateSz)
int used = p - (uint8_t*)preallocateSpace;
int availSpace = preallocateSize - used;
if (availSpace < 0 ) {
Serial.printf_P(PSTR("ERROR: Out of memory in AAC\n"));
audioLogger->printf_P(PSTR("ERROR: Out of memory in AAC\n"));
}
hAACDecoder = AACInitDecoderPre(p, availSpace);
if (!hAACDecoder) {
Serial.printf_P(PSTR("Out of memory error! hAACDecoder==NULL\n"));
audioLogger->printf_P(PSTR("Out of memory error! hAACDecoder==NULL\n"));
Serial.flush();
}
buffValid = 0;