changeset 158:a2310369b2cc labfile

Add fill-ends option to CSV writer (and test it)
author Chris Cannam
date Wed, 15 Oct 2014 10:18:13 +0100
parents 946115b8badd
children 237ccacbb85e
files .hgsubstate runner/LabFeatureWriter.cpp tests/test-csv-writer/expected/curve-vsr-all.csv tests/test-csv-writer/expected/curve-vsr-fill-ends.csv tests/test-csv-writer/expected/notes-regions-all.csv tests/test-csv-writer/expected/notes-regions-fill-ends.csv tests/test-csv-writer/test-csv-writer.sh
diffstat 7 files changed, 59 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Wed Oct 15 08:00:01 2014 +0100
+++ b/.hgsubstate	Wed Oct 15 10:18:13 2014 +0100
@@ -1,3 +1,3 @@
 d16f0fd6db6104d87882bc43788a3bb1b0f8c528 dataquay
 879bdc878826bebec67130326f99397c430419b1 sv-dependency-builds
-ec6e69373997482c65b68a10dac1b8a0b5d13dac svcore
+51bf067de517cc9ce385c013315e0b92d2dac114 svcore
--- a/runner/LabFeatureWriter.cpp	Wed Oct 15 08:00:01 2014 +0100
+++ b/runner/LabFeatureWriter.cpp	Wed Oct 15 10:18:13 2014 +0100
@@ -132,6 +132,8 @@
         // start beyond that anyway)
         writeFeature(stream, f, &f);
     }
+
+    m_pending.clear();
 }
 
 void
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-csv-writer/expected/curve-vsr-all.csv	Wed Oct 15 10:18:13 2014 +0100
@@ -0,0 +1,10 @@
+"./../audio/20sec-silence.wav"@0@33075@0@"1 of 10: 0 at 0"
+@33075@66150@0.1@"2 of 10: 0.1 at 0.75"
+@66150@99225@0.2@"3 of 10: 0.2 at 1.5"
+@99225@132300@0.3@"4 of 10: 0.3 at 2.25"
+@132300@165375@0.4@"5 of 10: 0.4 at 3"
+@165375@198450@0.5@"6 of 10: 0.5 at 3.75"
+@198450@231525@0.6@"7 of 10: 0.6 at 4.5"
+@231525@264600@0.7@"8 of 10: 0.7 at 5.25"
+@264600@297675@0.8@"9 of 10: 0.8 at 6"
+@297675@297675@0.9@"10 of 10: 0.9 at 6.75"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-csv-writer/expected/curve-vsr-fill-ends.csv	Wed Oct 15 10:18:13 2014 +0100
@@ -0,0 +1,10 @@
+"./../audio/20sec-silence.wav",0.000000000,0.750000000,0,"1 of 10: 0 at 0"
+,0.750000000,0.750000000,0.1,"2 of 10: 0.1 at 0.75"
+,1.500000000,0.750000000,0.2,"3 of 10: 0.2 at 1.5"
+,2.250000000,0.750000000,0.3,"4 of 10: 0.3 at 2.25"
+,3.000000000,0.750000000,0.4,"5 of 10: 0.4 at 3"
+,3.750000000,0.750000000,0.5,"6 of 10: 0.5 at 3.75"
+,4.500000000,0.750000000,0.6,"7 of 10: 0.6 at 4.5"
+,5.250000000,0.750000000,0.7,"8 of 10: 0.7 at 5.25"
+,6.000000000,0.750000000,0.8,"9 of 10: 0.8 at 6"
+,6.750000000,0.000000000,0.9,"10 of 10: 0.9 at 6.75"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-csv-writer/expected/notes-regions-all.csv	Wed Oct 15 10:18:13 2014 +0100
@@ -0,0 +1,10 @@
+"./../audio/20sec-silence.wav"@0@77175@0@"1 of 10: 0 at 0 dur. 1.75"
+@44100@66150@0.1@"2 of 10: 0.1 at 1 dur. 0.5"
+@88200@165375@0.2@"3 of 10: 0.2 at 2 dur. 1.75"
+@132300@154350@0.3@"4 of 10: 0.3 at 3 dur. 0.5"
+@176400@253575@0.4@"5 of 10: 0.4 at 4 dur. 1.75"
+@220500@242550@0.5@"6 of 10: 0.5 at 5 dur. 0.5"
+@264600@341775@0.6@"7 of 10: 0.6 at 6 dur. 1.75"
+@308700@330750@0.7@"8 of 10: 0.7 at 7 dur. 0.5"
+@352800@429975@0.8@"9 of 10: 0.8 at 8 dur. 1.75"
+@396900@418950@0.9@"10 of 10: 0.9 at 9 dur. 0.5"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-csv-writer/expected/notes-regions-fill-ends.csv	Wed Oct 15 10:18:13 2014 +0100
@@ -0,0 +1,10 @@
+"./../audio/20sec-silence.wav",0.000000000,1.750000000,0,"1 of 10: 0 at 0 dur. 1.75"
+,1.000000000,0.500000000,0.1,"2 of 10: 0.1 at 1 dur. 0.5"
+,2.000000000,1.750000000,0.2,"3 of 10: 0.2 at 2 dur. 1.75"
+,3.000000000,0.500000000,0.3,"4 of 10: 0.3 at 3 dur. 0.5"
+,4.000000000,1.750000000,0.4,"5 of 10: 0.4 at 4 dur. 1.75"
+,5.000000000,0.500000000,0.5,"6 of 10: 0.5 at 5 dur. 0.5"
+,6.000000000,1.750000000,0.6,"7 of 10: 0.6 at 6 dur. 1.75"
+,7.000000000,0.500000000,0.7,"8 of 10: 0.7 at 7 dur. 0.5"
+,8.000000000,1.750000000,0.8,"9 of 10: 0.8 at 8 dur. 1.75"
+,9.000000000,0.500000000,0.9,"10 of 10: 0.9 at 9 dur. 0.5"
--- a/tests/test-csv-writer/test-csv-writer.sh	Wed Oct 15 08:00:01 2014 +0100
+++ b/tests/test-csv-writer/test-csv-writer.sh	Wed Oct 15 10:18:13 2014 +0100
@@ -25,6 +25,14 @@
     csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
 	faildiff "Output differs from expected for output $output and $flag flag" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
 
+    flag=fill-ends
+
+    $r -d "$testplug:$output" -w csv --csv-$flag --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
+	fail "Failed to run for plugin $testplug with output $output and $flag flag"
+
+    csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
+	faildiff "Output differs from expected for output $output and $flag flag" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
+
     flag=end-times
 
     $r -d "$testplug:$output" -w csv --csv-$flag --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
@@ -41,6 +49,14 @@
     csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
 	faildiff "Output differs from expected for output $output and $flag flag" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
 
+    flag=all
+
+    $r -d "$testplug:$output" -w csv --csv-sample-timing --csv-fill-ends --csv-end-times --csv-separator '@' --csv-stdout "$infile" 2>/dev/null > "$tmpcsv" || \
+	fail "Failed to run for plugin $testplug with output $output and all flags"
+
+    csvcompare "$tmpcsv" "$mypath/expected/$output-$flag.csv" || \
+	faildiff "Output differs from expected for output $output and all flags" "$tmpcsv" "$mypath/expected/$output-$flag.csv"
+
 done
 
 exit 0