comparison data/model/AlignmentModel.cpp @ 690:1424aa29ae95

Seems to be a bad idea to use plain DEBUG symbol on OS/X (system wants it)
author Chris Cannam
date Tue, 14 Jun 2011 15:26:52 +0100
parents 06f13a3b9e9e
children e802e550a1f2
comparison
equal deleted inserted replaced
689:573d45e9487b 690:1424aa29ae95
139 139
140 size_t 140 size_t
141 AlignmentModel::toReference(size_t frame) const 141 AlignmentModel::toReference(size_t frame) const
142 { 142 {
143 #ifdef DEBUG_ALIGNMENT_MODEL 143 #ifdef DEBUG_ALIGNMENT_MODEL
144 DEBUG << "AlignmentModel::toReference(" << frame << ")" << endl; 144 SVDEBUG << "AlignmentModel::toReference(" << frame << ")" << endl;
145 #endif 145 #endif
146 if (!m_path) { 146 if (!m_path) {
147 if (!m_rawPath) return frame; 147 if (!m_rawPath) return frame;
148 constructPath(); 148 constructPath();
149 } 149 }
152 152
153 size_t 153 size_t
154 AlignmentModel::fromReference(size_t frame) const 154 AlignmentModel::fromReference(size_t frame) const
155 { 155 {
156 #ifdef DEBUG_ALIGNMENT_MODEL 156 #ifdef DEBUG_ALIGNMENT_MODEL
157 DEBUG << "AlignmentModel::fromReference(" << frame << ")" << endl; 157 SVDEBUG << "AlignmentModel::fromReference(" << frame << ")" << endl;
158 #endif 158 #endif
159 if (!m_reversePath) { 159 if (!m_reversePath) {
160 if (!m_rawPath) return frame; 160 if (!m_rawPath) return frame;
161 constructReversePath(); 161 constructReversePath();
162 } 162 }
192 192
193 int completion = 0; 193 int completion = 0;
194 m_rawPath->isReady(&completion); 194 m_rawPath->isReady(&completion);
195 195
196 #ifdef DEBUG_ALIGNMENT_MODEL 196 #ifdef DEBUG_ALIGNMENT_MODEL
197 DEBUG << "AlignmentModel::pathCompletionChanged: completion = " 197 SVDEBUG << "AlignmentModel::pathCompletionChanged: completion = "
198 << completion << endl; 198 << completion << endl;
199 #endif 199 #endif
200 200
201 m_pathComplete = (completion == 100); 201 m_pathComplete = (completion == 100);
202 202
240 long rframe = lrintf(value * m_aligned->getSampleRate()); 240 long rframe = lrintf(value * m_aligned->getSampleRate());
241 m_path->addPoint(PathPoint(frame, rframe)); 241 m_path->addPoint(PathPoint(frame, rframe));
242 } 242 }
243 243
244 #ifdef DEBUG_ALIGNMENT_MODEL 244 #ifdef DEBUG_ALIGNMENT_MODEL
245 DEBUG << "AlignmentModel::constructPath: " << m_path->getPointCount() << " points, at least " << (2 * m_path->getPointCount() * (3 * sizeof(void *) + sizeof(int) + sizeof(PathPoint))) << " bytes" << endl; 245 SVDEBUG << "AlignmentModel::constructPath: " << m_path->getPointCount() << " points, at least " << (2 * m_path->getPointCount() * (3 * sizeof(void *) + sizeof(int) + sizeof(PathPoint))) << " bytes" << endl;
246 #endif 246 #endif
247 } 247 }
248 248
249 void 249 void
250 AlignmentModel::constructReversePath() const 250 AlignmentModel::constructReversePath() const
271 long rframe = i->mapframe; 271 long rframe = i->mapframe;
272 m_reversePath->addPoint(PathPoint(rframe, frame)); 272 m_reversePath->addPoint(PathPoint(rframe, frame));
273 } 273 }
274 274
275 #ifdef DEBUG_ALIGNMENT_MODEL 275 #ifdef DEBUG_ALIGNMENT_MODEL
276 DEBUG << "AlignmentModel::constructReversePath: " << m_reversePath->getPointCount() << " points, at least " << (2 * m_reversePath->getPointCount() * (3 * sizeof(void *) + sizeof(int) + sizeof(PathPoint))) << " bytes" << endl; 276 SVDEBUG << "AlignmentModel::constructReversePath: " << m_reversePath->getPointCount() << " points, at least " << (2 * m_reversePath->getPointCount() * (3 * sizeof(void *) + sizeof(int) + sizeof(PathPoint))) << " bytes" << endl;
277 #endif 277 #endif
278 } 278 }
279 279
280 size_t 280 size_t
281 AlignmentModel::align(PathModel *path, size_t frame) const 281 AlignmentModel::align(PathModel *path, size_t frame) const
289 289
290 const PathModel::PointList &points = path->getPoints(); 290 const PathModel::PointList &points = path->getPoints();
291 291
292 if (points.empty()) { 292 if (points.empty()) {
293 #ifdef DEBUG_ALIGNMENT_MODEL 293 #ifdef DEBUG_ALIGNMENT_MODEL
294 DEBUG << "AlignmentModel::align: No points" << endl; 294 SVDEBUG << "AlignmentModel::align: No points" << endl;
295 #endif 295 #endif
296 return frame; 296 return frame;
297 } 297 }
298 298
299 #ifdef DEBUG_ALIGNMENT_MODEL 299 #ifdef DEBUG_ALIGNMENT_MODEL
300 DEBUG << "AlignmentModel::align: frame " << frame << " requested" << endl; 300 SVDEBUG << "AlignmentModel::align: frame " << frame << " requested" << endl;
301 #endif 301 #endif
302 302
303 PathModel::Point point(frame); 303 PathModel::Point point(frame);
304 PathModel::PointList::const_iterator i = points.lower_bound(point); 304 PathModel::PointList::const_iterator i = points.lower_bound(point);
305 if (i == points.end()) { 305 if (i == points.end()) {
338 float(followingFrame - foundFrame); 338 float(followingFrame - foundFrame);
339 resultFrame += lrintf((followingMapFrame - foundMapFrame) * interp); 339 resultFrame += lrintf((followingMapFrame - foundMapFrame) * interp);
340 } 340 }
341 341
342 #ifdef DEBUG_ALIGNMENT_MODEL 342 #ifdef DEBUG_ALIGNMENT_MODEL
343 DEBUG << "AlignmentModel::align: resultFrame = " << resultFrame << endl; 343 SVDEBUG << "AlignmentModel::align: resultFrame = " << resultFrame << endl;
344 #endif 344 #endif
345 345
346 return resultFrame; 346 return resultFrame;
347 } 347 }
348 348
351 { 351 {
352 if (m_path) m_path->aboutToDelete(); 352 if (m_path) m_path->aboutToDelete();
353 delete m_path; 353 delete m_path;
354 m_path = path; 354 m_path = path;
355 #ifdef DEBUG_ALIGNMENT_MODEL 355 #ifdef DEBUG_ALIGNMENT_MODEL
356 DEBUG << "AlignmentModel::setPath: path = " << m_path << endl; 356 SVDEBUG << "AlignmentModel::setPath: path = " << m_path << endl;
357 #endif 357 #endif
358 constructReversePath(); 358 constructReversePath();
359 #ifdef DEBUG_ALIGNMENT_MODEL 359 #ifdef DEBUG_ALIGNMENT_MODEL
360 DEBUG << "AlignmentModel::setPath: after construction path = " 360 SVDEBUG << "AlignmentModel::setPath: after construction path = "
361 << m_path << ", rpath = " << m_reversePath << endl; 361 << m_path << ", rpath = " << m_reversePath << endl;
362 #endif 362 #endif
363 } 363 }
364 364
365 void 365 void
366 AlignmentModel::toXml(QTextStream &stream, 366 AlignmentModel::toXml(QTextStream &stream,
367 QString indent, 367 QString indent,
368 QString extraAttributes) const 368 QString extraAttributes) const
369 { 369 {
370 if (!m_path) { 370 if (!m_path) {
371 DEBUG << "AlignmentModel::toXml: no path" << endl; 371 SVDEBUG << "AlignmentModel::toXml: no path" << endl;
372 return; 372 return;
373 } 373 }
374 374
375 m_path->toXml(stream, indent, ""); 375 m_path->toXml(stream, indent, "");
376 376