# HG changeset patch # User Chris Cannam # Date 1195741039 0 # Node ID ba30f4a3e3be07d13cd23fc38a63e619ba1e9608 # Parent f14e2f7b24f7b9e172f3642b6abc8cc3c708848f * Some work on correct alignment when moving panes during playback * Overhaul alignment for playback frame values (view manager now always refers to reference-timeline values, only the play source deals in playback model timeline values) * When making a selection, ensure the selection regions shown in other panes (and used for playback constraints if appropriate) are aligned correctly. This may be the coolest feature ever implemented in any program ever. diff -r f14e2f7b24f7 -r ba30f4a3e3be data/model/AlignmentModel.cpp --- a/data/model/AlignmentModel.cpp Thu Nov 22 11:09:26 2007 +0000 +++ b/data/model/AlignmentModel.cpp Thu Nov 22 14:17:19 2007 +0000 @@ -125,21 +125,26 @@ AlignmentModel::toReference(size_t frame) const { // std::cerr << "AlignmentModel::toReference(" << frame << ")" << std::endl; - if (!m_reversePath) constructReversePath(); - return align(m_reversePath, frame); + if (!m_path) constructPath(); + return align(m_path, frame); } size_t AlignmentModel::fromReference(size_t frame) const { // std::cerr << "AlignmentModel::fromReference(" << frame << ")" << std::endl; - if (!m_path) constructPath(); - return align(m_path, frame); + if (!m_reversePath) constructReversePath(); + return align(m_reversePath, frame); } void AlignmentModel::pathChanged() { + if (m_pathComplete) { + std::cerr << "AlignmentModel: deleting raw path model" << std::endl; + delete m_rawPath; + m_rawPath = 0; + } } void @@ -153,6 +158,7 @@ void AlignmentModel::pathCompletionChanged() { + if (!m_rawPath) return; m_pathBegun = true; if (!m_pathComplete) { @@ -170,9 +176,6 @@ constructPath(); constructReversePath(); - delete m_rawPath; - m_rawPath = 0; - delete m_inputModel; m_inputModel = 0; } @@ -208,7 +211,7 @@ m_path->addPoint(PathPoint(frame, rframe)); } - std::cerr << "AlignmentModel::constructPath: " << m_path->getPointCount() << " points, at least " << (2 * m_path->getPointCount() * (3 * sizeof(void *) + sizeof(int) + sizeof(PathPoint))) << " bytes" << std::endl; +// std::cerr << "AlignmentModel::constructPath: " << m_path->getPointCount() << " points, at least " << (2 * m_path->getPointCount() * (3 * sizeof(void *) + sizeof(int) + sizeof(PathPoint))) << " bytes" << std::endl; } void @@ -238,12 +241,14 @@ m_reversePath->addPoint(PathPoint(rframe, frame)); } - std::cerr << "AlignmentModel::constructReversePath: " << m_reversePath->getPointCount() << " points, at least " << (2 * m_reversePath->getPointCount() * (3 * sizeof(void *) + sizeof(int) + sizeof(PathPoint))) << " bytes" << std::endl; +// std::cerr << "AlignmentModel::constructReversePath: " << m_reversePath->getPointCount() << " points, at least " << (2 * m_reversePath->getPointCount() * (3 * sizeof(void *) + sizeof(int) + sizeof(PathPoint))) << " bytes" << std::endl; } size_t AlignmentModel::align(PathModel *path, size_t frame) const { + if (!path) return frame; + // The path consists of a series of points, each with frame equal // to the frame on the source model and mapframe equal to the // frame on the target model. Both should be monotonically @@ -283,7 +288,7 @@ resultFrame += lrintf((followingMapFrame - foundMapFrame) * interp); } - std::cerr << "AlignmentModel::align: resultFrame = " << resultFrame << std::endl; +// std::cerr << "AlignmentModel::align: resultFrame = " << resultFrame << std::endl; return resultFrame; }