remove absurd internal Crossfade constructor that confused region start and region...
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 20 Oct 2011 21:17:25 +0000 (21:17 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 20 Oct 2011 21:17:25 +0000 (21:17 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@10259 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/crossfade.h
libs/ardour/audio_playlist.cc
libs/ardour/audioregion.cc
libs/ardour/crossfade.cc

index 11bea700de5f071a6c21251fdd13b262c43cf94e..20bbcccdf53db2938ca8b73c2ecbd7cd6083a3e2 100644 (file)
@@ -59,7 +59,6 @@ class Crossfade : public ARDOUR::AudioRegion
        /* constructor for "fixed" xfades at each end of an internal overlap */
 
        Crossfade (boost::shared_ptr<ARDOUR::AudioRegion> in, boost::shared_ptr<ARDOUR::AudioRegion> out,
-                  framepos_t position,
                   framecnt_t initial_length,
                   AnchorPoint);
 
@@ -114,10 +113,6 @@ class Crossfade : public ARDOUR::AudioRegion
 
        PBD::Signal1<void,boost::shared_ptr<Region> > Invalidated;
 
-       bool covers (framepos_t frame) const {
-               return _position <= frame && frame < _position + _length;
-       }
-
        OverlapType coverage (framepos_t start, framepos_t end) const;
 
        static void set_buffer_size (framecnt_t);
index af075608adf990c4b29df7419ca20c0c1de02655..094191084d9c78da818e540e3e5255b8be35a971 100644 (file)
@@ -311,12 +311,14 @@ 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()));
+               DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("%1 check xfade between %2 and %3 ... [ %4 ... %5 | %6 ... %7]\n",
+                                                                  name(), (*i)->out()->name(), (*i)->in()->name(), 
+                                                                  (*i)->first_frame(), (*i)->last_frame(),
+                                                                  start, end));
                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()));
+                       DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("\t\txfade is relevant (coverage = %2), place on layer %1\n",
+                                                                          (*i)->upper_layer(), enum_2_string ((*i)->coverage (start, end))));
                }
        }
 
@@ -579,7 +581,8 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
 
                                if (top_region_at (top->first_frame()) == top) {
 
-                                       xfade = boost::shared_ptr<Crossfade> (new Crossfade (top, bottom, xfade_length, top->first_frame(), StartOfIn));
+                                       xfade = boost::shared_ptr<Crossfade> (new Crossfade (top, bottom, xfade_length, StartOfIn));
+                                       xfade->set_position (top->first_frame());
                                        add_crossfade (xfade);
                                }
 
@@ -590,7 +593,8 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
                                           would cover it).
                                        */
 
-                                       xfade = boost::shared_ptr<Crossfade> (new Crossfade (bottom, top, xfade_length, top->last_frame() - xfade_length, EndOfOut));
+                                       xfade = boost::shared_ptr<Crossfade> (new Crossfade (bottom, top, xfade_length, EndOfOut));
+                                       xfade->set_position (top->last_frame() - xfade_length);
                                        add_crossfade (xfade);
                                }
                                break;
index 5d9935935eaa55a72caf9d788a304a92c0e57e40..e2a6694917e39e69d796bf282be8cb9556b08580 100644 (file)
@@ -402,12 +402,7 @@ AudioRegion::_read_at (const SourceList& srcs, framecnt_t limit,
                /* if this fails then the requested section is entirely
                   before the position of this region 
                */
-               if (cnt < buf_offset) {
-                       error << "trying to read region " << name() << " @ " << position << " which is outside region bounds " 
-                             << _position << " .. " << last_frame() << " (len = " << length() << ')'
-                             << endmsg;
-                       return 0; // read nothing
-               }
+               assert (cnt >= buf_offset);
                cnt -= buf_offset;
        } else {
                internal_offset = position - _position;
index f06fcfb280bb7144bbb5a5c79e52aef7a2794565..b2301b7167bed7cfb12208277e041bcf1e72c713 100644 (file)
@@ -85,9 +85,8 @@ Crossfade::operator== (const Crossfade& other)
 
 Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<AudioRegion> out,
                      framecnt_t length,
-                     framepos_t position,
                      AnchorPoint ap)
-       : AudioRegion (in->session(), position, length, in->name() + string ("<>") + out->name())
+       : AudioRegion (in->session(), 0, length, in->name() + string ("<>") + out->name())
        , CROSSFADE_DEFAULT_PROPERTIES
        , _fade_in (Evoral::Parameter(FadeInAutomation)) // linear (gain coefficient) => -inf..+6dB
        , _fade_out (Evoral::Parameter(FadeOutAutomation)) // linear (gain coefficient) => -inf..+6dB