along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id$
*/
#include <algorithm>
#include <ardour/crossfade.h>
#include <ardour/crossfade_compare.h>
#include <ardour/session.h>
+#include <pbd/enumwriter.h>
#include "i18n.h"
using namespace PBD;
AudioPlaylist::AudioPlaylist (Session& session, const XMLNode& node, bool hidden)
- : Playlist (session, node, hidden)
+ : Playlist (session, node, DataType::AUDIO, hidden)
{
+ const XMLProperty* prop = node.property("type");
+ assert(!prop || DataType(prop->value()) == DataType::AUDIO);
+
in_set_state++;
set_state (node);
in_set_state--;
}
AudioPlaylist::AudioPlaylist (Session& session, string name, bool hidden)
- : Playlist (session, name, hidden)
+ : Playlist (session, name, DataType::AUDIO, hidden)
{
}
if ((*xfades)->out() == ar2) {
boost::shared_ptr<AudioRegion>in = boost::dynamic_pointer_cast<AudioRegion>(*in_n);
boost::shared_ptr<AudioRegion>out = boost::dynamic_pointer_cast<AudioRegion>(*out_n);
- boost::shared_ptr<Crossfade> new_fade = boost::shared_ptr<Crossfade> (new Crossfade (*(*xfades), in, out));
+ boost::shared_ptr<Crossfade> new_fade = boost::shared_ptr<Crossfade> (new Crossfade (*xfades, in, out));
add_crossfade(new_fade);
break;
}
/* drop connections to signals */
notify_callbacks ();
-
+
_crossfades.clear ();
}
struct RegionSortByLayer {
- bool operator() (boost::shared_ptr<Region>a, boost::shared_ptr<Region>b) {
+ bool operator() (boost::shared_ptr<Region> a, boost::shared_ptr<Region> b) {
return a->layer() < b->layer();
}
};
-nframes_t
+ARDOUR::nframes_t
AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nframes_t start,
nframes_t cnt, unsigned chan_n)
{
- nframes_t ret = cnt;
nframes_t end;
- nframes_t read_frames;
- nframes_t skip_frames;
/* optimizing this memset() away involves a lot of conditionals
that may well cause more of a hit due to cache misses
end = start + cnt - 1;
- read_frames = 0;
- skip_frames = 0;
_read_data_count = 0;
map<uint32_t,vector<boost::shared_ptr<Region> > > relevant_regions;
for (vector<boost::shared_ptr<Region> >::iterator i = r.begin(); i != r.end(); ++i) {
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion>(*i);
assert(ar);
- ar->read_at (buf, mixdown_buffer, gain_buffer, start, cnt, chan_n, read_frames, skip_frames);
+ ar->read_at (buf, mixdown_buffer, gain_buffer, start, cnt, chan_n);
_read_data_count += ar->read_data_count();
}
}
}
- return ret;
+ return cnt;
}
if ((*x)->_in == orig) {
if (! (*x)->covers(right->position())) {
- fade = boost::shared_ptr<Crossfade> (new Crossfade (**x, left, (*x)->_out));
+ fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, left, (*x)->_out));
} else {
// Overlap, the crossfade is copied on the left side of the right region instead
- fade = boost::shared_ptr<Crossfade> (new Crossfade (**x, right, (*x)->_out));
+ fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, right, (*x)->_out));
}
}
if ((*x)->_out == orig) {
if (! (*x)->covers(right->position())) {
- fade = boost::shared_ptr<Crossfade> (new Crossfade (**x, (*x)->_in, right));
+ fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, (*x)->_in, right));
} else {
// Overlap, the crossfade is copied on the right side of the left region instead
- fade = boost::shared_ptr<Crossfade> (new Crossfade (**x, (*x)->_in, left));
+ fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, (*x)->_in, left));
}
}
}
+
OverlapType c = top->coverage (bottom->position(), bottom->last_frame());
-
+
try {
switch (c) {
case OverlapNone:
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
}
void
-AudioPlaylist::crossfade_invalidated (boost::shared_ptr<Crossfade> xfade)
+AudioPlaylist::crossfade_invalidated (boost::shared_ptr<Region> r)
{
Crossfades::iterator i;
+ boost::shared_ptr<Crossfade> xfade = boost::dynamic_pointer_cast<Crossfade> (r);
xfade->in()->resume_fade_in ();
xfade->out()->resume_fade_out ();