summaryrefslogtreecommitdiff
path: root/libs/ardour/session_state.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-12-27 18:33:41 +0100
committerRobin Gareus <robin@gareus.org>2016-12-27 18:33:41 +0100
commitfe01666475187e996bc1c37f69c691b433984211 (patch)
treeb00fd0f0b152f6ecd706c7c0a64cc7c3c7322695 /libs/ardour/session_state.cc
parent54a79639df0a72afaf26ed914901688ecdac8ed4 (diff)
Normalize audio when archiving to fixed-point format.
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r--libs/ardour/session_state.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index c9c687fcdd..506bc58fdf 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -5075,6 +5075,7 @@ Session::archive_session (const std::string& dest,
blacklist_dirs.push_back (string (plugins_dir_name) + G_DIR_SEPARATOR);
std::map<boost::shared_ptr<AudioFileSource>, std::string> orig_sources;
+ std::map<boost::shared_ptr<AudioFileSource>, float> orig_gain;
set<boost::shared_ptr<Source> > sources_used_by_this_snapshot;
if (only_used_sources) {
@@ -5141,6 +5142,7 @@ Session::archive_session (const std::string& dest,
}
orig_sources[afs] = afs->path();
+ orig_gain[afs] = afs->gain();
std::string new_path = make_new_media_path (afs->path (), to_dir, name);
new_path = Glib::build_filename (Glib::path_get_dirname (new_path), PBD::basename_nosuffix (new_path) + ".flac");
@@ -5153,6 +5155,7 @@ Session::archive_session (const std::string& dest,
try {
SndFileSource* ns = new SndFileSource (*this, *(afs.get()), new_path, compress_audio == FLAC_16BIT, progress);
afs->replace_file (new_path);
+ afs->set_gain (ns->gain(), true);
delete ns;
} catch (...) {
cerr << "failed to encode " << afs->path() << " to " << new_path << "\n";
@@ -5279,6 +5282,9 @@ Session::archive_session (const std::string& dest,
for (std::map<boost::shared_ptr<AudioFileSource>, std::string>::iterator i = orig_sources.begin (); i != orig_sources.end (); ++i) {
i->first->replace_file (i->second);
}
+ for (std::map<boost::shared_ptr<AudioFileSource>, float>::iterator i = orig_gain.begin (); i != orig_gain.end (); ++i) {
+ i->first->set_gain (i->second, true);
+ }
int rv = ar.create (filemap);
remove_directory (to_dir);