diff --git a/src/AudioCodecs/AudioEncoded.h b/src/AudioCodecs/AudioEncoded.h index 034854bfb6..67c936e75e 100644 --- a/src/AudioCodecs/AudioEncoded.h +++ b/src/AudioCodecs/AudioEncoded.h @@ -137,7 +137,9 @@ class EncodedAudioOutput : public ModifyingOutput { /// Starts the processing - sets the status to active bool begin() override { +#if USE_AUDIO_LOGGING custom_log_level.set(); +#endif TRACED(); if (!active) { TRACED(); @@ -150,7 +152,9 @@ class EncodedAudioOutput : public ModifyingOutput { LOGW("no decoder or encoder defined"); } } +#if USE_AUDIO_LOGGING custom_log_level.reset(); +#endif return active; } @@ -162,12 +166,16 @@ class EncodedAudioOutput : public ModifyingOutput { /// Ends the processing void end() override { +#if USE_AUDIO_LOGGING custom_log_level.set(); +#endif TRACEI(); decoder_ptr->end(); encoder_ptr->end(); active = false; +#if USE_AUDIO_LOGGING custom_log_level.reset(); +#endif } /// encoder decode the data @@ -176,7 +184,9 @@ class EncodedAudioOutput : public ModifyingOutput { //LOGI("write: %d", 0); return 0; } +#if USE_AUDIO_LOGGING custom_log_level.set(); +#endif LOGD("EncodedAudioOutput::write: %d", (int)len); if (writer_ptr == nullptr || data == nullptr) { @@ -190,8 +200,9 @@ class EncodedAudioOutput : public ModifyingOutput { size_t result = writer_ptr->write(data, len); LOGD("EncodedAudioOutput::write: %d -> %d", (int)len, (int)result); +#if USE_AUDIO_LOGGING custom_log_level.reset(); - +#endif return result; } @@ -209,8 +220,10 @@ class EncodedAudioOutput : public ModifyingOutput { /// Provides the initialized encoder AudioEncoder &encoder() { return *encoder_ptr; } +#if USE_AUDIO_LOGGING /// Defines the class specific custom log level void setLogLevel(AudioLogger::LogLevel level) { custom_log_level.set(level); } +#endif /// Is Available for Write check activated ? bool isCheckAvailableForWrite() { return check_available_for_write; } @@ -225,7 +238,9 @@ class EncodedAudioOutput : public ModifyingOutput { Print *ptr_out = nullptr; bool active = false; bool check_available_for_write = false; +#if USE_AUDIO_LOGGING CustomLogLevel custom_log_level; +#endif int frame_size = DEFAULT_BUFFER_SIZE; }; @@ -362,8 +377,10 @@ class EncodedAudioStream : public ReformatBaseStream { float getByteFactor() { return 1.0f; } - /// Defines the class specific custom log level +#if USE_AUDIO_LOGGING + /// Defines the class specific custom log level void setLogLevel(AudioLogger::LogLevel level) { enc_out.setLogLevel(level); } +#endif protected: EncodedAudioOutput enc_out;