#include "ardour/audio_playlist_source.h"
#include "ardour/audioregion.h"
#include "ardour/debug.h"
+#include "ardour/filename_extensions.h"
#include "ardour/session.h"
#include "ardour/session_directory.h"
#include "ardour/session_playlists.h"
using namespace ARDOUR;
using namespace PBD;
-AudioPlaylistSource::AudioPlaylistSource (Session& s, const std::string& name, boost::shared_ptr<AudioPlaylist> p,
+AudioPlaylistSource::AudioPlaylistSource (Session& s, const ID& orig, const std::string& name, boost::shared_ptr<AudioPlaylist> p,
uint32_t chn, frameoffset_t begin, framecnt_t len, Source::Flag flags)
: Source (s, DataType::AUDIO, name)
, AudioSource (s, name)
- , PlaylistSource (s, name, p, DataType::AUDIO, begin, len, flags)
+ , PlaylistSource (s, orig, name, p, DataType::AUDIO, begin, len, flags)
, _playlist_channel (chn)
{
- _peak_path = Glib::build_filename (_session.session_directory().peak_path().to_string(), name);
-
AudioSource::_length = len;
ensure_buffers_for_level (_level);
}
AudioPlaylistSource::AudioPlaylistSource (Session& s, const XMLNode& node)
- : Source (s, DataType::AUDIO, "toBeRenamed")
+ : Source (s, node)
, AudioSource (s, node)
, PlaylistSource (s, node)
{
snprintf (buf, sizeof (buf), "%" PRIu32, _playlist_channel);
node.add_property ("channel", buf);
- node.add_property ("peak-path", _peak_path);
return node;
}
sscanf (prop->value().c_str(), "%" PRIu32, &_playlist_channel);
- if ((prop = node.property (X_("peak-path"))) == 0) {
- throw failed_constructor ();
- }
-
- _peak_path = prop->value ();
-
ensure_buffers_for_level (_level);
return 0;
int
AudioPlaylistSource::setup_peakfile ()
{
- /* the peak data is setup once and once only
- */
-
- if (!Glib::file_test (_peak_path, Glib::FILE_TEST_EXISTS)) {
- /* the 2nd argument here will be passed
- in to ::peak_path, and is irrelevant
- since our peak file path is fixed and
- not dependent on anything.
- */
- return initialize_peakfile (false, string());
- }
-
- return 0;
+ _peak_path = Glib::build_filename (_session.session_directory().peak_path().to_string(), name() + ARDOUR::peakfile_suffix);
+ return initialize_peakfile (false, string());
}
string
-AudioPlaylistSource::peak_path (string /*audio_path*/)
+AudioPlaylistSource::peak_path (string /*audio_path_IGNORED*/)
{
return _peak_path;
}