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; }
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; }
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);
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,
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);
}
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;
}
}
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
return 0;
}
if (!(_flags & NoPeakFile)) {
- return initialize_peakfile (_path);
+ return initialize_peakfile (_path, within_session());
} else {
return 0;
}
}
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
}
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;
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);
}
}
/* 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