svcore  1.9
ModelTransformerFactory.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  Sonic Visualiser
5  An audio file viewer and annotation editor.
6  Centre for Digital Music, Queen Mary, University of London.
7  This file copyright 2006 Chris Cannam and QMUL.
8 
9  This program is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of the
12  License, or (at your option) any later version. See the file
13  COPYING included with this distribution for more information.
14 */
15 
16 #ifndef _MODEL_TRANSFORMER_FACTORY_H_
17 #define _MODEL_TRANSFORMER_FACTORY_H_
18 
19 #include "Transform.h"
20 #include "TransformDescription.h"
22 
23 #include "ModelTransformer.h"
24 
25 #include <vamp-hostsdk/PluginBase.h>
26 
27 #include <QMap>
28 #include <map>
29 #include <set>
30 #include <vector>
31 
32 class AudioPlaySource;
33 
34 class ModelTransformerFactory : public QObject
35 {
36  Q_OBJECT
37 
38 public:
39  virtual ~ModelTransformerFactory();
40 
42 
44  public:
45  virtual bool configure(ModelTransformer::Input &input,
47  Vamp::PluginBase *plugin,
48  Model *&inputModel,
49  AudioPlaySource *source,
50  int startFrame,
51  int duration,
52  const QMap<QString, Model *> &modelMap,
53  QStringList candidateModelNames,
54  QString defaultModelName) = 0;
55  };
56 
67  const std::vector<Model *> &candidateInputModels,
68  Model *defaultInputModel,
69  AudioPlaySource *source = 0,
70  int startFrame = 0,
71  int duration = 0,
72  UserConfigurator *configurator = 0);
73 
75  public:
77 
78  // Exactly one of these functions will be called
79  virtual void moreModelsAvailable(std::vector<Model *> models) = 0;
80  virtual void noMoreModelsAvailable() = 0;
81  };
82 
107  const ModelTransformer::Input &input,
108  QString &message,
109  AdditionalModelHandler *handler = 0);
110 
143  std::vector<Model *> transformMultiple(const Transforms &transform,
144  const ModelTransformer::Input &input,
145  QString &message,
146  AdditionalModelHandler *handler = 0);
147 
148 protected slots:
149  void transformerFinished();
150 
152 
153 protected:
154  ModelTransformer *createTransformer(const Transforms &transforms,
155  const ModelTransformer::Input &input);
156 
157  typedef std::map<TransformId, QString> TransformerConfigurationMap;
159 
160  typedef std::set<ModelTransformer *> TransformerSet;
162 
163  typedef std::map<ModelTransformer *, AdditionalModelHandler *> HandlerMap;
165 
167 };
168 
169 
170 #endif
Simple interface for audio playback.
std::vector< Model * > transformMultiple(const Transforms &transform, const ModelTransformer::Input &input, QString &message, AdditionalModelHandler *handler=0)
Return the multiple output models resulting from applying the named transforms to the given input mod...
ModelTransformer * createTransformer(const Transforms &transforms, const ModelTransformer::Input &input)
std::set< ModelTransformer * > TransformerSet
std::vector< Transform > Transforms
Definition: Transform.h:200
static ModelTransformerFactory * getInstance()
ModelTransformer::Input getConfigurationForTransform(Transform &transform, const std::vector< Model * > &candidateInputModels, Model *defaultInputModel, AudioPlaySource *source=0, int startFrame=0, int duration=0, UserConfigurator *configurator=0)
Fill out the configuration for the given transform (may include asking the user by calling back on th...
virtual void moreModelsAvailable(std::vector< Model * > models)=0
static ModelTransformerFactory * m_instance
Model * transform(const Transform &transform, const ModelTransformer::Input &input, QString &message, AdditionalModelHandler *handler=0)
Return the output model resulting from applying the named transform to the given input model.
TransformerConfigurationMap m_lastConfigurations
Model is the base class for all data models that represent any sort of data on a time scale based on ...
Definition: Model.h:35
A ModelTransformer turns one data model into another.
std::map< TransformId, QString > TransformerConfigurationMap
virtual bool configure(ModelTransformer::Input &input, Transform &transform, Vamp::PluginBase *plugin, Model *&inputModel, AudioPlaySource *source, int startFrame, int duration, const QMap< QString, Model * > &modelMap, QStringList candidateModelNames, QString defaultModelName)=0
std::map< ModelTransformer *, AdditionalModelHandler * > HandlerMap