annotate transform/TransformFactory.h @ 9:73d85d19919f

* Add play-selection and looping modes. Looping seems to work OK, but the plain play-selection is miscalculating current frame number to feed back to the GUI. * Cache selection rectanges wherever possible in View::paintEvent.
author Chris Cannam
date Tue, 24 Jan 2006 16:20:58 +0000
parents d86891498eef
children cc98d496d52b
rev   line source
Chris@0 1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@0 4 A waveform viewer and audio annotation editor.
Chris@2 5 Chris Cannam, Queen Mary University of London, 2005-2006
Chris@0 6
Chris@0 7 This is experimental software. Not for distribution.
Chris@0 8 */
Chris@0 9
Chris@0 10 #ifndef _TRANSFORM_FACTORY_H_
Chris@0 11 #define _TRANSFORM_FACTORY_H_
Chris@0 12
Chris@0 13 #include "Transform.h"
Chris@0 14
Chris@0 15 class TransformFactory : public QObject
Chris@0 16 {
Chris@0 17 Q_OBJECT
Chris@0 18
Chris@0 19 public:
Chris@0 20 virtual ~TransformFactory();
Chris@0 21
Chris@0 22 static TransformFactory *instance();
Chris@0 23
Chris@0 24 // The name is intended to be computer-referencable, and unique
Chris@0 25 // within the application. The description should be
Chris@0 26 // human-readable, and does not have to be unique.
Chris@0 27
Chris@0 28 struct TransformDesc {
Chris@0 29 TransformDesc(TransformName _name, QString _description = "") :
Chris@0 30 name(_name), description(_description) { }
Chris@0 31 TransformName name;
Chris@0 32 QString description;
Chris@0 33 };
Chris@0 34 typedef std::vector<TransformDesc> TransformList;
Chris@0 35
Chris@0 36 TransformList getAllTransforms();
Chris@0 37
Chris@0 38 /**
Chris@0 39 * Return the output model resulting from applying the named
Chris@0 40 * transform to the given input model. The transform may still be
Chris@0 41 * working in the background when the model is returned; check the
Chris@0 42 * output model's isReady completion status for more details.
Chris@0 43 *
Chris@0 44 * If the transform is unknown or the input model is not an
Chris@0 45 * appropriate type for the given transform, or if some other
Chris@0 46 * problem occurs, return 0.
Chris@0 47 *
Chris@0 48 * The returned model is owned by the caller and must be deleted
Chris@0 49 * when no longer needed.
Chris@0 50 */
Chris@0 51 Model *transform(TransformName name, Model *inputModel);
Chris@0 52
Chris@0 53 //!!! Need some way to indicate that the input model has changed /
Chris@0 54 //been deleted so as not to blow up backgrounded transform! -- Or
Chris@0 55 //indeed, if the output model has been deleted -- could equally
Chris@0 56 //well happen!
Chris@0 57
Chris@0 58 //!!! Need transform category!
Chris@0 59
Chris@0 60 protected slots:
Chris@0 61 void transformFinished();
Chris@0 62
Chris@0 63 protected:
Chris@0 64 Transform *createTransform(TransformName name, Model *inputModel);
Chris@0 65 Transform *createTransform(TransformName name, Model *inputModel,
Chris@0 66 bool start);
Chris@0 67
Chris@0 68 static TransformFactory *m_instance;
Chris@0 69 };
Chris@0 70
Chris@0 71
Chris@0 72 #endif