#include <FeatureExtractionModelTransformer.h>

Inheritance diagram for FeatureExtractionModelTransformer:
Inheritance graph
Collaboration diagram for FeatureExtractionModelTransformer:
Collaboration graph

Public Types

typedef std::vector< ModelIdModels
 
enum  Type { RTThread, NonRTThread }
 

Public Slots

void start ()
 

Public Member Functions

 FeatureExtractionModelTransformer (Input input, const Transform &transform)
 
 FeatureExtractionModelTransformer (Input input, const Transforms &relatedTransforms)
 Obtain outputs for a set of transforms that all use the same plugin and input (but with different outputs). More...
 
virtual ~FeatureExtractionModelTransformer ()
 
Models getAdditionalOutputModels () override
 Return any additional models that were created during processing. More...
 
bool willHaveAdditionalOutputModels () override
 Return true if the current transform is one that may produce additional models (to be retrieved through getAdditionalOutputModels above). More...
 
void abandon ()
 Hint to the processing thread that it should give up, for example because the process is going to exit or the model/document context is being replaced. More...
 
bool isAbandoned () const
 Return true if the processing thread is being or has been abandoned, i.e. More...
 
ModelId getInputModel ()
 Return the input model for the transform. More...
 
int getInputChannel ()
 Return the input channel spec for the transform. More...
 
Models getOutputModels ()
 Return the set of output model IDs created by the transform or transforms. More...
 
QString getMessage () const
 Return a warning or error message. More...
 

Protected Types

typedef std::map< int, std::map< int, ModelId > > AdditionalModelMap
 

Protected Member Functions

bool initialise ()
 
void deinitialise ()
 
void run () override
 
void createOutputModels (int n)
 
ModelId getAdditionalModel (int transformNo, int binNo)
 
void addFeature (int n, sv_frame_t blockFrame, const Vamp::Plugin::Feature &feature)
 
void setCompletion (int, int)
 
void getFrames (int channelCount, sv_frame_t startFrame, sv_frame_t size, float **buffer)
 
void awaitOutputModels () override
 
template<typename T >
bool isOutputType (int n)
 
template<typename T >
bool setOutputCompletion (int n, int completion)
 

Protected Attributes

std::shared_ptr< Vamp::Plugin > m_plugin
 
std::vector< Vamp::Plugin::OutputDescriptor > m_descriptors
 
std::vector< int > m_fixedRateFeatureNos
 
std::vector< int > m_outputNos
 
std::map< int, bool > m_needAdditionalModels
 
AdditionalModelMap m_additionalModels
 
bool m_haveOutputs
 
QMutex m_outputMutex
 
QWaitCondition m_outputsCondition
 
Transforms m_transforms
 
Input m_input
 
Models m_outputs
 
bool m_abandoned
 
QString m_message
 

Detailed Description

Definition at line 33 of file FeatureExtractionModelTransformer.h.

Member Typedef Documentation

typedef std::map<int, std::map<int, ModelId> > FeatureExtractionModelTransformer::AdditionalModelMap
protected

Definition at line 78 of file FeatureExtractionModelTransformer.h.

typedef std::vector<ModelId> ModelTransformer::Models
inherited

Definition at line 42 of file ModelTransformer.h.

Member Enumeration Documentation

enum Thread::Type
inherited
Enumerator
RTThread 
NonRTThread 

Definition at line 29 of file Thread.h.

Constructor & Destructor Documentation

FeatureExtractionModelTransformer::FeatureExtractionModelTransformer ( Input  input,
const Transform transform 
)
FeatureExtractionModelTransformer::FeatureExtractionModelTransformer ( Input  input,
const Transforms relatedTransforms 
)

Obtain outputs for a set of transforms that all use the same plugin and input (but with different outputs).

i.e. run the plugin once only and collect more than one output from it.

Definition at line 53 of file FeatureExtractionModelTransformer.cpp.

References ModelTransformer::m_transforms, and SVDEBUG.

FeatureExtractionModelTransformer::~FeatureExtractionModelTransformer ( )
virtual

Definition at line 558 of file FeatureExtractionModelTransformer.cpp.

Member Function Documentation

FeatureExtractionModelTransformer::Models FeatureExtractionModelTransformer::getAdditionalOutputModels ( )
overridevirtual

Return any additional models that were created during processing.

This might happen if, for example, a transform was configured to split a multi-bin output into separate single-bin models as it processed. These should not be queried until after the transform has completed.

Reimplemented from ModelTransformer.

Definition at line 566 of file FeatureExtractionModelTransformer.cpp.

References m_additionalModels.

bool FeatureExtractionModelTransformer::willHaveAdditionalOutputModels ( )
overridevirtual

Return true if the current transform is one that may produce additional models (to be retrieved through getAdditionalOutputModels above).

Reimplemented from ModelTransformer.

Definition at line 578 of file FeatureExtractionModelTransformer.cpp.

References m_needAdditionalModels.

void FeatureExtractionModelTransformer::deinitialise ( )
protected

Definition at line 264 of file FeatureExtractionModelTransformer.cpp.

References m_descriptors, ModelTransformer::m_message, m_plugin, SVCERR, and SVDEBUG.

Referenced by run().

void FeatureExtractionModelTransformer::createOutputModels ( int  n)
protected

!! SV doesn't actually support display of models that have !! different underlying rates together – so we always set !! the model rate to be the input model's rate, and adjust !! the resolution appropriately. We can't properly display !! data with a higher resolution than the base model at all

