Chris@297: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@297: Chris@297: /* Chris@297: Sonic Visualiser Chris@297: An audio file viewer and annotation editor. Chris@297: Centre for Digital Music, Queen Mary, University of London. Chris@297: This file copyright 2007 QMUL. Chris@297: Chris@297: This program is free software; you can redistribute it and/or Chris@297: modify it under the terms of the GNU General Public License as Chris@297: published by the Free Software Foundation; either version 2 of the Chris@297: License, or (at your option) any later version. See the file Chris@297: COPYING included with this distribution for more information. Chris@297: */ Chris@297: Chris@297: #include "RangeSummarisableTimeValueModel.h" Chris@297: Chris@297: #include "AlignmentModel.h" Chris@297: Chris@297: #include Chris@297: Chris@297: void Chris@297: RangeSummarisableTimeValueModel::setAlignment(AlignmentModel *alignment) Chris@297: { Chris@297: delete m_alignment; Chris@297: m_alignment = alignment; Chris@297: connect(m_alignment, SIGNAL(completionChanged()), Chris@297: this, SIGNAL(alignmentCompletionChanged())); Chris@297: } Chris@297: Chris@297: const Model * Chris@297: RangeSummarisableTimeValueModel::getAlignmentReference() const Chris@297: { Chris@297: if (!m_alignment) return 0; Chris@297: return m_alignment->getReferenceModel(); Chris@297: } Chris@297: Chris@297: size_t Chris@297: RangeSummarisableTimeValueModel::alignToReference(size_t frame) const Chris@297: { Chris@297: if (!m_alignment) return frame; Chris@297: return m_alignment->toReference(frame); Chris@297: } Chris@297: Chris@297: size_t Chris@297: RangeSummarisableTimeValueModel::alignFromReference(size_t refFrame) const Chris@297: { Chris@297: if (!m_alignment) return refFrame; Chris@297: return m_alignment->fromReference(refFrame); Chris@297: } Chris@297: Chris@297: int Chris@297: RangeSummarisableTimeValueModel::getAlignmentCompletion() const Chris@297: { Chris@297: std::cerr << "RangeSummarisableTimeValueModel::getAlignmentCompletion" << std::endl; Chris@297: if (!m_alignment) return 100; Chris@297: int completion = 0; Chris@297: (void)m_alignment->isReady(&completion); Chris@297: std::cerr << " -> " << completion << std::endl; Chris@297: return completion; Chris@297: } Chris@297: