Mercurial > hg > svcore
diff data/fileio/CSVFileReader.cpp @ 990:dc1695b90a58
Add milliseconds as CSV import timing option
author | Chris Cannam |
---|---|
date | Fri, 03 Oct 2014 15:09:27 +0100 |
parents | fae5689f7e27 |
children | e369dd281cf2 |
line wrap: on
line diff
--- a/data/fileio/CSVFileReader.cpp Wed Oct 01 14:06:28 2014 +0100 +++ b/data/fileio/CSVFileReader.cpp Fri Oct 03 15:09:27 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; } }