From 9f63ab9931e6478472853bdda58da47ea29ac125 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 2 Feb 2008 03:57:35 +0000 Subject: Merge with trunk R2978. git-svn-id: svn://localhost/ardour2/branches/3.0@2988 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/audiosource.cc | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'libs/ardour/audiosource.cc') diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index ce8aa95964..80116988d5 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -27,10 +27,12 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -38,6 +40,7 @@ #include #include #include +#include #include "i18n.h" @@ -916,3 +919,50 @@ AudioSource::update_length (nframes_t pos, nframes_t cnt) } } +int +AudioSource::load_transients (const string& path) +{ + ifstream file (path.c_str()); + + if (!file) { + return -1; + } + + transients.clear (); + + stringstream strstr; + double val; + + while (file.good()) { + file >> val; + + if (!file.fail()) { + nframes64_t frame = (nframes64_t) floor (val * _session.frame_rate()); + transients.push_back (frame); + } + } + + return 0; +} + +string +AudioSource::get_transients_path () const +{ + vector parts; + string s; + + /* old sessions may not have the analysis directory */ + + _session.ensure_subdirs (); + + s = _session.analysis_dir (); + parts.push_back (s); + + s = _id.to_s(); + s += '.'; + s += X_("transients"); + parts.push_back (s); + + return Glib::build_filename (parts); +} + -- cgit v1.2.3