comparison plugin/transform/ModelTransformerFactory.h @ 383:94fc0591ea43 1.2-stable

* merge from trunk (1.2 ended up being tracked from trunk, but we may want this branch for fixes later)
author Chris Cannam
date Wed, 27 Feb 2008 10:32:45 +0000
parents 700cd3350391
children
comparison
equal deleted inserted replaced
349:f39d33b0b265 383:94fc0591ea43
19 #include "Transform.h" 19 #include "Transform.h"
20 #include "TransformDescription.h" 20 #include "TransformDescription.h"
21 21
22 #include "ModelTransformer.h" 22 #include "ModelTransformer.h"
23 23
24 #include "PluginTransformer.h"
25
26 #include <map> 24 #include <map>
27 #include <set> 25 #include <set>
28 26
29 namespace Vamp { class PluginBase; } 27 namespace Vamp { class PluginBase; }
30 28
38 virtual ~ModelTransformerFactory(); 36 virtual ~ModelTransformerFactory();
39 37
40 static ModelTransformerFactory *getInstance(); 38 static ModelTransformerFactory *getInstance();
41 39
42 /** 40 /**
43 * Get a configuration XML string for the given transform (by 41 * Fill out the configuration for the given transform (by asking
44 * asking the user, most likely). Returns the selected input 42 * the user, most likely). Returns the selected input model and
45 * model if the transform is acceptable, 0 if the operation should 43 * channel if the transform is acceptable, or an input with a null
46 * be cancelled. Audio callback play source may be used to 44 * model if the operation should be cancelled. Audio callback
47 * audition effects plugins, if provided. 45 * play source may be used to audition effects plugins, if
46 * provided.
48 */ 47 */
49 Model *getConfigurationForTransformer(TransformId identifier, 48 ModelTransformer::Input
50 const std::vector<Model *> &candidateInputModels, 49 getConfigurationForTransform(Transform &transform,
51 Model *defaultInputModel, 50 const std::vector<Model *> &candidateInputModels,
52 PluginTransformer::ExecutionContext &context, 51 Model *defaultInputModel,
53 QString &configurationXml, 52 AudioCallbackPlaySource *source = 0,
54 AudioCallbackPlaySource *source = 0, 53 size_t startFrame = 0,
55 size_t startFrame = 0, 54 size_t duration = 0);
56 size_t duration = 0); 55
57
58 /**
59 * Get the default execution context for the given transform
60 * and input model (if known).
61 */
62 PluginTransformer::ExecutionContext getDefaultContextForTransformer(TransformId identifier,
63 Model *inputModel = 0);
64
65 /** 56 /**
66 * Return the output model resulting from applying the named 57 * Return the output model resulting from applying the named
67 * transform to the given input model. The transform may still be 58 * transform to the given input model. The transform may still be
68 * working in the background when the model is returned; check the 59 * working in the background when the model is returned; check the
69 * output model's isReady completion status for more details. 60 * output model's isReady completion status for more details.
70 * 61 *
71 * If the transform is unknown or the input model is not an 62 * If the transform is unknown or the input model is not an
72 * appropriate type for the given transform, or if some other 63 * appropriate type for the given transform, or if some other
73 * problem occurs, return 0. 64 * problem occurs, return 0. Set message if there is any error or
65 * warning to report.
74 * 66 *
75 * The returned model is owned by the caller and must be deleted 67 * The returned model is owned by the caller and must be deleted
76 * when no longer needed. 68 * when no longer needed.
77 */ 69 */
78 Model *transform(TransformId identifier, Model *inputModel, 70 Model *transform(const Transform &transform,
79 const PluginTransformer::ExecutionContext &context, 71 const ModelTransformer::Input &input,
80 QString configurationXml = ""); 72 QString &message);
81 73
82 protected slots: 74 protected slots:
83 void transformerFinished(); 75 void transformerFinished();
84 76
85 void modelAboutToBeDeleted(Model *); 77 void modelAboutToBeDeleted(Model *);
86 78
87 protected: 79 protected:
88 ModelTransformer *createTransformer(TransformId identifier, Model *inputModel, 80 ModelTransformer *createTransformer(const Transform &transform,
89 const PluginTransformer::ExecutionContext &context, 81 const ModelTransformer::Input &input);
90 QString configurationXml);
91 82
92 typedef std::map<TransformId, QString> TransformerConfigurationMap; 83 typedef std::map<TransformId, QString> TransformerConfigurationMap;
93 TransformerConfigurationMap m_lastConfigurations; 84 TransformerConfigurationMap m_lastConfigurations;
94 85
95 typedef std::set<ModelTransformer *> TransformerSet; 86 typedef std::set<ModelTransformer *> TransformerSet;