itsy-bitsy freebsd compatibility fix.
[ardour.git] / libs / ardour / reverse.cc
index 3fe6aaa6307d55382e27d19562b9cb52aef95caf..eb68a09049c1e6194e0f4aacde8a450d71353c6b 100644 (file)
@@ -43,16 +43,16 @@ Reverse::~Reverse ()
 }
 
 int
-Reverse::run (AudioRegion& region)
+Reverse::run (boost::shared_ptr<AudioRegion> region)
 {
-       AudioRegion::SourceList nsrcs;
-       AudioRegion::SourceList::iterator si;
-       const jack_nframes_t blocksize = 256 * 1048;
+       SourceList nsrcs;
+       SourceList::iterator si;
+       const nframes_t blocksize = 256 * 1048;
        Sample buf[blocksize];
-       jack_nframes_t fpos;
-       jack_nframes_t fend;
-       jack_nframes_t fstart;
-       jack_nframes_t to_read;
+       nframes_t fpos;
+       nframes_t fend;
+       nframes_t fstart;
+       nframes_t to_read;
        int ret = -1;
 
        /* create new sources */
@@ -61,8 +61,8 @@ Reverse::run (AudioRegion& region)
                goto out;
        }
 
-       fend = region.start() + region.length();
-       fstart = region.start();
+       fend = region->start() + region->length();
+       fstart = region->start();
 
        if (blocksize < fend) {
                fpos =max(fstart, fend - blocksize);
@@ -70,7 +70,7 @@ Reverse::run (AudioRegion& region)
                fpos = fstart;
        }
 
-       to_read = min (region.length(), blocksize);
+       to_read = min (region->length(), blocksize);
 
        /* now read it backwards */
 
@@ -78,17 +78,17 @@ Reverse::run (AudioRegion& region)
 
                uint32_t n;
 
-               for (n = 0, si = nsrcs.begin(); n < region.n_channels(); ++n, ++si) {
+               for (n = 0, si = nsrcs.begin(); n < region->n_channels(); ++n, ++si) {
 
                        /* read it in */
                        
-                       if (region.source (n).read (buf, fpos, to_read) != to_read) {
+                       if (region->source (n)->read (buf, fpos, to_read) != to_read) {
                                goto out;
                        }
                        
                        /* swap memory order */
                        
-                       for (jack_nframes_t i = 0; i < to_read/2; ++i) {
+                       for (nframes_t i = 0; i < to_read/2; ++i) {
                                swap (buf[i],buf[to_read-1-i]);
                        }
                        
@@ -117,7 +117,6 @@ Reverse::run (AudioRegion& region)
        if (ret) {
                for (si = nsrcs.begin(); si != nsrcs.end(); ++si) {
                        (*si)->mark_for_remove ();
-                       delete *si;
                }
        }