annotate base/Model.cpp @ 74:47fd14e29813

* Fix long-standing off-by-1 bug in WaveFileModel that was getting us the wrong values for almost all audio data when merging channels (channel == -1) * Implement cut, copy and paste * Make draw mode work properly in time value layer * Minor fixes to CSV import
author Chris Cannam
date Fri, 07 Apr 2006 17:50:33 +0000
parents d397ea0a79f5
children af2725b5d6fe
rev   line source
Chris@49 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@3 2
Chris@3 3 /*
Chris@52 4 Sonic Visualiser
Chris@52 5 An audio file viewer and annotation editor.
Chris@52 6 Centre for Digital Music, Queen Mary, University of London.
Chris@52 7 This file copyright 2006 Chris Cannam.
Chris@3 8
Chris@52 9 This program is free software; you can redistribute it and/or
Chris@52 10 modify it under the terms of the GNU General Public License as
Chris@52 11 published by the Free Software Foundation; either version 2 of the
Chris@52 12 License, or (at your option) any later version. See the file
Chris@52 13 COPYING included with this distribution for more information.
Chris@3 14 */
Chris@0 15
Chris@0 16 #include "Model.h"
Chris@30 17 #include "PlayParameterRepository.h"
Chris@0 18
Chris@43 19 #include <iostream>
Chris@43 20
Chris@0 21 const int Model::COMPLETION_UNKNOWN = -1;
Chris@0 22
Chris@30 23 Model::~Model()
Chris@30 24 {
Chris@43 25 std::cerr << "Model::~Model(" << this << ")" << std::endl;
Chris@43 26
Chris@30 27 // Subclasses have to handle adding themselves to the repository,
Chris@30 28 // if they want to be played. We can't do it from here because
Chris@30 29 // the repository would be unable to tell whether we were playable
Chris@30 30 // or not (because dynamic_cast won't work from the base class ctor)
Chris@30 31 PlayParameterRepository::instance()->removeModel(this);
Chris@30 32 }
Chris@30 33
Chris@3 34 QString
Chris@3 35 Model::toXmlString(QString indent, QString extraAttributes) const
Chris@3 36 {
Chris@3 37 QString s;
Chris@3 38
Chris@3 39 s += indent;
Chris@3 40
Chris@4 41 s += QString("<model id=\"%1\" name=\"%2\" sampleRate=\"%3\" start=\"%4\" end=\"%5\" %6/>\n")
Chris@4 42 .arg(getObjectExportId(this))
Chris@3 43 .arg(objectName())
Chris@4 44 .arg(getSampleRate())
Chris@4 45 .arg(getStartFrame())
Chris@4 46 .arg(getEndFrame())
Chris@3 47 .arg(extraAttributes);
Chris@3 48
Chris@3 49 return s;
Chris@3 50 }
Chris@3 51
Chris@0 52 #ifdef INCLUDE_MOCFILES
Chris@0 53 #ifdef INCLUDE_MOCFILES
Chris@0 54 #include "Model.moc.cpp"
Chris@0 55 #endif
Chris@0 56 #endif
Chris@0 57