changeset 992:7a8f7a553b37

Merge
author Chris Cannam
date Fri, 03 Oct 2014 15:28:31 +0100
parents 1974859baba5 (diff) c9d456b1fcde (current diff)
children 60e2927b1475
files
diffstat 3 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/data/fileio/CSVFileReader.cpp	Fri Oct 03 09:29:11 2014 +0100
+++ b/data/fileio/CSVFileReader.cpp	Fri Oct 03 15:28:31 2014 +0100
@@ -101,6 +101,12 @@
         double time = numeric.toDouble(&ok);
         if (!ok) time = StringBits::stringToDoubleLocaleFree(numeric, &ok);
         calculatedFrame = int(time * sampleRate + 0.5);
+    
+    } else if (timeUnits == CSVFormat::TimeMilliseconds) {
+
+        double time = numeric.toDouble(&ok);
+        if (!ok) time = StringBits::stringToDoubleLocaleFree(numeric, &ok);
+        calculatedFrame = int((time / 1000.0) * sampleRate + 0.5);
         
     } else {
         
@@ -149,7 +155,8 @@
         } else {
             windowSize = 1;
         }
-	if (timeUnits == CSVFormat::TimeSeconds) {
+	if (timeUnits == CSVFormat::TimeSeconds ||
+            timeUnits == CSVFormat::TimeMilliseconds) {
 	    sampleRate = m_mainModelSampleRate;
 	}
     }
--- a/data/fileio/CSVFormat.cpp	Fri Oct 03 09:29:11 2014 +0100
+++ b/data/fileio/CSVFormat.cpp	Fri Oct 03 15:28:31 2014 +0100
@@ -103,7 +103,7 @@
     QStringList list = StringBits::split(line, m_separator[0], m_allowQuoting);
 
     int cols = list.size();
-    if (lineno == 0 || (cols < m_columnCount)) m_columnCount = cols;
+    if (lineno == 0 || (cols > m_columnCount)) m_columnCount = cols;
     if (cols != m_columnCount) m_variableColumnCount = true;
 
     // All columns are regarded as having these qualities until we see
--- a/data/fileio/CSVFormat.h	Fri Oct 03 09:29:11 2014 +0100
+++ b/data/fileio/CSVFormat.h	Fri Oct 03 15:28:31 2014 +0100
@@ -37,8 +37,9 @@
 
     enum TimeUnits {
 	TimeSeconds,
+        TimeMilliseconds,
 	TimeAudioFrames,
-	TimeWindows
+	TimeWindows,
     };
 
     enum ColumnPurpose {