comparison plugin/transform/ModelTransformerFactory.h @ 384:6f6ab834449d spectrogram-cache-rejig

* Merge from trunk
author Chris Cannam
date Wed, 27 Feb 2008 11:59:42 +0000
parents 13e5870040e6
children
comparison
equal deleted inserted replaced
337:a6fab10ff9e6 384:6f6ab834449d
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 PluginTransformer::ExecutionContext &context, 50 const std::vector<Model *> &candidateInputModels,
52 QString &configurationXml, 51 Model *defaultInputModel,
53 AudioCallbackPlaySource *source = 0, 52 AudioCallbackPlaySource *source = 0,
54 size_t startFrame = 0, 53 size_t startFrame = 0,
55 size_t duration = 0); 54 size_t duration = 0);
56 55
57 /**
58 * Get the default execution context for the given transform
59 * and input model (if known).
60 */
61 PluginTransformer::ExecutionContext getDefaultContextForTransformer(TransformId identifier,
62 Model *inputModel = 0);
63
64 /** 56 /**
65 * Return the output model resulting from applying the named 57 * Return the output model resulting from applying the named
66 * transform to the given input model. The transform may still be 58 * transform to the given input model. The transform may still be
67 * working in the background when the model is returned; check the 59 * working in the background when the model is returned; check the
68 * output model's isReady completion status for more details. 60 * output model's isReady completion status for more details.
69 * 61 *
70 * 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
71 * appropriate type for the given transform, or if some other 63 * appropriate type for the given transform, or if some other
72 * problem occurs, return 0. 64 * problem occurs, return 0. Set message if there is any error or
65 * warning to report.
73 * 66 *
74 * 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
75 * when no longer needed. 68 * when no longer needed.
76 */ 69 */
77 Model *transform(TransformId identifier, Model *inputModel, 70 Model *transform(const Transform &transform,
78 const PluginTransformer::ExecutionContext &context, 71 const ModelTransformer::Input &input,
79 QString configurationXml = ""); 72 QString &message);
80 73
81 protected slots: 74 protected slots:
82 void transformerFinished(); 75 void transformerFinished();
83 76
84 void modelAboutToBeDeleted(Model *); 77 void modelAboutToBeDeleted(Model *);
85 78
86 protected: 79 protected:
87 ModelTransformer *createTransformer(TransformId identifier, Model *inputModel, 80 ModelTransformer *createTransformer(const Transform &transform,
88 const PluginTransformer::ExecutionContext &context, 81 const ModelTransformer::Input &input);
89 QString configurationXml);
90 82
91 typedef std::map<TransformId, QString> TransformerConfigurationMap; 83 typedef std::map<TransformId, QString> TransformerConfigurationMap;
92 TransformerConfigurationMap m_lastConfigurations; 84 TransformerConfigurationMap m_lastConfigurations;
93 85
94 typedef std::set<ModelTransformer *> TransformerSet; 86 typedef std::set<ModelTransformer *> TransformerSet;