PluginInfo::type added to copy constructor. But why is the copy constructor defined...
[ardour.git] / libs / ardour / audio_playlist.cc
index eefbeb7889c6a18756e8418ec79406fcafe2a173..c883856cf842d30dcf08e9459cc1404054bd82bb 100644 (file)
@@ -15,7 +15,6 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id$
 */
 
 #include <algorithm>
@@ -31,6 +30,7 @@
 #include <ardour/crossfade.h>
 #include <ardour/crossfade_compare.h>
 #include <ardour/session.h>
+#include <pbd/enumwriter.h>
 
 #include "i18n.h"
 
@@ -152,11 +152,18 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nf
        skip_frames = 0;
        _read_data_count = 0;
 
+       RegionList* rlist = regions_to_read (start, start+cnt);
+
+       if (rlist->empty()) {
+               delete rlist;
+               return cnt;
+       }
+
        map<uint32_t,vector<boost::shared_ptr<Region> > > relevant_regions;
        map<uint32_t,vector<boost::shared_ptr<Crossfade> > > relevant_xfades;
        vector<uint32_t> relevant_layers;
 
-       for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
+       for (RegionList::iterator i = rlist->begin(); i != rlist->end(); ++i) {
                if ((*i)->coverage (start, end) != OverlapNone) {
                        relevant_regions[(*i)->layer()].push_back (*i);
                        relevant_layers.push_back ((*i)->layer());
@@ -201,6 +208,7 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nf
                }
        }
 
+       delete rlist;
        return ret;
 }
 
@@ -273,11 +281,12 @@ AudioPlaylist::refresh_dependents (boost::shared_ptr<Region> r)
 
                if ((*x)->involves (ar)) {
 
-                       if (find (updated.begin(), updated.end(), *x) == updated.end()) {
+                       pair<set<boost::shared_ptr<Crossfade> >::iterator, bool> const u = updated.insert (*x);
+
+                       if (u.second) {
+                               /* x was succesfully inserted into the set, so it has not already been updated */
                                try { 
-                                       if ((*x)->refresh ()) {
-                                               updated.insert (*x);
-                                       }
+                                       (*x)->refresh ();
                                }
 
                                catch (Crossfade::NoCrossfadeHere& err) {
@@ -380,10 +389,15 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
                        top = other;
                        bottom = region;
                }
+               
+               if (!(top->opaque())) {
+                       continue;
+               }
+
 
 
                OverlapType c = top->coverage (bottom->position(), bottom->last_frame());
-               
+
                try {
                        switch (c) {
                        case OverlapNone:
@@ -412,7 +426,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
                                
                                xfade = boost::shared_ptr<Crossfade> (new Crossfade (top, bottom, xfade_length, top->first_frame(), StartOfIn));
                                add_crossfade (xfade);
-                               
+
                                if (top_region_at (top->last_frame() - 1) == top) {
                                        /* 
                                           only add a fade out if there is no region on top of the end of 'top' (which