comparison transform/CSVFeatureWriter.cpp @ 1057:5c5d4863b428 tonioni

Merge from cxx11 branch
author Chris Cannam
date Mon, 23 Mar 2015 11:26:28 +0000
parents 26cf6d5251ec
children 870acd589a38
comparison
equal deleted inserted replaced
1056:c4898e57eea5 1057:5c5d4863b428
131 throw FailedToOpenOutputStream(trackId, transformId); 131 throw FailedToOpenOutputStream(trackId, transformId);
132 } 132 }
133 133
134 QTextStream &stream = *sptr; 134 QTextStream &stream = *sptr;
135 135
136 int n = features.size(); 136 int n = (int)features.size();
137 137
138 if (n == 0) return; 138 if (n == 0) return;
139 139
140 DataId tt(trackId, transform); 140 DataId tt(trackId, transform);
141 141
208 stream << m_separator; 208 stream << m_separator;
209 } 209 }
210 } 210 }
211 } 211 }
212 212
213 Vamp::RealTime duration; 213 ::RealTime duration;
214 bool haveDuration = true; 214 bool haveDuration = true;
215 215
216 if (f.hasDuration) { 216 if (f.hasDuration) {
217 duration = f.duration; 217 duration = f.duration;
218 } else if (optionalNextFeature) { 218 } else if (optionalNextFeature) {
221 haveDuration = false; 221 haveDuration = false;
222 } 222 }
223 223
224 if (m_sampleTiming) { 224 if (m_sampleTiming) {
225 225
226 float rate = transform.getSampleRate(); 226 sv_samplerate_t rate = transform.getSampleRate();
227 227
228 stream << Vamp::RealTime::realTime2Frame(f.timestamp, rate); 228 stream << ::RealTime::realTime2Frame(f.timestamp, rate);
229 229
230 if (haveDuration) { 230 if (haveDuration) {
231 stream << m_separator; 231 stream << m_separator;
232 if (m_endTimes) { 232 if (m_endTimes) {
233 stream << Vamp::RealTime::realTime2Frame 233 stream << ::RealTime::realTime2Frame
234 (f.timestamp + duration, rate); 234 (::RealTime(f.timestamp) + duration, rate);
235 } else { 235 } else {
236 stream << Vamp::RealTime::realTime2Frame(duration, rate); 236 stream << ::RealTime::realTime2Frame(duration, rate);
237 } 237 }
238 } 238 }
239 239
240 } else { 240 } else {
241 241
244 stream << timestamp; 244 stream << timestamp;
245 245
246 if (haveDuration) { 246 if (haveDuration) {
247 if (m_endTimes) { 247 if (m_endTimes) {
248 QString endtime = 248 QString endtime =
249 (f.timestamp + duration).toString().c_str(); 249 (::RealTime(f.timestamp) + duration).toString().c_str();
250 endtime.replace(QRegExp("^ +"), ""); 250 endtime.replace(QRegExp("^ +"), "");
251 stream << m_separator << endtime; 251 stream << m_separator << endtime;
252 } else { 252 } else {
253 QString d = duration.toString().c_str(); 253 QString d = ::RealTime(duration).toString().c_str();
254 d.replace(QRegExp("^ +"), ""); 254 d.replace(QRegExp("^ +"), "");
255 stream << m_separator << d; 255 stream << m_separator << d;
256 } 256 }
257 } 257 }
258 } 258 }