PiperVampPluginFactory.h
Go to the documentation of this file.
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-2016 Chris Cannam and QMUL.
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 SV_PIPER_VAMP_PLUGIN_FACTORY_H
17 #define SV_PIPER_VAMP_PLUGIN_FACTORY_H
18 
19 #ifdef HAVE_PIPER
20 
22 
23 #include <QMutex>
24 #include <vector>
25 #include <map>
26 
27 #include "base/Debug.h"
28 #include "base/HelperExecPath.h"
29 
34 class PiperVampPluginFactory : public FeatureExtractionPluginFactory
35 {
36 public:
37  PiperVampPluginFactory();
38  virtual ~PiperVampPluginFactory();
39 
40  virtual std::vector<QString> getPluginIdentifiers(QString &errorMessage)
41  override;
42 
43  virtual piper_vamp::PluginStaticData getPluginStaticData(QString identifier)
44  override;
45 
46  virtual std::shared_ptr<Vamp::Plugin> instantiatePlugin(QString identifier,
47  sv_samplerate_t inputSampleRate)
48  override;
49 
50  virtual QString getPluginCategory(QString identifier) override;
51 
52  virtual QString getPluginLibraryPath(QString identifier) override;
53 
54 protected:
55  QMutex m_mutex;
56  QList<HelperExecPath::HelperExec> m_servers; // executable file paths
57  std::map<QString, QString> m_origins; // plugin identifier -> server path
58  std::map<QString, QString> m_libraries; // soname -> full file path
59  std::map<QString, piper_vamp::PluginStaticData> m_pluginData; // identifier -> data
60  std::map<QString, QString> m_taxonomy; // identifier -> category string
61 
62  bool serverMeetsMinimumVersion(const HelperExecPath::HelperExec &server,
63  float minimumVersion);
64  void populate(QString &errorMessage);
65  void populateFrom(const HelperExecPath::HelperExec &, QString &errorMessage);
66 
67  class Logger;
68  Logger *m_logger;
69 };
70 
71 #endif
72 
73 #endif
double sv_samplerate_t
Sample rate.
Definition: BaseTypes.h:51
virtual std::vector< QString > getPluginIdentifiers(QString &errorMsg)=0
Return all installed plugin identifiers.
virtual QString getPluginLibraryPath(QString identifier)=0
Get the full file path (including both directory and filename) of the library file that provides a gi...
virtual std::shared_ptr< Vamp::Plugin > instantiatePlugin(QString identifier, sv_samplerate_t inputSampleRate)=0
Instantiate (load) and return pointer to the plugin with the given identifier, at the given sample ra...
virtual QString getPluginCategory(QString identifier)=0
Get category metadata about a plugin (without instantiating it).
virtual piper_vamp::PluginStaticData getPluginStaticData(QString ident)=0
Return static data for the given plugin.