diff host/vamp-simple-host.cpp @ 47:be8fdfe25693

* Change input buffers arg to process from float ** to const float *const * to avoid plugins modifying their input data * Some improvements to comments * Fix stupidity in frequency-domain input passing (there are n/2+1 values, not n/2)
author cannam
date Fri, 08 Dec 2006 17:39:32 +0000
parents 2858c897d90f
children aa64a46320d4
line wrap: on
line diff
--- a/host/vamp-simple-host.cpp	Thu Nov 30 15:00:17 2006 +0000
+++ b/host/vamp-simple-host.cpp	Fri Dec 08 17:39:32 2006 +0000
@@ -249,7 +249,7 @@
 
     float *filebuf = new float[blockSize * channels];
     float **plugbuf = new float*[channels];
-    for (int c = 0; c < channels; ++c) plugbuf[c] = new float[blockSize];
+    for (int c = 0; c < channels; ++c) plugbuf[c] = new float[blockSize + 2];
 
     cerr << "Using block size = " << blockSize << ", step size = "
               << stepSize << endl;
@@ -377,11 +377,16 @@
         }
         struct dirent *e = 0;
         while ((e = readdir(d))) {
-            if (!(e->d_type & DT_REG)) continue;
+//            cerr << "reading: " << e->d_name << endl;
+            if (!(e->d_type & DT_REG)) {
+//                cerr << e->d_name << ": not a regular file" << endl;
+                continue;
+            }
             int len = strlen(e->d_name);
             if (len < int(strlen(PLUGIN_SUFFIX) + 2) ||
                 e->d_name[len - strlen(PLUGIN_SUFFIX) - 1] != '.' ||
                 strcmp(e->d_name + len - strlen(PLUGIN_SUFFIX), PLUGIN_SUFFIX)) {
+//                cerr << e->d_name << ": not a library file" << endl;
                 continue;
             }
             char *fp = new char[path[i].length() + len + 3];
@@ -397,7 +402,9 @@
                     const VampPluginDescriptor *descriptor = 0;
                     while ((descriptor = fn(index))) {
                         Vamp::PluginHostAdapter plugin(descriptor, 48000);
-                        cerr << "    [" << char('A' + index) << "] "
+                        char c = char('A' + index);
+                        if (c > 'Z') c = char('a' + (index - 26));
+                        cerr << "    [" << c << "] "
                              << plugin.getDescription()
                              << ", \"" << plugin.getName() << "\""
                              << " [" << plugin.getMaker()
@@ -414,9 +421,13 @@
                         }
                         ++index;
                     }
+                } else {
+//                    cerr << e->d_name << ": no Vamp descriptor function" << endl;
                 }
                 DLCLOSE(handle);
-            }
+            } else {
+                cerr << "\n" << e->d_name << ": unable to load library (" << DLERROR() << ")" << endl;
+            }                
         }
         closedir(d);
     }
@@ -462,7 +473,7 @@
 
     fft(size, false, inbuf, inbuf + size, outbuf, outbuf + size);
 
-    for (size_t i = 0; i < size/2; ++i) {
+    for (size_t i = 0; i <= size/2; ++i) {
         buffer[i * 2] = outbuf[i];
         buffer[i * 2 + 1] = outbuf[i + size];
     }