annotate plugin/transform/ModelTransformer.h @ 339:ba30f4a3e3be

* Some work on correct alignment when moving panes during playback * Overhaul alignment for playback frame values (view manager now always refers to reference-timeline values, only the play source deals in playback model timeline values) * When making a selection, ensure the selection regions shown in other panes (and used for playback constraints if appropriate) are aligned correctly. This may be the coolest feature ever implemented in any program ever.
author Chris Cannam
date Thu, 22 Nov 2007 14:17:19 +0000
parents f620ce48c950
children d7c41483af8f 94fc0591ea43
rev   line source
Chris@320 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@320 2
Chris@320 3 /*
Chris@320 4 Sonic Visualiser
Chris@320 5 An audio file viewer and annotation editor.
Chris@320 6 Centre for Digital Music, Queen Mary, University of London.
Chris@320 7 This file copyright 2006 Chris Cannam.
Chris@320 8
Chris@320 9 This program is free software; you can redistribute it and/or
Chris@320 10 modify it under the terms of the GNU General Public License as
Chris@320 11 published by the Free Software Foundation; either version 2 of the
Chris@320 12 License, or (at your option) any later version. See the file
Chris@320 13 COPYING included with this distribution for more information.
Chris@320 14 */
Chris@320 15
Chris@329 16 #ifndef _TRANSFORMER_H_
Chris@329 17 #define _TRANSFORMER_H_
Chris@320 18
Chris@320 19 #include "base/Thread.h"
Chris@320 20
Chris@320 21 #include "data/model/Model.h"
Chris@320 22
Chris@320 23 /**
Chris@331 24 * A ModelTransformer turns one data model into another.
Chris@320 25 *
Chris@331 26 * Typically in this application, a ModelTransformer might have a
Chris@320 27 * DenseTimeValueModel as its input (e.g. an audio waveform) and a
Chris@320 28 * SparseOneDimensionalModel (e.g. detected beats) as its output.
Chris@320 29 *
Chris@331 30 * The ModelTransformer typically runs in the background, as a
Chris@331 31 * separate thread populating the output model. The model is
Chris@331 32 * available to the user of the ModelTransformer immediately, but may
Chris@331 33 * be initially empty until the background thread has populated it.
Chris@320 34 */
Chris@320 35
Chris@331 36 class ModelTransformer : public Thread
Chris@320 37 {
Chris@320 38 public:
Chris@331 39 virtual ~ModelTransformer();
Chris@320 40
Chris@320 41 // Just a hint to the processing thread that it should give up.
Chris@320 42 // Caller should still wait() and/or delete the transform before
Chris@320 43 // assuming its input and output models are no longer required.
Chris@320 44 void abandon() { m_abandoned = true; }
Chris@320 45
Chris@320 46 Model *getInputModel() { return m_input; }
Chris@320 47 Model *getOutputModel() { return m_output; }
Chris@320 48 Model *detachOutputModel() { m_detached = true; return m_output; }
Chris@320 49
Chris@320 50 protected:
Chris@331 51 ModelTransformer(Model *m);
Chris@320 52
Chris@320 53 Model *m_input; // I don't own this
Chris@320 54 Model *m_output; // I own this, unless...
Chris@320 55 bool m_detached; // ... this is true.
Chris@320 56 bool m_abandoned;
Chris@320 57 };
Chris@320 58
Chris@320 59 #endif