comparison plugin/transform/ModelTransformer.h @ 361:399ea254afd6

* Part of #1877436 transform fails to re-run when file loaded at different rate
author Chris Cannam
date Wed, 23 Jan 2008 18:09:50 +0000
parents d7c41483af8f
children
comparison
equal deleted inserted replaced
360:ac300d385ab2 361:399ea254afd6
54 protected: 54 protected:
55 Model *m_model; 55 Model *m_model;
56 int m_channel; 56 int m_channel;
57 }; 57 };
58 58
59 // Just a hint to the processing thread that it should give up. 59 /**
60 // Caller should still wait() and/or delete the transform before 60 * Hint to the processing thread that it should give up, for
61 // assuming its input and output models are no longer required. 61 * example because the process is going to exit or we want to get
62 * rid of the input model. Caller should still wait() and/or
63 * delete the transform before assuming its input and output
64 * models are no longer required.
65 */
62 void abandon() { m_abandoned = true; } 66 void abandon() { m_abandoned = true; }
63 67
68 /**
69 * Return the input model for the transform.
70 */
64 Model *getInputModel() { return m_input.getModel(); } 71 Model *getInputModel() { return m_input.getModel(); }
72
73 /**
74 * Return the input channel spec for the transform.
75 */
65 int getInputChannel() { return m_input.getChannel(); } 76 int getInputChannel() { return m_input.getChannel(); }
66 77
78 /**
79 * Return the output model created by the transform. Returns a
80 * null model if the transform could not be initialised; an error
81 * message may be available via getMessage() in this situation.
82 */
67 Model *getOutputModel() { return m_output; } 83 Model *getOutputModel() { return m_output; }
84
85 /**
86 * Return the output model, also detaching it from the transformer
87 * so that it will not be deleted when the transformer is. The
88 * caller takes ownership of the model.
89 */
68 Model *detachOutputModel() { m_detached = true; return m_output; } 90 Model *detachOutputModel() { m_detached = true; return m_output; }
91
92 /**
93 * Return a warning or error message. If getOutputModel returned
94 * a null pointer, this should contain a fatal error message for
95 * the transformer; otherwise it may contain a warning to show to
96 * the user about e.g. suboptimal block size or whatever.
97 */
98 QString getMessage() const { return m_message; }
69 99
70 protected: 100 protected:
71 ModelTransformer(Input input, const Transform &transform); 101 ModelTransformer(Input input, const Transform &transform);
72 102
73 Transform m_transform; 103 Transform m_transform;
74 Input m_input; // I don't own the model in this 104 Input m_input; // I don't own the model in this
75 Model *m_output; // I own this, unless... 105 Model *m_output; // I own this, unless...
76 bool m_detached; // ... this is true. 106 bool m_detached; // ... this is true.
77 bool m_abandoned; 107 bool m_abandoned;
108 QString m_message;
78 }; 109 };
79 110
80 #endif 111 #endif