Definition at line 284 of file FeatureExtractionModelTransformer.cpp.

References TypedById< Item, Id >::add(), NoteModel::FLEXI_NOTE, ModelTransformer::getInputModel(), PluginRDFDescription::getOutputEventTypeURI(), PluginRDFDescription::getOutputSignalTypeURI(), m_descriptors, m_needAdditionalModels, m_outputNos, ModelTransformer::m_outputs, m_plugin, ModelTransformer::m_transforms, NoteModel::NORMAL_NOTE, RegionModel::setScaleUnits(), SparseTimeValueModel::setScaleUnits(), NoteModel::setScaleUnits(), and SVDEBUG.

Referenced by initialise().

ModelId FeatureExtractionModelTransformer::getAdditionalModel ( int  transformNo,
int  binNo 
)
protected
void FeatureExtractionModelTransformer::setCompletion ( int  n,
int  completion 
)
protected

Definition at line 1193 of file FeatureExtractionModelTransformer.cpp.

References SVDEBUG.

Referenced by initialise(), and run().

void FeatureExtractionModelTransformer::getFrames ( int  channelCount,
sv_frame_t  startFrame,
sv_frame_t  size,
float **  buffer 
)
protected
void FeatureExtractionModelTransformer::awaitOutputModels ( )
overrideprotectedvirtual
template<typename T >
bool FeatureExtractionModelTransformer::isOutputType ( int  n)
inlineprotected

Definition at line 98 of file FeatureExtractionModelTransformer.h.

References ModelTransformer::m_outputs.

template<typename T >
bool FeatureExtractionModelTransformer::setOutputCompletion ( int  n,
int  completion 
)
inlineprotected

Definition at line 106 of file FeatureExtractionModelTransformer.h.

References ModelTransformer::m_outputs.

void ModelTransformer::abandon ( )
inlineinherited

Hint to the processing thread that it should give up, for example because the process is going to exit or the model/document context is being replaced.

Caller should still wait() to be sure that processing has ended.

Definition at line 66 of file ModelTransformer.h.

References ModelTransformer::m_abandoned.

Referenced by addFeature(), RealTimeEffectModelTransformer::run(), and run().

bool ModelTransformer::isAbandoned ( ) const
inlineinherited

Return true if the processing thread is being or has been abandoned, i.e.

if abandon() has been called.

Definition at line 72 of file ModelTransformer.h.

References ModelTransformer::m_abandoned.

Referenced by ModelTransformerFactory::transformerFinished().

ModelId ModelTransformer::getInputModel ( )
inlineinherited
int ModelTransformer::getInputChannel ( )
inlineinherited

Return the input channel spec for the transform.

Definition at line 82 of file ModelTransformer.h.

References ModelTransformer::Input::getChannel(), and ModelTransformer::m_input.

Models ModelTransformer::getOutputModels ( )
inlineinherited

Return the set of output model IDs created by the transform or transforms.

Returns an empty list if any transform could not be initialised; an error message may be available via getMessage() in this situation. The returned models have been added to ModelById.

Definition at line 91 of file ModelTransformer.h.

References ModelTransformer::awaitOutputModels(), and ModelTransformer::m_outputs.

Referenced by ModelTransformerFactory::transformMultiple().

QString ModelTransformer::getMessage ( ) const
inlineinherited

Return a warning or error message.

If getOutputModel returned a null pointer, this should contain a fatal error message for the transformer; otherwise it may contain a warning to show to the user about e.g. suboptimal block size or whatever.

Definition at line 118 of file ModelTransformer.h.

References ModelTransformer::awaitOutputModels(), ModelTransformer::m_message, and ModelTransformer::ModelTransformer().

Referenced by ModelTransformerFactory::transformerFinished(), and ModelTransformerFactory::transformMultiple().

Member Data Documentation

std::shared_ptr<Vamp::Plugin> FeatureExtractionModelTransformer::m_plugin
protected
std::vector<Vamp::Plugin::OutputDescriptor> FeatureExtractionModelTransformer::m_descriptors
protected
std::vector<int> FeatureExtractionModelTransformer::m_fixedRateFeatureNos
protected

Definition at line 67 of file FeatureExtractionModelTransformer.h.

Referenced by addFeature(), and initialise().

std::vector<int> FeatureExtractionModelTransformer::m_outputNos
protected

Definition at line 70 of file FeatureExtractionModelTransformer.h.

Referenced by createOutputModels(), initialise(), and run().

std::map<int, bool> FeatureExtractionModelTransformer::m_needAdditionalModels
protected
AdditionalModelMap FeatureExtractionModelTransformer::m_additionalModels
protected
bool FeatureExtractionModelTransformer::m_haveOutputs
protected

Definition at line 93 of file FeatureExtractionModelTransformer.h.

Referenced by awaitOutputModels(), and initialise().

QMutex FeatureExtractionModelTransformer::m_outputMutex
protected

Definition at line 94 of file FeatureExtractionModelTransformer.h.

Referenced by awaitOutputModels(), and initialise().

QWaitCondition FeatureExtractionModelTransformer::m_outputsCondition
protected

Definition at line 95 of file FeatureExtractionModelTransformer.h.

Referenced by awaitOutputModels(), and initialise().

Input ModelTransformer::m_input
protectedinherited
QString ModelTransformer::m_message
protectedinherited

Definition at line 130 of file ModelTransformer.h.

Referenced by deinitialise(), ModelTransformer::getMessage(), initialise(), and run().


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