Mercurial > hg > easaier-soundaccess
comparison plugin/RealTimePluginFactory.h @ 0:fc9323a41f5a
start base : Sonic Visualiser sv1-1.0rc1
author | lbajardsilogic |
---|---|
date | Fri, 11 May 2007 09:08:14 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:fc9323a41f5a |
---|---|
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 Chris Cannam. | |
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 /* | |
17 This is a modified version of a source file from the | |
18 Rosegarden MIDI and audio sequencer and notation editor. | |
19 This file copyright 2000-2006 Chris Cannam. | |
20 */ | |
21 | |
22 #ifndef _REALTIME_PLUGIN_FACTORY_H_ | |
23 #define _REALTIME_PLUGIN_FACTORY_H_ | |
24 | |
25 #include <QString> | |
26 #include <vector> | |
27 | |
28 class RealTimePluginInstance; | |
29 | |
30 class RealTimePluginDescriptor | |
31 { | |
32 public: | |
33 std::string name; | |
34 std::string label; | |
35 std::string maker; | |
36 std::string copyright; | |
37 std::string category; | |
38 bool isSynth; | |
39 unsigned int parameterCount; | |
40 unsigned int audioInputPortCount; | |
41 unsigned int audioOutputPortCount; | |
42 unsigned int controlOutputPortCount; | |
43 std::vector<std::string> controlOutputPortNames; | |
44 }; | |
45 | |
46 class RealTimePluginFactory | |
47 { | |
48 public: | |
49 virtual ~RealTimePluginFactory(); | |
50 | |
51 static RealTimePluginFactory *instance(QString pluginType); | |
52 static RealTimePluginFactory *instanceFor(QString identifier); | |
53 static std::vector<QString> getAllPluginIdentifiers(); | |
54 static void enumerateAllPlugins(std::vector<QString> &); | |
55 | |
56 static void setSampleRate(int sampleRate) { m_sampleRate = sampleRate; } | |
57 | |
58 /** | |
59 * Look up the plugin path and find the plugins in it. Called | |
60 * automatically after construction of a factory. | |
61 */ | |
62 virtual void discoverPlugins() = 0; | |
63 | |
64 /** | |
65 * Return a reference to a list of all plugin identifiers that can | |
66 * be created by this factory. | |
67 */ | |
68 virtual const std::vector<QString> &getPluginIdentifiers() const = 0; | |
69 | |
70 /** | |
71 * Append to the given list descriptions of all the available | |
72 * plugins and their ports. This is in a standard format, see | |
73 * the LADSPA implementation for details. | |
74 */ | |
75 virtual void enumeratePlugins(std::vector<QString> &list) = 0; | |
76 | |
77 /** | |
78 * Get some basic information about a plugin (rapidly). | |
79 */ | |
80 virtual const RealTimePluginDescriptor *getPluginDescriptor(QString identifier) const = 0; | |
81 | |
82 /** | |
83 * Instantiate a plugin. | |
84 */ | |
85 virtual RealTimePluginInstance *instantiatePlugin(QString identifier, | |
86 int clientId, | |
87 int position, | |
88 unsigned int sampleRate, | |
89 unsigned int blockSize, | |
90 unsigned int channels) = 0; | |
91 | |
92 /** | |
93 * Get category metadata about a plugin (without instantiating it). | |
94 */ | |
95 virtual QString getPluginCategory(QString identifier) = 0; | |
96 | |
97 protected: | |
98 RealTimePluginFactory() { } | |
99 | |
100 // for call by RealTimePluginInstance dtor | |
101 virtual void releasePlugin(RealTimePluginInstance *, QString identifier) = 0; | |
102 friend class RealTimePluginInstance; | |
103 | |
104 static int m_sampleRate; | |
105 }; | |
106 | |
107 #endif |