add dependents to a compound playlist before creating a source from it, so that the...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 30 May 2011 13:23:19 +0000 (13:23 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 30 May 2011 13:23:19 +0000 (13:23 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@9631 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/audio_playlist.cc
libs/ardour/audiosource.cc
libs/ardour/crossfade.cc
libs/ardour/playlist.cc

index 7e60930e2d4b18cefc7b3474363f792bc48d0194..55a3733d5415d9a990a2570cb329fd6c320d4c78 100644 (file)
@@ -269,6 +269,9 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, fr
 {
        framecnt_t ret = cnt;
 
+       DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("Playlist %1 read @ %2 for %3, channel %4, regions %5 xfades %6\n",
+                                                          name(), start, cnt, chan_n, regions.size(), _crossfades.size()));
+
        /* optimizing this memset() away involves a lot of conditionals
           that may well cause more of a hit due to cache misses
           and related stuff than just doing this here.
@@ -315,9 +318,15 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, fr
                 }
        }
 
+       DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("Checking %1 xfades\n", _crossfades.size()));
+
        for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) {
+               DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("%1 check xfade between %2 and %3 ...\n",
+                                                                  name(), (*i)->out()->name(), (*i)->in()->name()));
                if ((*i)->coverage (start, end) != OverlapNone) {
                        relevant_xfades[(*i)->upper_layer()].push_back (*i);
+                       DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("\t\txfade is relevant, place on layer %1\n",
+                                                                          (*i)->upper_layer()));
                }
        }
 
@@ -334,6 +343,8 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, fr
 
        for (vector<uint32_t>::iterator l = relevant_layers.begin(); l != relevant_layers.end(); ++l) {
 
+               DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("read for layer %1\n", *l));
+
                vector<boost::shared_ptr<Region> > r (relevant_regions[*l]);
                vector<boost::shared_ptr<Crossfade> >& x (relevant_xfades[*l]);
 
@@ -347,6 +358,7 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, fr
                }
 
                for (vector<boost::shared_ptr<Crossfade> >::iterator i = x.begin(); i != x.end(); ++i) {
+                        DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("read from xfade between %1 & %2\n", (*i)->out()->name(), (*i)->in()->name()));
                        (*i)->read_at (buf, mixdown_buffer, gain_buffer, start, cnt, chan_n);
 
                        /* don't JACK up _read_data_count, since its the same data as we just
index de6c5edfec9e5d781f4a663648c9227a84812431..037352e9fd61a4f10061fdf47b9711eed2b8015a 100644 (file)
@@ -670,6 +670,7 @@ AudioSource::build_peaks_from_scratch ()
                        framecnt_t frames_to_read = min (bufsize, cnt);
                        framecnt_t frames_read;
 
+
                        if ((frames_read = read_unlocked (buf, current_frame, frames_to_read)) != frames_to_read) {
                                error << string_compose(_("%1: could not write read raw data for peak computation (%2)"), _name, strerror (errno)) << endmsg;
                                done_with_peakfile_writes (false);
@@ -1002,8 +1003,6 @@ AudioSource::ensure_buffers_for_level_locked (uint32_t level, framecnt_t frame_r
        _mixdown_buffers.clear ();
        _gain_buffers.clear ();
 
-       cerr << "Allocating nested buffers for level " << level << endl;
-
        while (_mixdown_buffers.size() < level) {
                _mixdown_buffers.push_back (boost::shared_ptr<Sample> (new Sample[nframes]));
                _gain_buffers.push_back (boost::shared_ptr<gain_t> (new gain_t[nframes]));
index 302b19399e7d34fcc10ecf2b4f6f0544a2db698d..57a767ee7ad3460bbdf95b8f3590d563b0529d38 100644 (file)
@@ -17,9 +17,6 @@
 
 */
 
-
-#include "pbd/stacktrace.h"
-
 #include "ardour/debug.h"
 #include "ardour/types.h"
 #include "ardour/crossfade.h"
index a396732d56956706e9cc5b00a0a224ef39717aa9..1086163fb0cccce6e4ec346e8746c568e53faca9 100644 (file)
@@ -265,8 +265,6 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, framepos_t start, f
 
        in_set_state--;
        first_set_state = false;
-
-       /* this constructor does NOT notify others (session) */
 }
 
 void
@@ -807,6 +805,7 @@ Playlist::add_region_internal (boost::shared_ptr<Region> region, framepos_t posi
 
        notify_region_added (region);
 
+
        if (!holding_state ()) {
 
                check_dependents (region, false);
@@ -3127,6 +3126,10 @@ Playlist::combine (const RegionList& r)
 
        pre_combine (copies);
 
+       /* add any dependent regions to the new playlist */
+
+       copy_dependents (old_and_new_regions, pl);
+
        /* now create a new PlaylistSource for each channel in the new playlist */
 
        SourceList sources;
@@ -3134,6 +3137,7 @@ Playlist::combine (const RegionList& r)
        
        for (uint32_t chn = 0; chn < channels; ++chn) {
                sources.push_back (SourceFactory::createFromPlaylist (_type, _session, pl, id(), parent_name, chn, 0, extent.second, false, false));
+       
        }
        
        /* now a new whole-file region using the list of sources */
@@ -3157,10 +3161,6 @@ Playlist::combine (const RegionList& r)
 
        boost::shared_ptr<Region> compound_region = RegionFactory::create (parent_region, plist, true);
 
-       /* add any dependent regions to the new playlist */
-
-       copy_dependents (old_and_new_regions, pl);
-
        /* remove all the selected regions from the current playlist
         */