more work on the suprisingly ongoing filename/path/origin issue

This commit is contained in:
Paul Davis 2013-03-31 09:35:06 -04:00
parent 153e572696
commit 8388e82fd3
5 changed files with 16 additions and 24 deletions

View file

@ -128,7 +128,7 @@ class AudioSource : virtual public Source,
std::string peakpath; std::string peakpath;
std::string _captured_for; std::string _captured_for;
int initialize_peakfile (bool newfile, std::string path); int initialize_peakfile (std::string path);
int build_peaks_from_scratch (); int build_peaks_from_scratch ();
int compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt, int compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
bool force, bool intermediate_peaks_ready_signal); bool force, bool intermediate_peaks_ready_signal);

View file

@ -213,7 +213,7 @@ int
AudioPlaylistSource::setup_peakfile () AudioPlaylistSource::setup_peakfile ()
{ {
_peak_path = Glib::build_filename (_session.session_directory().peak_path(), name() + ARDOUR::peakfile_suffix); _peak_path = Glib::build_filename (_session.session_directory().peak_path(), name() + ARDOUR::peakfile_suffix);
return initialize_peakfile (false, string()); return initialize_peakfile (string());
} }
string string

View file

@ -320,7 +320,7 @@ int
AudioFileSource::setup_peakfile () AudioFileSource::setup_peakfile ()
{ {
if (!(_flags & NoPeakFile)) { if (!(_flags & NoPeakFile)) {
return initialize_peakfile (_origin.empty(), _path); return initialize_peakfile (_path);
} else { } else {
return 0; return 0;
} }

View file

@ -207,7 +207,7 @@ AudioSource::rename_peakfile (string newpath)
} }
int int
AudioSource::initialize_peakfile (bool newfile, string audio_path) AudioSource::initialize_peakfile (string audio_path)
{ {
struct stat statbuf; struct stat statbuf;
@ -215,7 +215,7 @@ AudioSource::initialize_peakfile (bool newfile, string audio_path)
/* if the peak file should be there, but isn't .... */ /* if the peak file should be there, but isn't .... */
if (!newfile && !Glib::file_test (peakpath.c_str(), Glib::FILE_TEST_EXISTS)) { if (!empty() && !Glib::file_test (peakpath.c_str(), Glib::FILE_TEST_EXISTS)) {
peakpath = find_broken_peakfile (peakpath, audio_path); peakpath = find_broken_peakfile (peakpath, audio_path);
} }
@ -269,7 +269,7 @@ AudioSource::initialize_peakfile (bool newfile, string audio_path)
} }
} }
if (!newfile && !_peaks_built && _build_missing_peakfiles && _build_peakfiles) { if (!empty() && !_peaks_built && _build_missing_peakfiles && _build_peakfiles) {
build_peaks_from_scratch (); build_peaks_from_scratch ();
} }

View file

@ -111,28 +111,20 @@ FileSource::init (const string& pathstr, bool must_exist)
{ {
_timeline_position = 0; _timeline_position = 0;
if (!_file_is_new) { cerr << "FileSource looking for " << pathstr << endl;
if (Stateful::loading_state_version < 3000) { if (Stateful::loading_state_version < 3000) {
if (!find_2X (_session, _type, pathstr, must_exist, _file_is_new, _channel, _path)) { if (!find_2X (_session, _type, pathstr, must_exist, _file_is_new, _channel, _path)) {
throw MissingSource (pathstr, _type); throw MissingSource (pathstr, _type);
} }
} else { } else {
string look_for; if (!find (_session, _type, pathstr, must_exist, _file_is_new, _channel, _path)) {
if (!_origin.empty()) {
look_for = _origin;
} else {
look_for = pathstr;
}
if (!find (_session, _type, look_for, must_exist, _file_is_new, _channel, _path)) {
throw MissingSource (pathstr, _type); throw MissingSource (pathstr, _type);
} }
} }
}
set_within_session_from_path (_path); set_within_session_from_path (_path);
_name = Glib::path_get_basename (_path); _name = Glib::path_get_basename (_path);
if (must_exist) { if (must_exist) {