comparison transform/FeatureExtractionModelTransformer.h @ 849:418cd2064769 tonioni_multi_transform

More on multi-transform stuff
author Chris Cannam
date Mon, 02 Dec 2013 11:17:24 +0000
parents 539740f231fa
children dba8a02b0413
comparison
equal deleted inserted replaced
848:539740f231fa 849:418cd2064769
11 published by the Free Software Foundation; either version 2 of the 11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file 12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information. 13 COPYING included with this distribution for more information.
14 */ 14 */
15 15
16 #ifndef _FEATURE_EXTRACTION_PLUGIN_TRANSFORMER_H_ 16 #ifndef _FEATURE_EXTRACTION_MODEL_TRANSFORMER_H_
17 #define _FEATURE_EXTRACTION_PLUGIN_TRANSFORMER_H_ 17 #define _FEATURE_EXTRACTION_MODEL_TRANSFORMER_H_
18 18
19 #include "ModelTransformer.h" 19 #include "ModelTransformer.h"
20 20
21 #include <QString> 21 #include <QString>
22 22
49 const PreferredOutputModel outputmodel); 49 const PreferredOutputModel outputmodel);
50 50
51 virtual ~FeatureExtractionModelTransformer(); 51 virtual ~FeatureExtractionModelTransformer();
52 52
53 protected: 53 protected:
54 bool initialise();
55
54 virtual void run(); 56 virtual void run();
55 57
56 Vamp::Plugin *m_plugin; 58 Vamp::Plugin *m_plugin;
57 Vamp::Plugin::OutputDescriptor *m_descriptor; 59 std::vector<Vamp::Plugin::OutputDescriptor *> m_descriptors; // per transform
58 int m_fixedRateFeatureNo; // to assign times to FixedSampleRate features 60 std::vector<int> m_fixedRateFeatureNos; // to assign times to FixedSampleRate features
59 int m_outputNo; 61 std::vector<int> m_outputNos;
60 PreferredOutputModel m_preferredOutputModel; 62 PreferredOutputModel m_preferredOutputModel;
61 63
62 void createOutputModel(); 64 void createOutputModel(int n);
63 65
64 void addFeature(size_t blockFrame, 66 void addFeature(size_t blockFrame,
65 const Vamp::Plugin::Feature &feature); 67 const Vamp::Plugin::Feature &feature);
66 68
67 void setCompletion(int); 69 void setCompletion(int);
71 73
72 // just casts 74 // just casts
73 75
74 DenseTimeValueModel *getConformingInput(); 76 DenseTimeValueModel *getConformingInput();
75 77
76 template <typename ModelClass> bool isOutput() { 78 template <typename ModelClass> bool isOutput(int n) {
77 return dynamic_cast<ModelClass *>(m_output) != 0; 79 return dynamic_cast<ModelClass *>(m_outputs[n]) != 0;
78 } 80 }
79 81
80 template <typename ModelClass> ModelClass *getConformingOutput() { 82 template <typename ModelClass> ModelClass *getConformingOutput(int n) {
81 ModelClass *mc = dynamic_cast<ModelClass *>(m_output); 83 if ((int)m_outputs.size() > n) {
82 if (!mc) { 84 ModelClass *mc = dynamic_cast<ModelClass *>(m_outputs[n]);
83 std::cerr << "FeatureExtractionModelTransformer::getOutput: Output model not conformable" << std::endl; 85 if (!mc) {
84 } 86 std::cerr << "FeatureExtractionModelTransformer::getOutput: Output model not conformable" << std::endl;
85 return mc; 87 }
88 return mc;
89 } else {
90 std::cerr << "FeatureExtractionModelTransformer::getOutput: No such output number " << n << std::endl;
91 return 0;
92 }
86 } 93 }
87 }; 94 };
88 95
89 #endif 96 #endif
90 97