changeset 27:bb5c4e102bda slimline

Return a single degenerate Part if given a very short input
author Chris Cannam
date Thu, 10 May 2012 16:46:29 +0100
parents 2760d0d07469
children f0face94edef
files songparts/SongParts.cpp
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/songparts/SongParts.cpp	Thu May 10 12:04:11 2012 +0100
+++ b/songparts/SongParts.cpp	Thu May 10 16:46:29 2012 +0100
@@ -1340,6 +1340,19 @@
     int nBeat = quantisedChromagram.size();                      // Number of feature vector
     int nFeatValues = quantisedChromagram[0].values.size();      // Number of values for each feature vector
     
+    if (nBeat < minlength) {
+        // return a single part
+        vector<Part> parts;
+        Part newPart;
+        newPart.n = 1;
+        newPart.indices.push_back(0);
+        newPart.letter = "n1";
+        newPart.value = 20;
+        newPart.level = 0;
+        parts.push_back(newPart);
+        return parts;
+    }
+
     arma::irowvec timeStamp = arma::zeros<arma::imat>(1,nBeat);       // Vector of Time Stamps
     
     // Save time stamp as a Vector