Permalink
Browse files

o Log clipping even if we pass on the processor.

  • Loading branch information...
1 parent 1113409 commit fb3fb9a90d6e917f14331f0a95d835b735f1af06 @hzeller committed Sep 21, 2012
Showing with 13 additions and 5 deletions.
  1. +7 −4 folve-filesystem.cc
  2. +5 −1 sound-processor.cc
  3. +1 −0 sound-processor.h
View
@@ -416,6 +416,7 @@ class SndFileHandler :
processor_->WriteProcessed(snd_out_, r);
if (passed_processor) {
base_stats_.out_gapless = true;
+ LogClipping();
processor_ = NULL; // we handed over ownership.
}
if (next_file) fs_->Close(found->c_str(), next_file);
@@ -498,16 +499,18 @@ class SndFileHandler :
}
}
- void Close() {
- if (snd_out_ == NULL) return; // done.
+ void LogClipping() {
if (processor_ && processor_->max_output_value() > 1.0) {
- // TODO(hzeller): move this somewhere else if we pass on the processor
- // for gapless.
syslog(LOG_ERR, "Observed output clipping (%s). "
"Max=%.3f; Multiply gain with <= %.5f in %s",
base_stats_.filename.c_str(), processor_->max_output_value(),
1.0 / processor_->max_output_value(), config_path_.c_str());
+ processor_->ResetMaxValues();
}
+ }
+ void Close() {
+ if (snd_out_ == NULL) return; // done.
+ LogClipping();
// We can't disable buffer writes here, because outfile closing will flush
// the last couple of sound samples.
if (snd_in_) sf_close(snd_in_);
View
@@ -103,10 +103,14 @@ void SoundProcessor::Process() {
output_pos_ = 0;
}
+void SoundProcessor::ResetMaxValues() {
+ max_out_value_observed_ = 0.0;
+}
+
void SoundProcessor::Reset() {
zita_config_.convproc->reset();
input_pos_ = 0;
output_pos_ = -1;
- max_out_value_observed_ = 0.0;
+ ResetMaxValues();
zita_config_.convproc->start_process(0, 0);
}
View
@@ -55,6 +55,7 @@ class SoundProcessor {
// Maximum absolute output value observe (>= 0.0).
float max_output_value() const { return max_out_value_observed_; }
+ void ResetMaxValues();
private:
SoundProcessor(const ZitaConfig &config);

0 comments on commit fb3fb9a

Please sign in to comment.