diff options
author | Robin Gareus <robin@gareus.org> | 2016-02-15 15:46:49 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-02-15 15:46:49 +0100 |
commit | e6ea35c3de0c234a99443a05a131540dd821487c (patch) | |
tree | 5cc035799079d8c4860b855449b61e23836b7a9e /libs/ardour | |
parent | b9efb2ae21b785ef7273af22df1a8fcad168227f (diff) |
Add normalization gain factor to Export Analysis
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/export_analysis.h | 6 | ||||
-rw-r--r-- | libs/ardour/ardour/export_graph_builder.h | 1 | ||||
-rw-r--r-- | libs/ardour/export_graph_builder.cc | 13 |
3 files changed, 19 insertions, 1 deletions
diff --git a/libs/ardour/ardour/export_analysis.h b/libs/ardour/ardour/export_analysis.h index 8c55edd6ab..c911acf9f0 100644 --- a/libs/ardour/ardour/export_analysis.h +++ b/libs/ardour/ardour/export_analysis.h @@ -37,6 +37,8 @@ namespace ARDOUR { , loudness_hist_max (0) , have_loudness (false) , have_dbtp (false) + , norm_gain_factor (1.0) + , normalized (false) , n_channels (1) { memset (peaks, 0, sizeof(peaks)); @@ -53,6 +55,8 @@ namespace ARDOUR { , loudness_hist_max (other.loudness_hist_max) , have_loudness (other.have_loudness) , have_dbtp (other.have_dbtp) + , norm_gain_factor (other.norm_gain_factor) + , normalized (other.normalized) , n_channels (other.n_channels) { truepeakpos[0] = other.truepeakpos[0]; @@ -71,6 +75,8 @@ namespace ARDOUR { int loudness_hist_max; bool have_loudness; bool have_dbtp; + float norm_gain_factor; + bool normalized; uint32_t n_channels; uint32_t freq[6]; // y-pos, 50, 100, 500, 1k, 5k, 10k [Hz] diff --git a/libs/ardour/ardour/export_graph_builder.h b/libs/ardour/ardour/export_graph_builder.h index 979e3632b9..f2fbbb63fa 100644 --- a/libs/ardour/ardour/export_graph_builder.h +++ b/libs/ardour/ardour/export_graph_builder.h @@ -124,6 +124,7 @@ class LIBARDOUR_API ExportGraphBuilder void add_child (FileSpec const & new_config); void remove_children (bool remove_out_files); bool operator== (FileSpec const & other_config) const; + void set_peak (float); private: typedef boost::shared_ptr<AudioGrapher::SampleFormatConverter<Sample> > FloatConverterPtr; diff --git a/libs/ardour/export_graph_builder.cc b/libs/ardour/export_graph_builder.cc index bdcdf2620e..75587dedae 100644 --- a/libs/ardour/export_graph_builder.cc +++ b/libs/ardour/export_graph_builder.cc @@ -332,6 +332,14 @@ ExportGraphBuilder::SFC::SFC (ExportGraphBuilder &parent, FileSpec const & new_c } } +void +ExportGraphBuilder::SFC::set_peak (float gain) +{ + if (_analyse) { + analyser->set_normalization_gain (gain); + } +} + ExportGraphBuilder::FloatSinkPtr ExportGraphBuilder::SFC::sink () { @@ -476,7 +484,10 @@ ExportGraphBuilder::Normalizer::process() void ExportGraphBuilder::Normalizer::start_post_processing() { - normalizer->set_peak (peak_reader->get_peak()); + const float gain = normalizer->set_peak (peak_reader->get_peak()); + for (boost::ptr_list<SFC>::iterator i = children.begin(); i != children.end(); ++i) { + (*i).set_peak (gain); + } tmp_file->seek (0, SEEK_SET); tmp_file->add_output (normalizer); parent.normalizers.push_back (this); |