svcore  1.9
AlignmentModel Class Reference

#include <AlignmentModel.h>

Inheritance diagram for AlignmentModel:
Collaboration diagram for AlignmentModel:

Public Slots

void aboutToDelete ()
 
void sourceModelAboutToBeDeleted ()
 

Signals

void modelChanged ()
 
void modelChangedWithin (int startFrame, int endFrame)
 
void completionChanged ()
 
void ready ()
 Emitted when internal processing is complete (i.e. More...
 
void alignmentCompletionChanged ()
 Emitted when the completion percentage changes for the calculation of this model's alignment model. More...
 
void aboutToBeDeleted ()
 Emitted when something notifies this model (through calling aboutToDelete() that it is about to delete it. More...
 

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. More...
 
virtual int getStartFrame () const
 Return the first audio frame spanned by the model. More...
 
virtual int getEndFrame () const
 Return the last audio frame spanned by the model. More...
 
virtual int getSampleRate () const
 Return the frame rate in frames per second. More...
 
virtual Modelclone () const
 Return a copy of this model. More...
 
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. More...
 
virtual const ZoomConstraintgetZoomConstraint () const
 If this model imposes a zoom constraint, i.e. More...
 
QString getTypeName () const
 Return the type of the model. More...
 
const ModelgetReferenceModel () const
 
const ModelgetAlignedModel () const
 
int toReference (int frame) const
 
int fromReference (int frame) const
 
void setPath (PathModel *path)
 
virtual void toXml (QTextStream &stream, QString indent="", QString extraAttributes="") const
 Stream this exportable object out to XML on a text stream. More...
 
virtual int getNativeRate () const
 Return the frame rate of the underlying material, if the model itself has already been resampled. More...
 
virtual QString getTitle () const
 Return the "work title" of the model, if known. More...
 
virtual QString getMaker () const
 Return the "artist" or "maker" of the model, if known. More...
 
virtual QString getLocation () const
 Return the location of the data in this model (e.g. More...
 
virtual void abandon ()
 Mark the model as abandoning. More...
 
virtual bool isAbandoning () const
 Query whether the model has been marked as abandoning. More...
 
virtual ModelgetSourceModel () const
 If this model was derived from another, return the model it was derived from. More...
 
virtual void setSourceModel (Model *model)
 Set the source model for this model. More...
 
virtual void setAlignment (AlignmentModel *alignment)
 Specify an aligment between this model's timeline and that of a reference model. More...
 
virtual const AlignmentModelgetAlignment () const
 Retrieve the alignment model for this model. More...
 
virtual const ModelgetAlignmentReference () const
 Return the reference model for the current alignment timeline, if any. More...
 
virtual int alignToReference (int frame) const
 Return the frame number of the reference model that corresponds to the given frame number in this model. More...
 
virtual int alignFromReference (int referenceFrame) const
 Return the frame number in this model that corresponds to the given frame number of the reference model. More...
 
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. More...
 
void setRDFTypeURI (QString uri)
 Set the event, feature, or signal type URI for the features contained in this model, according to the Audio Features RDF ontology. More...
 
QString getRDFTypeURI () const
 Retrieve the event, feature, or signal type URI for the features contained in this model, if previously set with setRDFTypeURI. More...
 
virtual QString toDelimitedDataString (QString delimiter) const
 
virtual QString toDelimitedDataStringSubset (QString, int, int) const
 
virtual QString toXmlString (QString indent="", QString extraAttributes="") const
 Convert this exportable object to XML in a string. More...
 
virtual bool canPlay () const
 
virtual QString getDefaultPlayClipId () const
 
virtual bool getDefaultPlayAudible () const
 

Static Public Member Functions

static QString encodeEntities (QString)
 
static QString encodeColour (int r, int g, int b)
 
static int getObjectExportId (const void *)
 

Static Public Attributes

static const int COMPLETION_UNKNOWN = -1
 

Protected Slots

void pathChanged ()
 
void pathChangedWithin (int startFrame, int endFrame)
 
void pathCompletionChanged ()
 

Protected Member Functions

void constructPath () const
 
void constructReversePath () const
 
int align (PathModel *path, int 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
 
QString m_typeUri
 
bool m_abandoning
 
bool m_aboutToDelete
 

Detailed Description

Definition at line 28 of file AlignmentModel.h.

Constructor & Destructor Documentation

◆ AlignmentModel()

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

◆ ~AlignmentModel()

AlignmentModel::~AlignmentModel ( )

Definition at line 55 of file AlignmentModel.cpp.

References Model::aboutToDelete(), m_inputModel, m_path, m_rawPath, and m_reversePath.

Member Function Documentation

◆ isOK()

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 71 of file AlignmentModel.cpp.

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

◆ getStartFrame()

int AlignmentModel::getStartFrame ( ) const
virtual

Return the first audio frame spanned by the model.

Implements Model.

Definition at line 78 of file AlignmentModel.cpp.

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

◆ getEndFrame()

int AlignmentModel::getEndFrame ( ) const
virtual

Return the last audio frame spanned by the model.

Implements Model.

Definition at line 86 of file AlignmentModel.cpp.

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

◆ getSampleRate()

int AlignmentModel::getSampleRate ( ) const
virtual

Return the frame rate in frames per second.

Implements Model.

Definition at line 94 of file AlignmentModel.cpp.

References Model::getSampleRate(), and m_reference.

◆ clone()

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 100 of file AlignmentModel.cpp.

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

◆ isReady()

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 109 of file AlignmentModel.cpp.

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

Referenced by Model::getAlignmentCompletion().

◆ getZoomConstraint()

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 123 of file AlignmentModel.cpp.

◆ getTypeName()

QString AlignmentModel::getTypeName ( ) const
inlinevirtual

Return the type of the model.

For display purposes only.

Implements Model.

Definition at line 47 of file AlignmentModel.h.

◆ getReferenceModel()

const Model * AlignmentModel::getReferenceModel ( ) const

Definition at line 129 of file AlignmentModel.cpp.

References m_reference.

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

◆ getAlignedModel()

const Model * AlignmentModel::getAlignedModel ( ) const

Definition at line 135 of file AlignmentModel.cpp.

References m_aligned.

◆ toReference()

int AlignmentModel::toReference ( int  frame) const

Definition at line 141 of file AlignmentModel.cpp.

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

Referenced by Model::alignToReference().

◆ fromReference()

int AlignmentModel::fromReference ( int  frame) const

Definition at line 154 of file AlignmentModel.cpp.

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

Referenced by Model::alignFromReference().

◆ setPath()

void AlignmentModel::setPath ( PathModel path)

◆ toXml()

void AlignmentModel::toXml ( QTextStream &  stream,
QString  indent = "",
QString  extraAttributes = "" 
) const
virtual

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

Reimplemented from Model.

Definition at line 366 of file AlignmentModel.cpp.

References XmlExportable::getObjectExportId(), m_aligned, m_path, m_reference, SVDEBUG, PathModel::toXml(), and Model::toXml().

◆ modelChanged

void AlignmentModel::modelChanged ( )
signal

Referenced by AlignmentModel().

◆ modelChangedWithin

void AlignmentModel::modelChangedWithin ( int  startFrame,
int  endFrame 
)
signal

Referenced by AlignmentModel().

◆ completionChanged

void AlignmentModel::completionChanged ( )
signal

◆ pathChanged

void AlignmentModel::pathChanged ( )
protectedslot

Definition at line 167 of file AlignmentModel.cpp.

References Model::aboutToDelete(), m_pathComplete, and m_rawPath.

Referenced by AlignmentModel().

◆ pathChangedWithin

void AlignmentModel::pathChangedWithin ( int  startFrame,
int  endFrame 
)
protectedslot

Definition at line 178 of file AlignmentModel.cpp.

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

Referenced by AlignmentModel().

◆ pathCompletionChanged

void AlignmentModel::pathCompletionChanged ( )
protectedslot

◆ constructPath()

◆ constructReversePath()

◆ align()

int AlignmentModel::align ( PathModel path,
int  frame 
) const
protected

Definition at line 281 of file AlignmentModel.cpp.

References SparseModel< PointType >::getPoints(), and SVDEBUG.

Referenced by fromReference(), and toReference().

◆ getNativeRate()

virtual int Model::getNativeRate ( ) const
inlinevirtualinherited

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

Reimplemented in WaveFileModel.

Definition at line 69 of file Model.h.

References Model::getSampleRate().

◆ getTitle()

QString Model::getTitle ( ) const
virtualinherited

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

Reimplemented in WaveFileModel.

Definition at line 153 of file Model.cpp.

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

Referenced by Model::getTitle().

◆ getMaker()

QString Model::getMaker ( ) const
virtualinherited

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

Reimplemented in WaveFileModel.

Definition at line 160 of file Model.cpp.

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

Referenced by Model::getMaker().

◆ getLocation()

QString Model::getLocation ( ) const
virtualinherited

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 167 of file Model.cpp.

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

Referenced by Model::getLocation().

◆ abandon()

virtual void Model::abandon ( )
inlinevirtualinherited

Mark the model as abandoning.

This means that the application no longer needs it, so it can stop doing any background calculations it may be involved in. Note that as far as the model API is concerned, this does nothing more than tell the model to return true from isAbandoning(). The actual response to this will depend on the model's context – it's possible nothing at all will change.

Definition at line 118 of file Model.h.

References Model::m_abandoning.

◆ isAbandoning()

virtual bool Model::isAbandoning ( ) const
inlinevirtualinherited

Query whether the model has been marked as abandoning.

Definition at line 125 of file Model.h.

References Model::m_abandoning.

Referenced by FeatureExtractionModelTransformer::setCompletion().

◆ getSourceModel()

virtual Model* Model::getSourceModel ( ) const
inlinevirtualinherited

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 165 of file Model.h.

References Model::m_sourceModel.

◆ setSourceModel()

void Model::setSourceModel ( Model model)
virtualinherited

◆ setAlignment()

void Model::setAlignment ( AlignmentModel alignment)
virtualinherited

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 82 of file Model.cpp.

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

◆ getAlignment()

const AlignmentModel * Model::getAlignment ( ) const
virtualinherited

Retrieve the alignment model for this model.

This is not a generally useful function, as the alignment you really want may be performed by the source model instead. You should normally use getAlignmentReference, alignToReference and alignFromReference instead of this. The main intended application for this function is in streaming out alignments to the session file.

Definition at line 94 of file Model.cpp.

References Model::m_alignment.

◆ getAlignmentReference()

const Model * Model::getAlignmentReference ( ) const
virtualinherited

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

Definition at line 100 of file Model.cpp.

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

Referenced by Model::getAlignmentReference().

◆ alignToReference()

int Model::alignToReference ( int  frame) const
virtualinherited

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

Definition at line 110 of file Model.cpp.

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

Referenced by Model::alignToReference().

◆ alignFromReference()

int Model::alignFromReference ( int  referenceFrame) const
virtualinherited

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

Definition at line 125 of file Model.cpp.

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

Referenced by Model::alignFromReference().

◆ getAlignmentCompletion()

int Model::getAlignmentCompletion ( ) const
virtualinherited

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 139 of file Model.cpp.

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

Referenced by Model::getAlignmentCompletion().

◆ setRDFTypeURI()

void Model::setRDFTypeURI ( QString  uri)
inlineinherited

Set the event, feature, or signal type URI for the features contained in this model, according to the Audio Features RDF ontology.

Definition at line 223 of file Model.h.

References Model::m_typeUri.

Referenced by FeatureExtractionModelTransformer::createOutputModels(), FeatureExtractionModelTransformer::getAdditionalModel(), RDFImporterImpl::getDataModelsDense(), and RDFImporterImpl::getDataModelsSparse().

◆ getRDFTypeURI()

QString Model::getRDFTypeURI ( ) const
inlineinherited

Retrieve the event, feature, or signal type URI for the features contained in this model, if previously set with setRDFTypeURI.

Definition at line 230 of file Model.h.

References Model::m_typeUri.

Referenced by FeatureExtractionModelTransformer::getAdditionalModel().

◆ toDelimitedDataString()

◆ toDelimitedDataStringSubset()

◆ aboutToDelete

void Model::aboutToDelete ( )
slotinherited

◆ sourceModelAboutToBeDeleted

void Model::sourceModelAboutToBeDeleted ( )
slotinherited

Definition at line 76 of file Model.cpp.

References Model::m_sourceModel.

Referenced by Model::setSourceModel().

◆ ready

void Model::ready ( )
signalinherited

Emitted when internal processing is complete (i.e.

when isReady() would return true, with completion at 100).

Referenced by WaveFileModel::cacheFilled(), WaveFileModel::isReady(), AggregateWaveModel::isReady(), and SparseModel< RegionRec >::isReady().

◆ alignmentCompletionChanged

void Model::alignmentCompletionChanged ( )
signalinherited

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

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

◆ aboutToBeDeleted

void Model::aboutToBeDeleted ( )
signalinherited

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(), Dense3DModelPeakCache::Dense3DModelPeakCache(), and Model::setSourceModel().

◆ toXmlString()

QString XmlExportable::toXmlString ( QString  indent = "",
QString  extraAttributes = "" 
) const
virtualinherited

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 ModelTransformerFactory::getConfigurationForTransform(), and RDFTransformFactoryImpl::getTransforms().

◆ encodeEntities()

◆ encodeColour()

QString XmlExportable::encodeColour ( int  r,
int  g,
int  b 
)
staticinherited

Definition at line 54 of file XmlExportable.cpp.

◆ getObjectExportId()

int XmlExportable::getObjectExportId ( const void *  object)
staticinherited

◆ canPlay()

virtual bool Playable::canPlay ( ) const
inlinevirtualinherited

◆ getDefaultPlayClipId()

virtual QString Playable::getDefaultPlayClipId ( ) const
inlinevirtualinherited

◆ getDefaultPlayAudible()

virtual bool Playable::getDefaultPlayAudible ( ) const
inlinevirtualinherited

Reimplemented in SparseTimeValueModel.

Definition at line 28 of file Playable.h.

Referenced by PlayParameterRepository::addPlayable().

Member Data Documentation

◆ m_reference

Model* AlignmentModel::m_reference
protected

◆ m_aligned

Model* AlignmentModel::m_aligned
protected

◆ m_inputModel

Model* AlignmentModel::m_inputModel
protected

Definition at line 75 of file AlignmentModel.h.

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

◆ m_rawPath

◆ m_path

PathModel* AlignmentModel::m_path
mutableprotected

◆ m_reversePath

PathModel* AlignmentModel::m_reversePath
mutableprotected

Definition at line 79 of file AlignmentModel.h.

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

◆ m_pathBegun

bool AlignmentModel::m_pathBegun
protected

Definition at line 80 of file AlignmentModel.h.

Referenced by isReady(), and pathCompletionChanged().

◆ m_pathComplete

bool AlignmentModel::m_pathComplete
protected

Definition at line 81 of file AlignmentModel.h.

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

◆ COMPLETION_UNKNOWN

const int Model::COMPLETION_UNKNOWN = -1
staticinherited

Definition at line 147 of file Model.h.

◆ m_sourceModel

◆ m_alignment

◆ m_typeUri

QString Model::m_typeUri
protectedinherited

Definition at line 303 of file Model.h.

Referenced by Model::getRDFTypeURI(), and Model::setRDFTypeURI().

◆ m_abandoning

bool Model::m_abandoning
protectedinherited

Definition at line 304 of file Model.h.

Referenced by Model::abandon(), and Model::isAbandoning().

◆ m_aboutToDelete

bool Model::m_aboutToDelete
protectedinherited

Definition at line 305 of file Model.h.

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


The documentation for this class was generated from the following files: