changeset 264:91ac8f5e52ea

* don't output bin names if there are none provided
author cannam
date Thu, 20 Nov 2008 17:33:12 +0000
parents 4454843ff384
children 03c7167e1f30
files rdf/generator/vamp-rdf-template-generator.cpp
diffstat 1 files changed, 36 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/rdf/generator/vamp-rdf-template-generator.cpp	Thu Nov 20 15:01:30 2008 +0000
+++ b/rdf/generator/vamp-rdf-template-generator.cpp	Thu Nov 20 17:33:12 2008 +0000
@@ -248,14 +248,25 @@
         if (o.hasFixedBinCount)
         {
             res+="    vamp:bin_count        "+to_string(o.binCount)+" ;\n";
-            res+="    vamp:bin_names        (";
 
-            unsigned int i;
-            for (i=0; i+1 < o.binNames.size(); i++)
-                res+=" \""+o.binNames[i]+"\"";
-            if (i < o.binNames.size())
-                res+=" \""+o.binNames[i]+"\"";
-            res+=");\n";
+            bool haveBinNames = false;
+            for (int i=0; i < o.binNames.size(); i++) {
+                if (o.binNames[i] != "") {
+                    haveBinNames = true;
+                    break;
+                }
+            }
+            
+            if (haveBinNames) {
+                res+="    vamp:bin_names        (";
+
+                unsigned int i;
+                for (i=0; i+1 < o.binNames.size(); i++)
+                    res+=" \""+o.binNames[i]+"\"";
+                if (i < o.binNames.size())
+                    res+=" \""+o.binNames[i]+"\"";
+                res+=");\n";
+            }
         }
        
         res+="    vamp:sample_type      vamp:VariableSampleRate ;\n";
@@ -296,14 +307,25 @@
         if (o.hasFixedBinCount)
         {
             res+="    vamp:bin_count        "+to_string(o.binCount)+" ;\n";
-            res+="    vamp:bin_names        (";
 
-            unsigned int i;
-            for (i=0; i+1 < o.binNames.size(); i++)
-                res+=" \""+o.binNames[i]+"\"";
-            if (i < o.binNames.size())
-                res+=" \""+o.binNames[i]+"\"";
-            res+=");\n";
+            bool haveBinNames = false;
+            for (int i=0; i < o.binNames.size(); i++) {
+                if (o.binNames[i] != "") {
+                    haveBinNames = true;
+                    break;
+                }
+            }
+
+            if (haveBinNames) {
+                res+="    vamp:bin_names        (";
+
+                unsigned int i;
+                for (i=0; i+1 < o.binNames.size(); i++)
+                    res+=" \""+o.binNames[i]+"\"";
+                if (i < o.binNames.size())
+                    res+=" \""+o.binNames[i]+"\"";
+                res+=");\n";
+            }
         }
 
         else if (o.sampleType == Plugin::OutputDescriptor::FixedSampleRate)