Mercurial > hg > svcore
changeset 1521:2d291eac9f21 import-audio-data
Ignore non-value columns when guessing sample range
author | Chris Cannam |
---|---|
date | Wed, 12 Sep 2018 15:27:30 +0100 |
parents | 954d0cf29ca7 |
children | b7cb203ee344 |
files | data/fileio/CSVFormat.cpp data/fileio/CSVFormat.h |
diffstat | 2 files changed, 19 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/data/fileio/CSVFormat.cpp Wed Sep 12 13:56:56 2018 +0100 +++ b/data/fileio/CSVFormat.cpp Wed Sep 12 15:27:30 2018 +0100 @@ -360,14 +360,24 @@ range = SampleRangeSigned1; bool knownSigned = false; bool knownNonIntegral = false; + + SVDEBUG << "CSVFormat::guessAudioSampleRange: starting with assumption of " + << range << endl; for (int i = 0; i < m_columnCount; ++i) { + if (m_columnPurposes[i] != ColumnValue) { + SVDEBUG << "... column " << i + << " is not apparently a value, ignoring" << endl; + continue; + } if (!(m_columnQualities[i] & ColumnIntegral)) { knownNonIntegral = true; if (range == SampleRangeUnsigned255 || range == SampleRangeSigned32767) { range = SampleRangeOther; } + SVDEBUG << "... column " << i + << " is non-integral, updating range to " << range << endl; } if (m_columnQualities[i] & ColumnLarge) { if (range == SampleRangeSigned1 || @@ -378,12 +388,16 @@ range = SampleRangeSigned32767; } } + SVDEBUG << "... column " << i << " is large, updating range to " + << range << endl; } if (m_columnQualities[i] & ColumnSigned) { knownSigned = true; if (range == SampleRangeUnsigned255) { range = SampleRangeSigned32767; } + SVDEBUG << "... column " << i << " is signed, updating range to " + << range << endl; } if (!(m_columnQualities[i] & ColumnSmall)) { if (range == SampleRangeSigned1) { @@ -395,9 +409,14 @@ range = SampleRangeUnsigned255; } } + SVDEBUG << "... column " << i << " is not small, updating range to " + << range << endl; } } + SVDEBUG << "CSVFormat::guessAudioSampleRange: ended up with range " + << range << endl; + m_audioSampleRange = range; }
--- a/data/fileio/CSVFormat.h Wed Sep 12 13:56:56 2018 +0100 +++ b/data/fileio/CSVFormat.h Wed Sep 12 15:27:30 2018 +0100 @@ -133,11 +133,6 @@ return m_columnQualities; } - bool isColumnNumeric(int i) const { - return (m_columnQualities.size() > i && - m_columnQualities[i] & ColumnNumeric); - } - // read-only; only valid if format has been guessed: const QList<QStringList> &getExample() const { return m_example;