45 SourceList::iterator si;
63 fstart = region->
start();
65 if (blocksize > region->
length()) {
66 blocksize = region->
length();
69 fpos = max (fstart, (fstart + region->
length() - blocksize));
71 buf =
new Sample[blocksize];
80 for (n = 0, si = nsrcs.begin(); n < region->
n_channels(); ++n, ++si) {
84 if (region->
audio_source (n)->read (buf, fpos, to_read) != to_read) {
91 swap (buf[i],buf[to_read-1-i]);
98 if (asrc && asrc->
write (buf, to_read) != to_read) {
103 if (fpos > fstart + blocksize) {
107 to_read = fpos - fstart;
112 ret =
finish (region, nsrcs);
119 for (si = nsrcs.begin(); si != nsrcs.end(); ++si) {
int make_new_sources(boost::shared_ptr< ARDOUR::Region >, ARDOUR::SourceList &, std::string suffix="")
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r)
boost::shared_ptr< AudioSource > audio_source(uint32_t n=0) const
void swap(shared_ptr< T > &a, shared_ptr< T > &b)
uint32_t n_channels() const
virtual framecnt_t write(Sample *src, framecnt_t cnt)
framecnt_t length() const
int finish(boost::shared_ptr< ARDOUR::Region >, ARDOUR::SourceList &, std::string region_name="")
int run(boost::shared_ptr< ARDOUR::Region >, Progress *)
std::vector< boost::shared_ptr< Source > > SourceList