annotate plugin/NativeVampPluginFactory.h @ 1225:ba16388b937d piper

Restore native-Vamp factory and make the choice between Piper and Native a preference
author Chris Cannam
date Fri, 21 Oct 2016 11:49:27 +0100
parents plugin/FeatureExtractionPluginFactory.h@c2207877689d
children 5d886b7b4029
rev   line source
Chris@49 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@52 4 Sonic Visualiser
Chris@52 5 An audio file viewer and annotation editor.
Chris@52 6 Centre for Digital Music, Queen Mary, University of London.
Chris@1225 7 This file copyright 2006-2016 Chris Cannam and QMUL.
Chris@0 8
Chris@52 9 This program is free software; you can redistribute it and/or
Chris@52 10 modify it under the terms of the GNU General Public License as
Chris@52 11 published by the Free Software Foundation; either version 2 of the
Chris@52 12 License, or (at your option) any later version. See the file
Chris@52 13 COPYING included with this distribution for more information.
Chris@0 14 */
Chris@0 15
Chris@1225 16 #ifndef SV_NATIVE_VAMP_PLUGIN_FACTORY_H
Chris@1225 17 #define SV_NATIVE_VAMP_PLUGIN_FACTORY_H
Chris@0 18
Chris@1225 19 #include "FeatureExtractionPluginFactory.h"
Chris@1225 20
Chris@0 21 #include <vector>
Chris@165 22 #include <map>
Chris@0 23
Chris@1225 24 #include "base/Debug.h"
Chris@0 25
Chris@1225 26 #include <QMutex>
Chris@686 27
Chris@1225 28 /**
Chris@1225 29 * FeatureExtractionPluginFactory type for Vamp plugins hosted
Chris@1225 30 * in-process.
Chris@1225 31 */
Chris@1225 32 class NativeVampPluginFactory : public FeatureExtractionPluginFactory
Chris@0 33 {
Chris@0 34 public:
Chris@1225 35 virtual ~NativeVampPluginFactory() { }
Chris@0 36
Chris@66 37 virtual std::vector<QString> getPluginIdentifiers();
Chris@1225 38
Chris@1225 39 virtual QString findPluginFile(QString soname, QString inDir = "");
Chris@0 40
Chris@1223 41 virtual piper_vamp::PluginStaticData getPluginStaticData(QString identifier);
Chris@1225 42
Chris@66 43 virtual Vamp::Plugin *instantiatePlugin(QString identifier,
Chris@1040 44 sv_samplerate_t inputSampleRate);
Chris@0 45
Chris@165 46 /**
Chris@165 47 * Get category metadata about a plugin (without instantiating it).
Chris@165 48 */
Chris@165 49 virtual QString getPluginCategory(QString identifier);
Chris@165 50
Chris@0 51 protected:
Chris@1209 52 QMutex m_mutex;
Chris@1225 53 std::vector<QString> m_pluginPath;
Chris@1225 54 std::vector<QString> m_identifiers;
Chris@1225 55 std::map<QString, QString> m_taxonomy; // identifier -> category string
Chris@1225 56 std::map<QString, piper_vamp::PluginStaticData> m_pluginData; // identifier -> data (created opportunistically)
Chris@1225 57
Chris@1225 58 friend class PluginDeletionNotifyAdapter;
Chris@1225 59 void pluginDeleted(Vamp::Plugin *);
Chris@1225 60 std::map<Vamp::Plugin *, void *> m_handleMap;
Chris@1225 61
Chris@1225 62 std::vector<QString> getPluginPath();
Chris@1225 63 void generateTaxonomy();
Chris@0 64 };
Chris@0 65
Chris@0 66 #endif