AlignmentModel Class Reference

#include <AlignmentModel.h>

Inherits Model.

Inheritance diagram for AlignmentModel:

Inheritance graph
[legend]
Collaboration diagram for AlignmentModel:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 28 of file AlignmentModel.h.

Public Slots

void aboutToDelete ()
void sourceModelAboutToBeDeleted ()

Signals

void modelChanged ()
 Emitted when a model has been edited (or more data retrieved from cache, in the case of a cached model that generates slowly).
void modelChanged (size_t startFrame, size_t endFrame)
 Emitted when a model has been edited (or more data retrieved from cache, in the case of a cached model that generates slowly).
void completionChanged ()
 Emitted when some internal processing has advanced a stage, but the model has not changed externally.
void alignmentCompletionChanged ()
 Emitted when the completion percentage changes for the calculation of this model's alignment model.
void aboutToBeDeleted ()
 Emitted when something notifies this model (through calling aboutToDelete() that it is about to delete it.

Public Member Functions

 AlignmentModel (Model *reference, Model *aligned, Model *inputModel, SparseTimeValueModel *path)
 ~AlignmentModel ()
virtual bool isOK () const
 Return true if the model was constructed successfully.
virtual size_t getStartFrame () const
 Return the first audio frame spanned by the model.
virtual size_t getEndFrame () const
 Return the last audio frame spanned by the model.
virtual size_t getSampleRate () const
 Return the frame rate in frames per second.
virtual Modelclone () const
 Return a copy of this model.
virtual bool isReady (int *completion=0) const
 Return true if the model has finished loading or calculating all its data, for a model that is capable of calculating in a background thread.
virtual const ZoomConstraintgetZoomConstraint () const
 If this model imposes a zoom constraint, i.e.
QString getTypeName () const
 Return the type of the model.
const ModelgetReferenceModel () const
const ModelgetAlignedModel () const
size_t toReference (size_t frame) const
size_t fromReference (size_t frame) const
virtual size_t getNativeRate () const
 Return the frame rate of the underlying material, if the model itself has already been resampled.
virtual QString getTitle () const
 Return the "work title" of the model, if known.
virtual QString getMaker () const
 Return the "artist" or "maker" of the model, if known.
virtual QString getLocation () const
 Return the location of the data in this model (e.g.
virtual ModelgetSourceModel () const
 If this model was derived from another, return the model it was derived from.
virtual void setSourceModel (Model *model)
 Set the source model for this model.
virtual void setAlignment (AlignmentModel *alignment)
 Specify an aligment between this model's timeline and that of a reference model.
virtual const ModelgetAlignmentReference () const
 Return the reference model for the current alignment timeline, if any.
virtual size_t alignToReference (size_t frame) const
 Return the frame number of the reference model that corresponds to the given frame number in this model.
virtual size_t alignFromReference (size_t referenceFrame) const
 Return the frame number in this model that corresponds to the given frame number of the reference model.
virtual int getAlignmentCompletion () const
 Return the completion percentage for the alignment model: 100 if there is no alignment model or it has been entirely calculated, or less than 100 if it is still being calculated.
virtual void toXml (QTextStream &stream, QString indent="", QString extraAttributes="") const
 Stream this exportable object out to XML on a text stream.
virtual QString toDelimitedDataString (QString) const
virtual QString toXmlString (QString indent="", QString extraAttributes="") const
 Convert this exportable object to XML in a string.

Static Public Member Functions

static QString encodeEntities (QString)
static QString encodeColour (QColor)
static int getObjectExportId (const void *)

Static Public Attributes

static const int COMPLETION_UNKNOWN

Protected Slots

void pathChanged ()
void pathChanged (size_t startFrame, size_t endFrame)
void pathCompletionChanged ()

Protected Member Functions

void constructPath () const
void constructReversePath () const
size_t align (PathModel *path, size_t frame) const

Protected Attributes

Modelm_reference
Modelm_aligned
Modelm_inputModel
SparseTimeValueModelm_rawPath
PathModelm_path
PathModelm_reversePath
bool m_pathBegun
bool m_pathComplete
Modelm_sourceModel
AlignmentModelm_alignment
bool m_aboutToDelete

Classes

class  PathModel
struct  PathPoint


Constructor & Destructor Documentation

AlignmentModel::AlignmentModel ( Model reference,
Model aligned,
Model inputModel,
SparseTimeValueModel path 
)

Definition at line 22 of file AlignmentModel.cpp.

References completionChanged(), constructPath(), constructReversePath(), m_rawPath, modelChanged(), pathChanged(), and pathCompletionChanged().

Referenced by clone().

AlignmentModel::~AlignmentModel (  ) 

Definition at line 51 of file AlignmentModel.cpp.

References m_inputModel, m_path, m_rawPath, and m_reversePath.


Member Function Documentation

bool AlignmentModel::isOK (  )  const [virtual]

Return true if the model was constructed successfully.

Classes that refer to the model should always test this before use.

Implements Model.

Definition at line 60 of file AlignmentModel.cpp.

References SparseModel< PointType >::isOK(), and m_rawPath.

size_t AlignmentModel::getStartFrame (  )  const [virtual]

Return the first audio frame spanned by the model.

Implements Model.

Definition at line 67 of file AlignmentModel.cpp.

References Model::getStartFrame(), m_aligned, and m_reference.

size_t AlignmentModel::getEndFrame (  )  const [virtual]

Return the last audio frame spanned by the model.

Implements Model.

Definition at line 75 of file AlignmentModel.cpp.

References Model::getEndFrame(), m_aligned, and m_reference.

size_t AlignmentModel::getSampleRate (  )  const [virtual]

Return the frame rate in frames per second.

Implements Model.

Definition at line 83 of file AlignmentModel.cpp.

References Model::getSampleRate(), and m_reference.

Model * AlignmentModel::clone (  )  const [virtual]

Return a copy of this model.

If the model is not editable, this may be effectively a shallow copy. If the model is editable, however, this operation must properly copy all of the model's editable data.

In general this operation is not useful for non-editable dense models such as waveforms, because there may be no efficient copy operation implemented -- for such models it is better not to copy at all.

Caller owns the returned value.

Implements Model.

Definition at line 89 of file AlignmentModel.cpp.

References AlignmentModel(), SparseModel< PointType >::clone(), Model::clone(), m_aligned, m_inputModel, m_rawPath, and m_reference.

bool AlignmentModel::isReady ( int *  completion = 0  )  const [virtual]

Return true if the model has finished loading or calculating all its data, for a model that is capable of calculating in a background thread.

The default implementation is appropriate for a thread that does not background any work but carries out all its calculation from the constructor or accessors.

If "completion" is non-NULL, this function should return through it an estimated percentage value showing how far through the background operation it thinks it is (for progress reporting). If it has no way to calculate progress, it may return the special value COMPLETION_UNKNOWN.

Reimplemented from Model.

Definition at line 98 of file AlignmentModel.cpp.

References SparseModel< PointType >::isReady(), m_pathBegun, m_pathComplete, and m_rawPath.

Referenced by Model::getAlignmentCompletion().

const ZoomConstraint * AlignmentModel::getZoomConstraint (  )  const [virtual]

If this model imposes a zoom constraint, i.e.

some limit to the set of resolutions at which its data can meaningfully be displayed, then return it.

Reimplemented from Model.

Definition at line 112 of file AlignmentModel.cpp.

QString AlignmentModel::getTypeName (  )  const [inline, virtual]

Return the type of the model.

For display purposes only.

Implements Model.

Definition at line 47 of file AlignmentModel.h.

const Model * AlignmentModel::getReferenceModel (  )  const

Definition at line 118 of file AlignmentModel.cpp.

References m_reference.

Referenced by Model::alignToReference(), and Model::getAlignmentReference().

const Model * AlignmentModel::getAlignedModel (  )  const

Definition at line 124 of file AlignmentModel.cpp.

References m_aligned.

size_t AlignmentModel::toReference ( size_t  frame  )  const

Definition at line 130 of file AlignmentModel.cpp.

References align(), constructPath(), m_path, and m_rawPath.

Referenced by Model::alignToReference().

size_t AlignmentModel::fromReference ( size_t  frame  )  const

Definition at line 143 of file AlignmentModel.cpp.

References align(), constructReversePath(), m_rawPath, and m_reversePath.

Referenced by Model::alignFromReference().

void AlignmentModel::modelChanged (  )  [signal]

Emitted when a model has been edited (or more data retrieved from cache, in the case of a cached model that generates slowly).

Reimplemented from Model.

Referenced by AlignmentModel().

void AlignmentModel::modelChanged ( size_t  startFrame,
size_t  endFrame 
) [signal]

Emitted when a model has been edited (or more data retrieved from cache, in the case of a cached model that generates slowly).

Reimplemented from Model.

void AlignmentModel::completionChanged (  )  [signal]

Emitted when some internal processing has advanced a stage, but the model has not changed externally.

Views should respond by updating any progress meters or other monitoring, but not refreshing the actual view.

Reimplemented from Model.

Referenced by AlignmentModel(), and pathCompletionChanged().

void AlignmentModel::pathChanged (  )  [protected, slot]

Definition at line 156 of file AlignmentModel.cpp.

References m_pathComplete, and m_rawPath.

Referenced by AlignmentModel().

void AlignmentModel::pathChanged ( size_t  startFrame,
size_t  endFrame 
) [protected, slot]

Definition at line 166 of file AlignmentModel.cpp.

References constructPath(), constructReversePath(), and m_pathComplete.

void AlignmentModel::pathCompletionChanged (  )  [protected, slot]

Definition at line 174 of file AlignmentModel.cpp.

References completionChanged(), constructPath(), constructReversePath(), SparseModel< PointType >::isReady(), m_inputModel, m_pathBegun, m_pathComplete, and m_rawPath.

Referenced by AlignmentModel().

void AlignmentModel::constructPath (  )  const [protected]

Definition at line 205 of file AlignmentModel.cpp.

References SparseModel< PointType >::addPoint(), SparseModel< PointType >::clear(), SparseModel< PointType >::getPointCount(), SparseModel< PointType >::getPoints(), SparseModel< PointType >::getResolution(), Model::getSampleRate(), SparseModel< PointType >::getSampleRate(), m_aligned, m_path, and m_rawPath.

Referenced by AlignmentModel(), pathChanged(), pathCompletionChanged(), and toReference().

void AlignmentModel::constructReversePath (  )  const [protected]

Definition at line 237 of file AlignmentModel.cpp.

References SparseModel< PointType >::addPoint(), SparseModel< PointType >::clear(), SparseModel< PointType >::getPointCount(), SparseModel< PointType >::getPoints(), SparseModel< PointType >::getResolution(), Model::getSampleRate(), SparseModel< PointType >::getSampleRate(), m_aligned, m_rawPath, and m_reversePath.

Referenced by AlignmentModel(), fromReference(), pathChanged(), and pathCompletionChanged().

size_t AlignmentModel::align ( PathModel path,
size_t  frame 
) const [protected]

Definition at line 269 of file AlignmentModel.cpp.

References SparseModel< PointType >::getPoints().

Referenced by fromReference(), and toReference().

virtual size_t Model::getNativeRate (  )  const [inline, virtual, inherited]

Return the frame rate of the underlying material, if the model itself has already been resampled.

Reimplemented in WaveFileModel.

Definition at line 67 of file Model.h.

References Model::getSampleRate().

Referenced by Pane::drawDurationAndRate().

QString Model::getTitle (  )  const [virtual, inherited]

Return the "work title" of the model, if known.

Reimplemented in WaveFileModel.

Definition at line 150 of file Model.cpp.

References Model::getTitle(), and Model::m_sourceModel.

Referenced by Pane::drawWorkTitle(), and Model::getTitle().

QString Model::getMaker (  )  const [virtual, inherited]

Return the "artist" or "maker" of the model, if known.

Reimplemented in WaveFileModel.

Definition at line 157 of file Model.cpp.

References Model::getMaker(), and Model::m_sourceModel.

Referenced by ModelDataModel::data(), Pane::drawWorkTitle(), and Model::getMaker().

QString Model::getLocation (  )  const [virtual, inherited]

Return the location of the data in this model (e.g.

source URL). This should not normally be returned for editable models that have been edited.

Reimplemented in WaveFileModel.

Definition at line 164 of file Model.cpp.

References Model::getLocation(), and Model::m_sourceModel.

Referenced by ModelDataModel::data(), and Model::getLocation().

virtual Model* Model::getSourceModel (  )  const [inline, virtual, inherited]

If this model was derived from another, return the model it was derived from.

The assumption is that the source model's alignment will also apply to this model, unless some other property (such as a specific alignment model set on this model) indicates otherwise.

Definition at line 143 of file Model.h.

References Model::m_sourceModel.

Referenced by View::checkProgress(), and Pane::paintEvent().

void Model::setSourceModel ( Model model  )  [virtual, inherited]

Set the source model for this model.

Definition at line 49 of file Model.cpp.

References Model::aboutToBeDeleted(), Model::alignmentCompletionChanged(), Model::m_sourceModel, and Model::sourceModelAboutToBeDeleted().

Referenced by Document::addDerivedModel(), FeatureExtractionModelTransformer::FeatureExtractionModelTransformer(), and FFTModel::FFTModel().

void Model::setAlignment ( AlignmentModel alignment  )  [virtual, inherited]

Specify an aligment between this model's timeline and that of a reference model.

The alignment model records both the reference and the alignment. This model takes ownership of the alignment model.

Definition at line 89 of file Model.cpp.

References Model::aboutToDelete(), Model::alignmentCompletionChanged(), Model::completionChanged(), and Model::m_alignment.

Referenced by Document::alignModel().

const Model * Model::getAlignmentReference (  )  const [virtual, inherited]

Return the reference model for the current alignment timeline, if any.

Definition at line 101 of file Model.cpp.

References Model::getAlignmentReference(), getReferenceModel(), Model::m_alignment, and Model::m_sourceModel.

Referenced by Layer::alignFromReference(), Document::alignModel(), Layer::alignToReference(), Pane::drawAlignmentStatus(), View::getAligningModel(), and Model::getAlignmentReference().

size_t Model::alignToReference ( size_t  frame  )  const [virtual, inherited]

Return the frame number of the reference model that corresponds to the given frame number in this model.

Definition at line 111 of file Model.cpp.

References Model::getEndFrame(), getReferenceModel(), Model::m_alignment, Model::m_sourceModel, and toReference().

Referenced by ViewManager::alignPlaybackFrameToReference(), View::alignToReference(), and Layer::alignToReference().

size_t Model::alignFromReference ( size_t  referenceFrame  )  const [virtual, inherited]

Return the frame number in this model that corresponds to the given frame number of the reference model.

Definition at line 124 of file Model.cpp.

References fromReference(), Model::getEndFrame(), Model::m_alignment, and Model::m_sourceModel.

Referenced by View::alignFromReference(), Layer::alignFromReference(), ViewManager::alignReferenceToPlaybackFrame(), and View::getAlignedPlaybackFrame().

int Model::getAlignmentCompletion (  )  const [virtual, inherited]

Return the completion percentage for the alignment model: 100 if there is no alignment model or it has been entirely calculated, or less than 100 if it is still being calculated.

Definition at line 136 of file Model.cpp.

References isReady(), Model::m_alignment, and Model::m_sourceModel.

Referenced by View::checkProgress(), and Pane::drawAlignmentStatus().

void Model::toXml ( QTextStream &  stream,
QString  indent = "",
QString  extraAttributes = "" 
) const [virtual, inherited]

Stream this exportable object out to XML on a text stream.

Implements XmlExportable.

Reimplemented in AggregateWaveModel, EditableDenseThreeDimensionalModel, ImageModel, NoteModel, SparseModel< PointType >, SparseValueModel< PointType >, TextModel, WaveFileModel, WritableWaveFileModel, SparseModel< Note >, SparseModel< TextPoint >, SparseModel< ImagePoint >, SparseModel< TimeValuePoint >, SparseModel< OneDimensionalPoint >, SparseModel< AlignmentModel::PathPoint >, SparseValueModel< Note >, and SparseValueModel< TimeValuePoint >.

Definition at line 171 of file Model.cpp.

References XmlExportable::encodeEntities(), Model::getEndFrame(), XmlExportable::getObjectExportId(), Model::getSampleRate(), and Model::getStartFrame().

Referenced by WritableWaveFileModel::toXml(), WaveFileModel::toXml(), SparseModel< PointType >::toXml(), and EditableDenseThreeDimensionalModel::toXml().

virtual QString Model::toDelimitedDataString ( QString   )  const [inline, virtual, inherited]

Reimplemented in EditableDenseThreeDimensionalModel, SparseModel< PointType >, SparseModel< Note >, SparseModel< TextPoint >, SparseModel< ImagePoint >, SparseModel< TimeValuePoint >, SparseModel< OneDimensionalPoint >, and SparseModel< AlignmentModel::PathPoint >.

Definition at line 189 of file Model.h.

Referenced by CSVFileWriter::write().

void Model::aboutToDelete (  )  [slot, inherited]

Definition at line 67 of file Model.cpp.

References Model::aboutToBeDeleted(), and Model::m_aboutToDelete.

Referenced by Document::releaseModel(), Model::setAlignment(), Document::setMainModel(), SpectrumLayer::setModel(), SpectrumLayer::setupFFT(), Document::~Document(), Model::~Model(), and SpectrumLayer::~SpectrumLayer().

void Model::sourceModelAboutToBeDeleted (  )  [slot, inherited]

Reimplemented in FFTModel.

Definition at line 83 of file Model.cpp.

References Model::m_sourceModel.

Referenced by Model::setSourceModel().

void Model::alignmentCompletionChanged (  )  [signal, inherited]

Emitted when the completion percentage changes for the calculation of this model's alignment model.

Referenced by Model::setAlignment(), and Model::setSourceModel().

void Model::aboutToBeDeleted (  )  [signal, inherited]

Emitted when something notifies this model (through calling aboutToDelete() that it is about to delete it.

Note that this depends on an external agent such as a Document object or owning model telling the model that it is about to delete it; there is nothing in the model to guarantee that this signal will be emitted before the actual deletion.

Referenced by Model::aboutToDelete(), and Model::setSourceModel().

QString XmlExportable::toXmlString ( QString  indent = "",
QString  extraAttributes = "" 
) const [virtual, inherited]

Convert this exportable object to XML in a string.

The default implementation calls toXml and returns the result as a string. Do not override this unless you really know what you're doing.

Definition at line 25 of file XmlExportable.cpp.

References XmlExportable::toXml().

Referenced by LayerFactory::setLayerDefaultProperties().

QString XmlExportable::encodeEntities ( QString   )  [static, inherited]

Definition at line 41 of file XmlExportable.cpp.

Referenced by AudioGenerator::getDefaultPlayPluginConfiguration(), SVFileReader::readPlugin(), Layer::toBriefXml(), WaveFileModel::toXml(), Transform::toXml(), TextPoint::toXml(), PluginXml::toXml(), Model::toXml(), Layer::toXml(), ImagePoint::toXml(), and Document::writeBackwardCompatibleDerivation().

QString XmlExportable::encodeColour ( QColor   )  [static, inherited]

Definition at line 54 of file XmlExportable.cpp.

Referenced by ColourDatabase::getStringValues().

int XmlExportable::getObjectExportId ( const void *   )  [static, inherited]

Definition at line 71 of file XmlExportable.cpp.

Referenced by FFTDataServer::generateFileBasename(), View::getTextLabelHeight(), Layer::toBriefXml(), SparseModel< PointType >::toXml(), Model::toXml(), Layer::toXml(), EditableDenseThreeDimensionalModel::toXml(), Document::toXml(), and Document::writeBackwardCompatibleDerivation().


Member Data Documentation

Model* AlignmentModel::m_reference [protected]

Definition at line 66 of file AlignmentModel.h.

Referenced by clone(), getEndFrame(), getReferenceModel(), getSampleRate(), and getStartFrame().

Model* AlignmentModel::m_aligned [protected]

Definition at line 67 of file AlignmentModel.h.

Referenced by clone(), constructPath(), constructReversePath(), getAlignedModel(), getEndFrame(), and getStartFrame().

Model* AlignmentModel::m_inputModel [protected]

Definition at line 69 of file AlignmentModel.h.

Referenced by clone(), pathCompletionChanged(), and ~AlignmentModel().

SparseTimeValueModel* AlignmentModel::m_rawPath [protected]

Definition at line 119 of file AlignmentModel.h.

Referenced by AlignmentModel(), clone(), constructPath(), constructReversePath(), fromReference(), isOK(), isReady(), pathChanged(), pathCompletionChanged(), toReference(), and ~AlignmentModel().

PathModel* AlignmentModel::m_path [mutable, protected]

Definition at line 120 of file AlignmentModel.h.

Referenced by constructPath(), toReference(), and ~AlignmentModel().

PathModel* AlignmentModel::m_reversePath [mutable, protected]

Definition at line 121 of file AlignmentModel.h.

Referenced by constructReversePath(), fromReference(), and ~AlignmentModel().

bool AlignmentModel::m_pathBegun [protected]

Definition at line 122 of file AlignmentModel.h.

Referenced by isReady(), and pathCompletionChanged().

bool AlignmentModel::m_pathComplete [protected]

Definition at line 123 of file AlignmentModel.h.

Referenced by isReady(), pathChanged(), and pathCompletionChanged().

const int Model::COMPLETION_UNKNOWN [static, inherited]

Definition at line 125 of file Model.h.

Model* Model::m_sourceModel [protected, inherited]

Definition at line 239 of file Model.h.

Referenced by Model::alignFromReference(), Model::alignToReference(), Model::getAlignmentCompletion(), Model::getAlignmentReference(), Model::getLocation(), Model::getMaker(), Model::getSourceModel(), Model::getTitle(), Model::setSourceModel(), Model::sourceModelAboutToBeDeleted(), and FFTModel::sourceModelAboutToBeDeleted().

AlignmentModel* Model::m_alignment [protected, inherited]

Definition at line 240 of file Model.h.

Referenced by Model::alignFromReference(), Model::alignToReference(), Model::getAlignmentCompletion(), Model::getAlignmentReference(), Model::setAlignment(), and Model::~Model().

bool Model::m_aboutToDelete [protected, inherited]

Definition at line 241 of file Model.h.

Referenced by Model::aboutToDelete(), and Model::~Model().


The documentation for this class was generated from the following files:
Generated on Wed Feb 20 15:45:31 2008 for SonicVisualiser by  doxygen 1.5.1