comparison transform/FeatureExtractionPluginTransform.h @ 0:cd5d7ff8ef38

* Reorganising code base. This revision will not compile.
author Chris Cannam
date Mon, 31 Jul 2006 12:03:45 +0000
parents
children d88d117e0c34
comparison
equal deleted inserted replaced
-1:000000000000 0:cd5d7ff8ef38
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.
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 _FEATURE_EXTRACTION_PLUGIN_TRANSFORM_H_
17 #define _FEATURE_EXTRACTION_PLUGIN_TRANSFORM_H_
18
19 #include "Transform.h"
20
21 #include "vamp-sdk/Plugin.h"
22
23 class DenseTimeValueModel;
24
25 class FeatureExtractionPluginTransform : public Transform
26 {
27 public:
28 FeatureExtractionPluginTransform(Model *inputModel,
29 QString plugin,
30 int channel,
31 QString configurationXml = "",
32 QString outputName = "");
33 virtual ~FeatureExtractionPluginTransform();
34
35 protected:
36 virtual void run();
37
38 Vamp::Plugin *m_plugin;
39 int m_channel;
40 size_t m_stepSize;
41 size_t m_blockSize;
42 Vamp::Plugin::OutputDescriptor *m_descriptor;
43 int m_outputFeatureNo;
44
45 void addFeature(size_t blockFrame,
46 const Vamp::Plugin::Feature &feature);
47
48 void setCompletion(int);
49
50 void getFrames(int channel, int channelCount,
51 long startFrame, long size, float *buffer);
52
53 // just casts
54 DenseTimeValueModel *getInput();
55 template <typename ModelClass> ModelClass *getOutput() {
56 ModelClass *mc = dynamic_cast<ModelClass *>(m_output);
57 if (!mc) {
58 std::cerr << "FeatureExtractionPluginTransform::getOutput: Output model not conformable" << std::endl;
59 }
60 return mc;
61 }
62 };
63
64 #endif
65