Mercurial > hg > svcore
changeset 848:539740f231fa tonioni_multi_transform
Toward running multiple transforms (from same plugin + params) at once
author | Chris Cannam |
---|---|
date | Fri, 29 Nov 2013 15:43:50 +0000 |
parents | 2d53205f70cd |
children | 418cd2064769 |
files | transform/FeatureExtractionModelTransformer.h transform/ModelTransformerFactory.cpp transform/ModelTransformerFactory.h transform/Transform.h |
diffstat | 4 files changed, 46 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/transform/FeatureExtractionModelTransformer.h Tue Nov 26 14:37:01 2013 +0000 +++ b/transform/FeatureExtractionModelTransformer.h Fri Nov 29 15:43:50 2013 +0000 @@ -31,15 +31,22 @@ Q_OBJECT public: - enum PreferredOutputModel { - NoteOutputModel, - FlexiNoteOutputModel, - UndefinedOutputModel = 255 - }; + enum PreferredOutputModel { + NoteOutputModel, + FlexiNoteOutputModel, + UndefinedOutputModel = 255 + }; FeatureExtractionModelTransformer(Input input, const Transform &transform, - const PreferredOutputModel outputmodel); + const PreferredOutputModel outputmodel); + + // 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. + FeatureExtractionModelTransformer(Input input, + const Transforms &relatedTransforms, + const PreferredOutputModel outputmodel); virtual ~FeatureExtractionModelTransformer();
--- a/transform/ModelTransformerFactory.cpp Tue Nov 26 14:37:01 2013 +0000 +++ b/transform/ModelTransformerFactory.cpp Fri Nov 29 15:43:50 2013 +0000 @@ -173,7 +173,7 @@ if (FeatureExtractionPluginFactory::instanceFor(id)) { transformer = - new FeatureExtractionModelTransformer(input, transform, m_preferredOutputModel); + new FeatureExtractionModelTransformer(input, transform); } else if (RealTimePluginFactory::instanceFor(id)) { @@ -193,13 +193,10 @@ Model * ModelTransformerFactory::transform(const Transform &transform, const ModelTransformer::Input &input, - QString &message, - /* outputmodel default value = FeatureExtractionModelTransformer::NoteOutputModel */ - FeatureExtractionModelTransformer::PreferredOutputModel outputmodel) + QString &message) { SVDEBUG << "ModelTransformerFactory::transform: Constructing transformer with input model " << input.getModel() << endl; - m_preferredOutputModel = outputmodel; ModelTransformer *t = createTransformer(transform, input); if (!t) return 0;
--- a/transform/ModelTransformerFactory.h Tue Nov 26 14:37:01 2013 +0000 +++ b/transform/ModelTransformerFactory.h Fri Nov 29 15:43:50 2013 +0000 @@ -27,6 +27,7 @@ #include <QMap> #include <map> #include <set> +#include <vector> class AudioPlaySource; @@ -84,10 +85,33 @@ * The returned model is owned by the caller and must be deleted * when no longer needed. */ - Model *transform(const Transform &transform, - const ModelTransformer::Input &input, - QString &message, - const FeatureExtractionModelTransformer::PreferredOutputModel outputmodel = FeatureExtractionModelTransformer::NoteOutputModel); + Model *transform(const Transform &transform, + const ModelTransformer::Input &input, + QString &message); + + /** + * Return the multiple output models resulting from applying the + * named transforms to the given input model. The transforms may + * differ only in output identifier for the plugin: they must all + * use the same plugin, parameters, and programs. The plugin will + * be run once only, but more than one output will be harvested + * (as appropriate). Models will be returned in the same order as + * the transforms were given. The plugin may still be working in + * the background when the model is returned; check the output + * models' isReady completion statuses for more details. + * + * If a transform is unknown or the transforms are insufficiently + * closely related or the input model is not an appropriate type + * for the given transform, or if some other problem occurs, + * return 0. Set message if there is any error or warning to + * report. + * + * The returned models are owned by the caller and must be deleted + * when no longer needed. + */ + std::vector<Model *> transformMultiple(const Transforms &transform, + const ModelTransformer::Input &input, + QString &message); protected slots: void transformerFinished();
--- a/transform/Transform.h Tue Nov 26 14:37:01 2013 +0000 +++ b/transform/Transform.h Fri Nov 29 15:43:50 2013 +0000 @@ -25,6 +25,7 @@ #include <QString> #include <map> +#include <vector> typedef QString TransformId; @@ -196,5 +197,7 @@ float m_sampleRate; }; +typedef std::vector<Transform> Transforms; + #endif