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@0
|
7
|
Chris@52
|
8 This program is free software; you can redistribute it and/or
|
Chris@52
|
9 modify it under the terms of the GNU General Public License as
|
Chris@52
|
10 published by the Free Software Foundation; either version 2 of the
|
Chris@52
|
11 License, or (at your option) any later version. See the file
|
Chris@52
|
12 COPYING included with this distribution for more information.
|
Chris@0
|
13 */
|
Chris@0
|
14
|
Chris@0
|
15 /*
|
Chris@0
|
16 This is a modified version of a source file from the
|
Chris@0
|
17 Rosegarden MIDI and audio sequencer and notation editor.
|
Chris@17
|
18 This file copyright 2000-2006 Chris Cannam and Richard Bown.
|
Chris@0
|
19 */
|
Chris@0
|
20
|
Chris@1581
|
21 #ifndef SV_LADSPA_PLUGIN_FACTORY_H
|
Chris@1581
|
22 #define SV_LADSPA_PLUGIN_FACTORY_H
|
Chris@0
|
23
|
Chris@0
|
24 #include "RealTimePluginFactory.h"
|
Chris@0
|
25 #include "api/ladspa.h"
|
Chris@0
|
26
|
Chris@1179
|
27 #include "PluginScan.h"
|
Chris@1179
|
28
|
Chris@0
|
29 #include <vector>
|
Chris@0
|
30 #include <map>
|
Chris@0
|
31 #include <set>
|
Chris@0
|
32 #include <QString>
|
Chris@0
|
33
|
Chris@0
|
34 class LADSPAPluginInstance;
|
Chris@0
|
35
|
Chris@0
|
36 class LADSPAPluginFactory : public RealTimePluginFactory
|
Chris@0
|
37 {
|
Chris@0
|
38 public:
|
Chris@0
|
39 virtual ~LADSPAPluginFactory();
|
Chris@0
|
40
|
Chris@1580
|
41 void discoverPlugins() override;
|
Chris@0
|
42
|
Chris@1580
|
43 const std::vector<QString> &getPluginIdentifiers() const override;
|
Chris@0
|
44
|
Chris@1580
|
45 void enumeratePlugins(std::vector<QString> &list) override;
|
Chris@0
|
46
|
Chris@1830
|
47 RealTimePluginDescriptor getPluginDescriptor(QString identifier)
|
Chris@1830
|
48 const override;
|
Chris@60
|
49
|
Chris@1830
|
50 std::shared_ptr<RealTimePluginInstance>
|
Chris@1830
|
51 instantiatePlugin(QString identifier,
|
Chris@1830
|
52 int clientId,
|
Chris@1830
|
53 int position,
|
Chris@1830
|
54 sv_samplerate_t sampleRate,
|
Chris@1830
|
55 int blockSize,
|
Chris@1830
|
56 int channels) override;
|
Chris@0
|
57
|
Chris@1580
|
58 QString getPluginCategory(QString identifier) override;
|
Chris@165
|
59
|
Chris@1580
|
60 QString getPluginLibraryPath(QString identifier) override;
|
Chris@1464
|
61
|
Chris@0
|
62 float getPortMinimum(const LADSPA_Descriptor *, int port);
|
Chris@0
|
63 float getPortMaximum(const LADSPA_Descriptor *, int port);
|
Chris@0
|
64 float getPortDefault(const LADSPA_Descriptor *, int port);
|
Chris@57
|
65 float getPortQuantization(const LADSPA_Descriptor *, int port);
|
Chris@0
|
66 int getPortDisplayHint(const LADSPA_Descriptor *, int port);
|
Chris@0
|
67
|
Chris@1472
|
68 static std::vector<QString> getPluginPath();
|
Chris@1472
|
69
|
Chris@0
|
70 protected:
|
Chris@0
|
71 LADSPAPluginFactory();
|
Chris@0
|
72 friend class RealTimePluginFactory;
|
Chris@0
|
73
|
Chris@1180
|
74 virtual PluginScan::PluginType getPluginType() const {
|
Chris@1180
|
75 return PluginScan::LADSPAPlugin;
|
Chris@1179
|
76 }
|
Chris@1179
|
77
|
Chris@0
|
78 virtual std::vector<QString> getLRDFPath(QString &baseUri);
|
Chris@0
|
79
|
Chris@929
|
80 virtual void discoverPluginsFrom(QString soName);
|
Chris@0
|
81 virtual void generateTaxonomy(QString uri, QString base);
|
Chris@0
|
82 virtual void generateFallbackCategories();
|
Chris@0
|
83
|
Chris@0
|
84 virtual const LADSPA_Descriptor *getLADSPADescriptor(QString identifier);
|
Chris@0
|
85
|
Chris@0
|
86 void loadLibrary(QString soName);
|
Chris@0
|
87 void unloadLibrary(QString soName);
|
Chris@0
|
88 void unloadUnusedLibraries();
|
Chris@0
|
89
|
Chris@0
|
90 std::vector<QString> m_identifiers;
|
Chris@1464
|
91 std::map<QString, QString> m_libraries; // identifier -> full file path
|
Chris@1830
|
92 std::map<QString, RealTimePluginDescriptor> m_rtDescriptors;
|
Chris@0
|
93
|
Chris@165
|
94 std::map<QString, QString> m_taxonomy;
|
Chris@165
|
95 std::map<unsigned long, QString> m_lrdfTaxonomy;
|
Chris@0
|
96 std::map<unsigned long, std::map<int, float> > m_portDefaults;
|
Chris@0
|
97
|
Chris@1830
|
98 std::set<std::weak_ptr<RealTimePluginInstance>,
|
Chris@1830
|
99 std::owner_less<std::weak_ptr<RealTimePluginInstance>>> m_instances;
|
Chris@0
|
100
|
Chris@0
|
101 typedef std::map<QString, void *> LibraryHandleMap;
|
Chris@0
|
102 LibraryHandleMap m_libraryHandles;
|
Chris@0
|
103 };
|
Chris@0
|
104
|
Chris@0
|
105 #endif
|
Chris@0
|
106
|