fix file-name reported to analyzer when stem-exporting
[ardour.git] / libs / ardour / audio_playlist_source.cc
index ab98b85010e1b8d46a9cfd7a50f31d8c1f8946de..f77c8b526fe1280582f464495f742e7f4a3107fb 100644 (file)
 #include <glibmm/miscutils.h>
 
 #include "pbd/error.h"
-#include "pbd/convert.h"
-#include "pbd/enumwriter.h"
 
 #include "ardour/audioplaylist.h"
 #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"
-#include "ardour/source_factory.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
@@ -72,6 +67,8 @@ AudioPlaylistSource::AudioPlaylistSource (Session& s, const XMLNode& node)
        if (set_state (node, Stateful::loading_state_version, false)) {
                throw failed_constructor ();
        }
+
+       AudioSource::_length = _playlist_length;
 }
 
 AudioPlaylistSource::~AudioPlaylistSource ()
@@ -111,8 +108,9 @@ AudioPlaylistSource::set_state (const XMLNode& node, int version, bool with_desc
                }
        }
 
-       const XMLProperty* prop;
+       XMLProperty const * prop;
        pair<framepos_t,framepos_t> extent = _playlist->get_extent();
+
        AudioSource::_length = extent.second - extent.first;
 
        if ((prop = node.property (X_("channel"))) == 0) {
@@ -129,11 +127,10 @@ AudioPlaylistSource::set_state (const XMLNode& node, int version, bool with_desc
 framecnt_t
 AudioPlaylistSource::read_unlocked (Sample* dst, framepos_t start, framecnt_t cnt) const
 {
-       boost::shared_ptr<Sample> sbuf;
-       boost::shared_ptr<gain_t> gbuf;
+       boost::shared_array<Sample> sbuf;
+       boost::shared_array<gain_t> gbuf;
        framecnt_t to_read;
        framecnt_t to_zero;
-       pair<framepos_t,framepos_t> extent = _playlist->get_extent();
 
        /* we must be careful not to read beyond the end of our "section" of
         * the playlist, because otherwise we may read data that exists, but
@@ -154,7 +151,7 @@ AudioPlaylistSource::read_unlocked (Sample* dst, framepos_t start, framecnt_t cn
                   with any changes to the list of buffers caused
                   by creating new nested playlists/sources
                */
-               Glib::Mutex::Lock lm (_level_buffer_lock);
+               Glib::Threads::Mutex::Lock lm (_level_buffer_lock);
                sbuf = _mixdown_buffers[_level-1];
                gbuf = _gain_buffers[_level-1];
        }
@@ -169,10 +166,10 @@ AudioPlaylistSource::read_unlocked (Sample* dst, framepos_t start, framecnt_t cn
 }
 
 framecnt_t
-AudioPlaylistSource::write_unlocked (Sample *src, framecnt_t cnt)
+AudioPlaylistSource::write_unlocked (Sample *, framecnt_t)
 {
        fatal << string_compose (_("programming error: %1"), "AudioPlaylistSource::write() called - should be impossible") << endmsg;
-       /*NOTREACHED*/
+       abort(); /*NOTREACHED*/
        return 0;
 }
 
@@ -191,7 +188,7 @@ AudioPlaylistSource::n_channels () const
                return 1;
        }
 
-       boost::shared_ptr<Region> r = _playlist->region_list().front ();
+       boost::shared_ptr<Region> r = _playlist->region_list_property().front ();
        boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r);
 
        return ar->audio_source()->n_channels ();
@@ -206,7 +203,7 @@ AudioPlaylistSource::sample_rate () const
                _session.frame_rate ();
        }
 
-       boost::shared_ptr<Region> r = _playlist->region_list().front ();
+       boost::shared_ptr<Region> r = _playlist->region_list_property().front ();
        boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r);
 
        return ar->audio_source()->sample_rate ();
@@ -215,12 +212,12 @@ AudioPlaylistSource::sample_rate () const
 int
 AudioPlaylistSource::setup_peakfile ()
 {
-       _peak_path = Glib::build_filename (_session.session_directory().peak_path().to_string(), name() + ARDOUR::peakfile_suffix);
-       return initialize_peakfile (false, string());
+       _peak_path = Glib::build_filename (_session.session_directory().peak_path(), name() + ARDOUR::peakfile_suffix);
+       return initialize_peakfile (string());
 }
 
 string
-AudioPlaylistSource::peak_path (string /*audio_path_IGNORED*/)
+AudioPlaylistSource::construct_peak_filepath (const string& /*audio_path_*/, const bool /* in_session */, const bool /* old_peak_name */) const
 {
        return _peak_path;
 }