Mercurial > hg > svcore
annotate data/model/Model.cpp @ 297:c022976d18e8
* Merge from sv-match-alignment branch (excluding alignment-specific document).
- add aggregate wave model (not yet complete enough to be added as a true
model in a layer, but there's potential)
- add play solo mode
- add alignment model -- unused in plain SV
- fix two plugin leaks
- add m3u playlist support (opens all files at once, potentially hazardous)
- fix retrieval of pre-encoded URLs
- add ability to resample audio files on import, so as to match rates with
other files previously loaded; add preference for same
- add preliminary support in transform code for range and rate of transform
input
- reorganise preferences dialog, move dark-background option to preferences,
add option for temporary directory location
author | Chris Cannam |
---|---|
date | Fri, 28 Sep 2007 13:56:38 +0000 |
parents | 7b96b3bd4bae |
children | 70a232b1f12a |
rev | line source |
---|---|
Chris@150 | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ |
Chris@150 | 2 |
Chris@150 | 3 /* |
Chris@150 | 4 Sonic Visualiser |
Chris@150 | 5 An audio file viewer and annotation editor. |
Chris@150 | 6 Centre for Digital Music, Queen Mary, University of London. |
Chris@150 | 7 This file copyright 2006 Chris Cannam. |
Chris@150 | 8 |
Chris@150 | 9 This program is free software; you can redistribute it and/or |
Chris@150 | 10 modify it under the terms of the GNU General Public License as |
Chris@150 | 11 published by the Free Software Foundation; either version 2 of the |
Chris@150 | 12 License, or (at your option) any later version. See the file |
Chris@150 | 13 COPYING included with this distribution for more information. |
Chris@150 | 14 */ |
Chris@150 | 15 |
Chris@150 | 16 #include "Model.h" |
Chris@150 | 17 #include "base/PlayParameterRepository.h" |
Chris@150 | 18 |
Chris@150 | 19 #include <QTextStream> |
Chris@150 | 20 |
Chris@150 | 21 #include <iostream> |
Chris@150 | 22 |
Chris@150 | 23 const int Model::COMPLETION_UNKNOWN = -1; |
Chris@150 | 24 |
Chris@150 | 25 Model::~Model() |
Chris@150 | 26 { |
Chris@150 | 27 // std::cerr << "Model::~Model(" << this << ")" << std::endl; |
Chris@150 | 28 |
Chris@150 | 29 // Subclasses have to handle adding themselves to the repository, |
Chris@150 | 30 // if they want to be played. We can't do it from here because |
Chris@150 | 31 // the repository would be unable to tell whether we were playable |
Chris@150 | 32 // or not (because dynamic_cast won't work from the base class ctor) |
Chris@150 | 33 PlayParameterRepository::getInstance()->removeModel(this); |
Chris@150 | 34 } |
Chris@150 | 35 |
Chris@150 | 36 void |
Chris@150 | 37 Model::toXml(QTextStream &stream, QString indent, |
Chris@150 | 38 QString extraAttributes) const |
Chris@150 | 39 { |
Chris@150 | 40 stream << indent; |
Chris@150 | 41 stream << QString("<model id=\"%1\" name=\"%2\" sampleRate=\"%3\" start=\"%4\" end=\"%5\" %6/>\n") |
Chris@150 | 42 .arg(getObjectExportId(this)) |
Chris@150 | 43 .arg(encodeEntities(objectName())) |
Chris@150 | 44 .arg(getSampleRate()) |
Chris@150 | 45 .arg(getStartFrame()) |
Chris@150 | 46 .arg(getEndFrame()) |
Chris@150 | 47 .arg(extraAttributes); |
Chris@150 | 48 } |
Chris@150 | 49 |
Chris@150 | 50 QString |
Chris@150 | 51 Model::toXmlString(QString indent, QString extraAttributes) const |
Chris@150 | 52 { |
Chris@150 | 53 QString s; |
Chris@150 | 54 |
Chris@288 | 55 { |
Chris@288 | 56 QTextStream out(&s); |
Chris@288 | 57 toXml(out, indent, extraAttributes); |
Chris@288 | 58 } |
Chris@150 | 59 |
Chris@150 | 60 return s; |
Chris@150 | 61 } |
Chris@150 | 62 |