use FileSource::within_session() for peak-files
This commit is contained in:
parent
b3e8495662
commit
a86aa9e5bc
@ -37,7 +37,7 @@ public:
|
||||
virtual ~AudioPlaylistSource ();
|
||||
|
||||
bool empty() const;
|
||||
std::string construct_peak_filepath (const std::string& audio_path, bool oldformat = false) const;
|
||||
std::string construct_peak_filepath (const std::string& audio_path, const bool in_session = false, const bool old_peak_name = false) const;
|
||||
uint32_t n_channels() const;
|
||||
bool clamped_at_unity () const { return false; }
|
||||
|
||||
|
@ -39,7 +39,7 @@ class LIBARDOUR_API AudioFileSource : public AudioSource, public FileSource {
|
||||
public:
|
||||
virtual ~AudioFileSource ();
|
||||
|
||||
std::string construct_peak_filepath (const std::string& audio_filepath, bool oldformat = false) const;
|
||||
std::string construct_peak_filepath (const std::string& audio_path, const bool in_session = false, const bool old_peak_name = false) const;
|
||||
|
||||
static void set_peak_dir (const std::string& dir) { peak_dir = dir; }
|
||||
|
||||
|
@ -126,7 +126,7 @@ class LIBARDOUR_API AudioSource : virtual public Source,
|
||||
std::string _peakpath;
|
||||
std::string _captured_for;
|
||||
|
||||
int initialize_peakfile (const std::string& path);
|
||||
int initialize_peakfile (const std::string& path, const bool in_session = false);
|
||||
int build_peaks_from_scratch ();
|
||||
int compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
|
||||
bool force, bool intermediate_peaks_ready_signal);
|
||||
@ -136,7 +136,7 @@ class LIBARDOUR_API AudioSource : virtual public Source,
|
||||
|
||||
virtual framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const = 0;
|
||||
virtual framecnt_t write_unlocked (Sample *dst, framecnt_t cnt) = 0;
|
||||
virtual std::string construct_peak_filepath(const std::string& audio_filepath, bool oldformat = false) const = 0;
|
||||
virtual std::string construct_peak_filepath (const std::string& audio_path, const bool in_session = false, const bool old_peak_name = false) const = 0;
|
||||
|
||||
virtual int read_peaks_with_fpp (PeakData *peaks,
|
||||
framecnt_t npeaks, framepos_t start, framecnt_t cnt,
|
||||
|
@ -210,7 +210,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
|
||||
std::string plugins_dir () const; ///< Plugin state
|
||||
std::string externals_dir () const; ///< Links to external files
|
||||
|
||||
std::string construct_peak_filepath (const std::string&, bool oldformat = false) const;
|
||||
std::string construct_peak_filepath (const std::string& audio_path, const bool in_session = false, const bool old_peak_name = false) const;
|
||||
|
||||
bool audio_source_name_is_unique (const std::string& name);
|
||||
std::string format_audio_source_name (const std::string& legalized_base, uint32_t nchan, uint32_t chan, bool destructive, bool take_required, uint32_t cnt, bool related_exists);
|
||||
|
@ -217,7 +217,7 @@ AudioPlaylistSource::setup_peakfile ()
|
||||
}
|
||||
|
||||
string
|
||||
AudioPlaylistSource::construct_peak_filepath (const string& /*audio_path_IGNORED*/, bool /* oldformat IGNORED*/) const
|
||||
AudioPlaylistSource::construct_peak_filepath (const string& /*audio_path_*/, const bool /* in_session */, const bool /* old_peak_name */) const
|
||||
{
|
||||
return _peak_path;
|
||||
}
|
||||
|
@ -164,17 +164,17 @@ AudioFileSource::init (const string& pathstr, bool must_exist)
|
||||
}
|
||||
|
||||
string
|
||||
AudioFileSource::construct_peak_filepath (const string& audio_path, bool oldformat) const
|
||||
AudioFileSource::construct_peak_filepath (const string& audio_path, const bool in_session, const bool old_peak_name) const
|
||||
{
|
||||
string base;
|
||||
if (oldformat) {
|
||||
if (old_peak_name) {
|
||||
base = audio_path.substr (0, audio_path.find_last_of ('.'));
|
||||
} else {
|
||||
base = audio_path;
|
||||
}
|
||||
base += '%';
|
||||
base += (char) ('A' + _channel);
|
||||
return _session.construct_peak_filepath (base, oldformat);
|
||||
return _session.construct_peak_filepath (base, in_session, old_peak_name);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -270,7 +270,7 @@ AudioFileSource::setup_peakfile ()
|
||||
return 0;
|
||||
}
|
||||
if (!(_flags & NoPeakFile)) {
|
||||
return initialize_peakfile (_path);
|
||||
return initialize_peakfile (_path, within_session());
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -237,14 +237,14 @@ AudioSource::rename_peakfile (string newpath)
|
||||
}
|
||||
|
||||
int
|
||||
AudioSource::initialize_peakfile (const string& audio_path)
|
||||
AudioSource::initialize_peakfile (const string& audio_path, const bool in_session)
|
||||
{
|
||||
GStatBuf statbuf;
|
||||
|
||||
_peakpath = construct_peak_filepath (audio_path);
|
||||
_peakpath = construct_peak_filepath (audio_path, in_session);
|
||||
|
||||
if (!empty() && !Glib::file_test (_peakpath.c_str(), Glib::FILE_TEST_EXISTS)) {
|
||||
string oldpeak = construct_peak_filepath (audio_path, true);
|
||||
string oldpeak = construct_peak_filepath (audio_path, in_session, true);
|
||||
DEBUG_TRACE(DEBUG::Peaks, string_compose ("Looking for old peak file %1 for Audio file %2\n", oldpeak, audio_path));
|
||||
if (Glib::file_test (oldpeak.c_str(), Glib::FILE_TEST_EXISTS)) {
|
||||
// TODO use hard-link if possible
|
||||
|
@ -4374,7 +4374,7 @@ peak_file_helper (const string& peak_path, const string& file_path, const string
|
||||
}
|
||||
|
||||
string
|
||||
Session::construct_peak_filepath (const string& filepath, bool oldformat) const
|
||||
Session::construct_peak_filepath (const string& filepath, const bool in_session, const bool old_peak_name) const
|
||||
{
|
||||
string interchange_dir_string = string (interchange_dir_name) + G_DIR_SEPARATOR;
|
||||
|
||||
@ -4407,7 +4407,7 @@ Session::construct_peak_filepath (const string& filepath, bool oldformat) const
|
||||
|
||||
if (in_another_session) {
|
||||
SessionDirectory sd (session_path);
|
||||
return peak_file_helper (sd.peak_path(), "", Glib::path_get_basename (filepath), !oldformat);
|
||||
return peak_file_helper (sd.peak_path(), "", Glib::path_get_basename (filepath), !old_peak_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4421,11 +4421,11 @@ Session::construct_peak_filepath (const string& filepath, bool oldformat) const
|
||||
|
||||
/* 2) if the file is outside our session dir:
|
||||
* (imported but not copied) add the path for check-summming */
|
||||
if (filepath.find (interchange_dir_string) == string::npos) {
|
||||
if (!in_session) {
|
||||
path = Glib::path_get_dirname (filepath);
|
||||
}
|
||||
|
||||
return peak_file_helper (_session_dir->peak_path(), path, Glib::path_get_basename (filepath), !oldformat);
|
||||
return peak_file_helper (_session_dir->peak_path(), path, Glib::path_get_basename (filepath), !old_peak_name);
|
||||
}
|
||||
|
||||
string
|
||||
|
Loading…
Reference in New Issue
Block a user