00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 00002 00003 /* 00004 Sonic Visualiser 00005 An audio file viewer and annotation editor. 00006 Centre for Digital Music, Queen Mary, University of London. 00007 This file copyright 2006 Chris Cannam and QMUL. 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License as 00011 published by the Free Software Foundation; either version 2 of the 00012 License, or (at your option) any later version. See the file 00013 COPYING included with this distribution for more information. 00014 */ 00015 00016 #ifndef _FEATURE_EXTRACTION_PLUGIN_TRANSFORMER_H_ 00017 #define _FEATURE_EXTRACTION_PLUGIN_TRANSFORMER_H_ 00018 00019 #include "ModelTransformer.h" 00020 00021 #include <QString> 00022 00023 #include <vamp-sdk/Plugin.h> 00024 00025 #include <iostream> 00026 00027 class DenseTimeValueModel; 00028 00029 class FeatureExtractionModelTransformer : public ModelTransformer 00030 { 00031 Q_OBJECT 00032 00033 public: 00034 FeatureExtractionModelTransformer(Input input, 00035 const Transform &transform); 00036 virtual ~FeatureExtractionModelTransformer(); 00037 00038 protected: 00039 virtual void run(); 00040 00041 Vamp::Plugin *m_plugin; 00042 Vamp::Plugin::OutputDescriptor *m_descriptor; 00043 int m_outputFeatureNo; 00044 00045 void addFeature(size_t blockFrame, 00046 const Vamp::Plugin::Feature &feature); 00047 00048 void setCompletion(int); 00049 00050 void getFrames(int channelCount, long startFrame, long size, 00051 float **buffer); 00052 00053 // just casts 00054 DenseTimeValueModel *getConformingInput(); 00055 template <typename ModelClass> ModelClass *getConformingOutput() { 00056 ModelClass *mc = dynamic_cast<ModelClass *>(m_output); 00057 if (!mc) { 00058 std::cerr << "FeatureExtractionModelTransformer::getOutput: Output model not conformable" << std::endl; 00059 } 00060 return mc; 00061 } 00062 }; 00063 00064 #endif 00065
1.5.1