Don't display empty tabs in the port matrix.
[ardour.git] / libs / ardour / audioanalyser.cc
index eccc38434d9c0b39b1e6d3faf5521e67ea7a5e3e..3acfc9bce445df28043c85ba44b6309347f041a0 100644 (file)
@@ -1,13 +1,18 @@
-#include <vamp-sdk/hostext/PluginLoader.h>
+#include <cstring>
+
+#include "vamp-hostsdk/PluginLoader.h"
+
 #include <glibmm/miscutils.h>
 #include <glibmm/fileutils.h>
 #include <glib/gstdio.h> // for g_remove()
 
-#include <pbd/error.h>
+#include "pbd/error.h"
+
+#include "ardour/audioanalyser.h"
+#include "ardour/readable.h"
+#include "ardour/readable.h"
 
-#include <ardour/audioanalyser.h>
-#include <ardour/readable.h>
-#include <ardour/readable.h>
+#include <cstring>
 
 #include "i18n.h"
 
@@ -21,11 +26,11 @@ AudioAnalyser::AudioAnalyser (float sr, AnalysisPluginKey key)
        , plugin_key (key)
 {
        /* create VAMP plugin and initialize */
-       
+
        if (initialize_plugin (plugin_key, sample_rate)) {
                error << string_compose (_("cannot load VAMP plugin \"%1\""), key) << endmsg;
                throw failed_constructor();
-       } 
+       }
 }
 
 AudioAnalyser::~AudioAnalyser ()
@@ -45,7 +50,7 @@ AudioAnalyser::initialize_plugin (AnalysisPluginKey key, float sr)
        if (!plugin) {
                error << string_compose (_("VAMP Plugin \"%1\" could not be loaded"), key) << endmsg;
                return -1;
-       } 
+       }
 
        /* we asked for the buffering adapter, so set the blocksize to
           something that makes for efficient disk i/o
@@ -74,7 +79,7 @@ AudioAnalyser::reset ()
                plugin->reset ();
        }
 }
-       
+
 int
 AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel)
 {
@@ -91,7 +96,7 @@ AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel)
        if (!path.empty()) {
 
                /* store data in tmp file, not the real one */
-               
+
                tmp_path = path;
                tmp_path += ".tmp";
 
@@ -107,11 +112,11 @@ AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel)
        while (!done) {
 
                nframes64_t to_read;
-               
+
                /* read from source */
 
                to_read = min ((len - pos), bufsize);
-               
+
                if (src->read (data, pos, to_read, channel) != to_read) {
                        goto out;
                }
@@ -121,7 +126,7 @@ AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel)
                if (to_read != bufsize) {
                        memset (data + to_read, 0, (bufsize - to_read) * sizeof (Sample));
                }
-               
+
                features = plugin->process (bufs, RealTime::fromSeconds ((double) pos / sample_rate));
 
                if (use_features (features, (path.empty() ? 0 : &ofile))) {
@@ -156,9 +161,7 @@ AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel)
                g_rename (tmp_path.c_str(), path.c_str());
        }
 
-       if (data) {
-               delete [] data;
-       }
+       delete [] data;
 
        return ret;
 }