Skip to content

Commit

Permalink
Compile error when USE_AUDIO_LOGGING false
Browse files Browse the repository at this point in the history
  • Loading branch information
pschatzmann committed Jul 16, 2024
1 parent c203c08 commit cfa73c3
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/AudioCodecs/AudioEncoded.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
}

Expand All @@ -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
Expand All @@ -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) {
Expand All @@ -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;
}

Expand All @@ -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; }

Expand All @@ -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;
};

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit cfa73c3

Please sign in to comment.