Optimize automation-event process splitting
[ardour.git] / libs / ardour / caimportable.cc
index f5a70a5f6ace9307f5ed95687588f4c9fc9da220..008e78954c8566fe79989b096b34ff38afd47b5f 100644 (file)
@@ -1,8 +1,27 @@
+/*
+    Copyright (C) 2012 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
 #include "ardour/caimportable.h"
 #include <sndfile.h>
 #include "pbd/error.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace ARDOUR;
 using namespace std;
@@ -24,7 +43,9 @@ CAImportableSource::CAImportableSource (const string& path)
                af.SetClientFormat (client_format);
 
        } catch (CAXException& cax) {
-               error << string_compose ("CAImportable: %1", cax.mOperation) << endmsg;
+                //Don't report an error here since there is one higher up in import.
+                //Since libsndfile gets tried second, any failures here may show as
+                //invalid errors in the Error log.
                throw failed_constructor ();
        }
 
@@ -34,12 +55,12 @@ CAImportableSource::~CAImportableSource ()
 {
 }
 
-nframes_t
-CAImportableSource::read (Sample* buffer, nframes_t nframes)
+samplecnt_t
+CAImportableSource::read (Sample* buffer, samplecnt_t nframes)
 {
-       nframes_t nread = 0;
+       samplecnt_t nread = 0;
        AudioBufferList abl;
-       nframes_t per_channel;
+       samplecnt_t per_channel;
        bool at_end = false;
 
        abl.mNumberBuffers = 1;
@@ -83,14 +104,14 @@ CAImportableSource::channels () const
        return af.GetFileDataFormat().NumberChannels();
 }
 
-nframes_t
+samplecnt_t
 CAImportableSource::length () const
 {
        return af.GetNumberFrames();
 }
 
-nframes_t
-CAImportableSource::samplerate() const
+samplecnt_t
+CAImportableSource::samplerate () const
 {
        CAStreamBasicDescription client_asbd;
 
@@ -105,7 +126,7 @@ CAImportableSource::samplerate() const
 }
 
 void
-CAImportableSource::seek (nframes_t pos)
+CAImportableSource::seek (samplepos_t pos)
 {
        try {
                af.Seek (pos);