Mercurial > hg > svcore
diff data/fileio/CSVFileReader.cpp @ 1490:9ab8e5ec4731 import-audio-data
Correct channel indexing
author | Chris Cannam |
---|---|
date | Thu, 28 Jun 2018 15:52:30 +0100 |
parents | 8d4f09552ba4 |
children | 1dc64d3d323c |
line wrap: on
line diff
--- a/data/fileio/CSVFileReader.cpp Thu Jun 28 15:44:31 2018 +0100 +++ b/data/fileio/CSVFileReader.cpp Thu Jun 28 15:52:30 2018 +0100 @@ -418,17 +418,22 @@ float **samples = breakfastquay::allocate_and_zero_channels<float> (channels, 1); + + int channel = 0; - for (int i = 0; i < list.size() && i < channels; ++i) { + for (int i = 0; i < list.size() && channel < channels; ++i) { - if (m_format.getColumnPurpose(i) != CSVFormat::ColumnValue) { + if (m_format.getColumnPurpose(i) != + CSVFormat::ColumnValue) { continue; } bool ok = false; float value = list[i].toFloat(&ok); - samples[i][0] = value; + samples[channel][0] = value; + + ++channel; } bool ok = modelW->addSamples(samples, 1);