#include <climits>
#include <cfloat>
#include <algorithm>
-
#include <set>
+#include <boost/scoped_array.hpp>
+
#include <sigc++/bind.h>
#include <sigc++/class_slot.h>
} else {
- Sample buf[blocksize];
+ boost::scoped_array<Sample> buf (new Sample[blocksize]);
for (uint32_t chan = 0; chan < spec.channels; ++chan) {
- if (sources[chan]->read (buf, _start + spec.pos, to_read) != to_read) {
+ if (sources[chan]->read (buf.get(), _start + spec.pos, to_read) != to_read) {
goto out;
}
AudioRegion::normalize_to (float target_dB)
{
const nframes_t blocksize = 64 * 1024;
- Sample buf[blocksize];
+ boost::scoped_array<Sample> buf (new Sample[blocksize]);
nframes_t fpos;
nframes_t fend;
nframes_t to_read;
/* read it in */
- if (source (n)->read (buf, fpos, to_read) != to_read) {
+ if (source (n)->read (buf.get(), fpos, to_read) != to_read) {
return;
}
- maxamp = Session::compute_peak (buf, to_read, maxamp);
+ maxamp = Session::compute_peak (buf.get(), to_read, maxamp);
}
fpos += to_read;
return;
}
+ cerr << "We have " << nascent.size() << " NI's to merge\n";
+
for (list<NascentInfo*>::iterator n = nascent.begin(); n != nascent.end(); ++n) {
NascentInfo* ninfo = *n;
if (!preexisting) {
+ cerr << "no prexisting - merge\n";
events = nascent_events;
} else if (ninfo->end_time < events.front()->when) {
/* all points in nascent are before the first existing point */
+
+ cerr << "all before first, prepend\n";
events.insert (events.begin(), nascent_events.begin(), nascent_events.end());
} else if (ninfo->start_time > events.back()->when) {
/* all points in nascent are after the last existing point */
+
+ cerr << "all after last, append\n";
events.insert (events.end(), nascent_events.begin(), nascent_events.end());
if (range_begin != events.begin()) {
/* clamp point before */
+ cerr << "Add pre-clamp\n";
events.insert (range_begin, point_factory (ninfo->start_time, unlocked_eval (ninfo->start_time)));
}
-
+
+ cerr << "merge into event list\n";
events.insert (range_begin, nascent_events.begin(), nascent_events.end());
if (range_end != events.end()) {
/* clamp point after */
+ cerr << "Add post-clamp\n";
events.insert (range_begin, point_factory (ninfo->end_time, end_value));
}