# HG changeset patch # User Chris Cannam # Date 1385739830 0 # Node ID 539740f231faa57187fc0a4990793f3a91b5d208 # Parent 2d53205f70cd8985126b491673b419a8c0f00d67 Toward running multiple transforms (from same plugin + params) at once diff -r 2d53205f70cd -r 539740f231fa transform/FeatureExtractionModelTransformer.h --- 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(); diff -r 2d53205f70cd -r 539740f231fa transform/ModelTransformerFactory.cpp --- 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; diff -r 2d53205f70cd -r 539740f231fa transform/ModelTransformerFactory.h --- 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 #include #include +#include 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 transformMultiple(const Transforms &transform, + const ModelTransformer::Input &input, + QString &message); protected slots: void transformerFinished(); diff -r 2d53205f70cd -r 539740f231fa transform/Transform.h --- 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 #include +#include typedef QString TransformId; @@ -196,5 +197,7 @@ float m_sampleRate; }; +typedef std::vector Transforms; + #endif