comparison data/model/DenseTimeValueModel.cpp @ 1679:0d89abd631ac single-point

Re-add the toDelimitedDataString stuff
author Chris Cannam
date Thu, 28 Mar 2019 16:03:36 +0000
parents 0d4f1fcad97a
children 52705a328b34
comparison
equal deleted inserted replaced
1678:1078f0ef3012 1679:0d89abd631ac
27 { 27 {
28 PlayParameterRepository::getInstance()->removePlayable(this); 28 PlayParameterRepository::getInstance()->removePlayable(this);
29 } 29 }
30 30
31 QString 31 QString
32 DenseTimeValueModel::toDelimitedDataStringSubset(QString delimiter, sv_frame_t f0, sv_frame_t f1) const 32 DenseTimeValueModel::toDelimitedDataString(QString delimiter,
33 DataExportOptions,
34 sv_frame_t startFrame,
35 sv_frame_t duration) const
33 { 36 {
34 int ch = getChannelCount(); 37 int ch = getChannelCount();
35 38
36 // cerr << "f0 = " << f0 << ", f1 = " << f1 << endl; 39 if (duration <= 0) return "";
37 40
38 if (f1 <= f0) return ""; 41 auto data = getMultiChannelData(0, ch - 1, startFrame, duration);
39
40 auto data = getMultiChannelData(0, ch - 1, f0, f1 - f0);
41 42
42 if (data.empty() || data[0].empty()) return ""; 43 if (data.empty() || data[0].empty()) return "";
43 44
44 QStringList list; 45 QStringList list;
45 for (sv_frame_t i = 0; in_range_for(data[0], i); ++i) { 46 for (sv_frame_t i = 0; in_range_for(data[0], i); ++i) {
46 QStringList parts; 47 QStringList parts;
47 parts << QString("%1").arg(f0 + i); 48 parts << QString("%1").arg(startFrame + i);
48 for (int c = 0; in_range_for(data, c); ++c) { 49 for (int c = 0; in_range_for(data, c); ++c) {
49 parts << QString("%1").arg(data[c][i]); 50 parts << QString("%1").arg(data[c][i]);
50 } 51 }
51 list << parts.join(delimiter); 52 list << parts.join(delimiter);
52 } 53 }