comparison plugin/FeatureExtractionPluginFactory.h @ 1230:9ae2ce9190e6 project-file-rework

Merge
author Chris Cannam
date Tue, 25 Oct 2016 11:04:26 +0100
parents c2207877689d e699bdeef63c
children 91bb68146dfc
comparison
equal deleted inserted replaced
1228:a2091d148d7f 1230:9ae2ce9190e6
2 2
3 /* 3 /*
4 Sonic Visualiser 4 Sonic Visualiser
5 An audio file viewer and annotation editor. 5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London. 6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2006 Chris Cannam. 7 This file copyright 2006-2016 Chris Cannam and QMUL.
8 8
9 This program is free software; you can redistribute it and/or 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 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 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_FACTORY_H_ 16 #ifndef SV_FEATURE_EXTRACTION_PLUGIN_FACTORY_H
17 #define _FEATURE_EXTRACTION_PLUGIN_FACTORY_H_ 17 #define SV_FEATURE_EXTRACTION_PLUGIN_FACTORY_H
18
19 #include <QString>
20 #include <QMutex>
21 #include <vector>
22 #include <map>
23 18
24 #include <vamp-hostsdk/Plugin.h> 19 #include <vamp-hostsdk/Plugin.h>
25 20
26 #include "base/Debug.h" 21 #include "vamp-support/PluginStaticData.h"
22
27 #include "base/BaseTypes.h" 23 #include "base/BaseTypes.h"
28 24
29 #include "vamp-support/PluginStaticData.h" 25 #include <QString>
30 26
31 class FeatureExtractionPluginFactory 27 class FeatureExtractionPluginFactory
32 { 28 {
33 public: 29 public:
34 FeatureExtractionPluginFactory(); 30 static FeatureExtractionPluginFactory *instance();
31
35 virtual ~FeatureExtractionPluginFactory() { } 32 virtual ~FeatureExtractionPluginFactory() { }
36 33
37 static FeatureExtractionPluginFactory *instance(QString pluginType); 34 /**
38 static FeatureExtractionPluginFactory *instanceFor(QString identifier); 35 * Return all installed plugin identifiers.
39 static std::vector<QString> getAllPluginIdentifiers(); 36 */
37 virtual std::vector<QString> getPluginIdentifiers(QString &errorMessage) {
38 return instance()->getPluginIdentifiers(errorMessage);
39 }
40 40
41 virtual std::vector<QString> getPluginIdentifiers(); 41 /**
42 * Return static data for the given plugin.
43 */
44 virtual piper_vamp::PluginStaticData getPluginStaticData(QString identifier) {
45 return instance()->getPluginStaticData(identifier);
46 }
42 47
43 virtual piper_vamp::PluginStaticData getPluginStaticData(QString identifier); 48 /**
44 49 * Instantiate (load) and return pointer to the plugin with the
45 // We don't set blockSize or channels on this -- they're 50 * given identifier, at the given sample rate. We don't set
46 // negotiated and handled via initialize() on the plugin 51 * blockSize or channels on this -- they're negotiated and handled
52 * via initialize() on the plugin itself after loading.
53 */
47 virtual Vamp::Plugin *instantiatePlugin(QString identifier, 54 virtual Vamp::Plugin *instantiatePlugin(QString identifier,
48 sv_samplerate_t inputSampleRate); 55 sv_samplerate_t inputSampleRate) {
56 return instance()->instantiatePlugin(identifier, inputSampleRate);
57 }
49 58
50 /** 59 /**
51 * Get category metadata about a plugin (without instantiating it). 60 * Get category metadata about a plugin (without instantiating it).
52 */ 61 */
53 virtual QString getPluginCategory(QString identifier); 62 virtual QString getPluginCategory(QString identifier) {
54 63 return instance()->getPluginCategory(identifier);
55 protected: 64 }
56 std::string m_serverName;
57 QMutex m_mutex;
58 std::vector<piper_vamp::PluginStaticData> m_pluginData;
59 std::map<QString, QString> m_taxonomy;
60 void populate();
61 }; 65 };
62 66
63 #endif 67 #endif