# HG changeset patch # User Chris Cannam # Date 1473870941 -3600 # Node ID 22b29720da41e884a52654a7b6bd216ccd77cafc # Parent cd8414edfd3239c6859d07e7ebde50f048a44a4f Add test using new curve-fsr-mixed output from the Vamp Test Plugin, and make corresponding fix to timestamp logic diff -r cd8414edfd32 -r 22b29720da41 .hgignore --- a/.hgignore Wed Sep 14 17:33:56 2016 +0100 +++ b/.hgignore Wed Sep 14 17:35:41 2016 +0100 @@ -27,3 +27,5 @@ *.opensdf re:^build/x64/Debug/ re:^build/x64/Release/ +test/obtained +test/failures diff -r cd8414edfd32 -r 22b29720da41 host/vamp-simple-host.cpp --- a/host/vamp-simple-host.cpp Wed Sep 14 17:33:56 2016 +0100 +++ b/host/vamp-simple-host.cpp Wed Sep 14 17:35:41 2016 +0100 @@ -508,7 +508,7 @@ const Plugin::OutputDescriptor &output, int outputNo, const Plugin::FeatureSet &features, ofstream *out, bool useFrames) { - static int featureCount = 0; + static int featureCount = -1; if (features.find(outputNo) == features.end()) return; @@ -523,12 +523,13 @@ rt = f.timestamp; haveRt = true; } else if (output.sampleType == Plugin::OutputDescriptor::FixedSampleRate) { - int n = featureCount; + int n = featureCount + 1; if (f.hasTimestamp) { n = int(round(toSeconds(f.timestamp) * output.sampleRate)); } rt = RealTime::fromSeconds(double(n) / output.sampleRate); haveRt = true; + featureCount = n; } if (useFrames) { @@ -570,8 +571,6 @@ (out ? *out : cout) << " " << f.label; (out ? *out : cout) << endl; - - ++featureCount; } } diff -r cd8414edfd32 -r 22b29720da41 test/expected/vamp-test-plugin-freq_curve-fsr-mixed.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/expected/vamp-test-plugin-freq_curve-fsr-mixed.txt Wed Sep 14 17:35:41 2016 +0100 @@ -0,0 +1,11 @@ +=== vamp-test-plugin:vamp-test-plugin-freq:curve-fsr-mixed + 2.400000000: 0 1 of 10: 0 at 2.4 snap to 2.4 + 2.800000000: 0.1 2 of 10: 0.1 at 2.9 snap to 2.8 + 3.200000000: 0.2 3 of 10: 0.2 at 3.14 snap to 3.2 + 3.600000000: 0.3 4 of 10: 0.3 at 3.5 snap to 3.6 + 4.000000000: 0.4 5 of 10: 0.4 at 4 + 4.400000000: 0.5 6 of 10: 0.5 at 4.4 + 4.000000000: 0.6 7 of 10: 0.6 at 3.9 snap to 4 + 4.400000000: 0.7 8 of 10: 0.7 at 4.4 snap to 4.4 + 4.800000000: 0.8 9 of 10: 0.8 at 4.8 + 5.200000000: 0.9 10 of 10: 0.9 at 5 snap to 5.2 diff -r cd8414edfd32 -r 22b29720da41 test/expected/vamp-test-plugin_curve-fsr-mixed.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/expected/vamp-test-plugin_curve-fsr-mixed.txt Wed Sep 14 17:35:41 2016 +0100 @@ -0,0 +1,11 @@ +=== vamp-test-plugin:vamp-test-plugin:curve-fsr-mixed + 2.400000000: 0 1 of 10: 0 at 2.4 snap to 2.4 + 2.800000000: 0.1 2 of 10: 0.1 at 2.9 snap to 2.8 + 3.200000000: 0.2 3 of 10: 0.2 at 3.14 snap to 3.2 + 3.600000000: 0.3 4 of 10: 0.3 at 3.5 snap to 3.6 + 4.000000000: 0.4 5 of 10: 0.4 at 4 + 4.400000000: 0.5 6 of 10: 0.5 at 4.4 + 4.000000000: 0.6 7 of 10: 0.6 at 3.9 snap to 4 + 4.400000000: 0.7 8 of 10: 0.7 at 4.4 snap to 4.4 + 4.800000000: 0.8 9 of 10: 0.8 at 4.8 + 5.200000000: 0.9 10 of 10: 0.9 at 5 snap to 5.2