comparison plugin/RealTimePluginFactory.h @ 0:da6937383da8

initial import
author Chris Cannam
date Tue, 10 Jan 2006 16:33:16 +0000
parents
children d86891498eef
comparison
equal deleted inserted replaced
-1:000000000000 0:da6937383da8
1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 A waveform viewer and audio annotation editor.
5 Chris Cannam, Queen Mary University of London, 2005
6
7 This is experimental software. Not for distribution.
8 */
9
10 /*
11 This is a modified version of a source file from the
12 Rosegarden MIDI and audio sequencer and notation editor.
13 This file copyright 2000-2005 Chris Cannam.
14 */
15
16 #ifndef _REALTIME_PLUGIN_FACTORY_H_
17 #define _REALTIME_PLUGIN_FACTORY_H_
18
19 #include <QString>
20 #include <vector>
21
22 class RealTimePluginInstance;
23
24 class RealTimePluginFactory
25 {
26 public:
27 static RealTimePluginFactory *instance(QString pluginType);
28 static RealTimePluginFactory *instanceFor(QString identifier);
29 static std::vector<QString> getAllPluginIdentifiers();
30 static void enumerateAllPlugins(std::vector<QString> &);
31
32 static void setSampleRate(int sampleRate) { m_sampleRate = sampleRate; }
33
34 /**
35 * Look up the plugin path and find the plugins in it. Called
36 * automatically after construction of a factory.
37 */
38 virtual void discoverPlugins() = 0;
39
40 /**
41 * Return a reference to a list of all plugin identifiers that can
42 * be created by this factory.
43 */
44 virtual const std::vector<QString> &getPluginIdentifiers() const = 0;
45
46 /**
47 * Append to the given list descriptions of all the available
48 * plugins and their ports. This is in a standard format, see
49 * the LADSPA implementation for details.
50 */
51 virtual void enumeratePlugins(std::vector<QString> &list) = 0;
52
53 /**
54 * Instantiate a plugin.
55 */
56 virtual RealTimePluginInstance *instantiatePlugin(QString identifier,
57 int clientId,
58 int position,
59 unsigned int sampleRate,
60 unsigned int blockSize,
61 unsigned int channels) = 0;
62
63 protected:
64 RealTimePluginFactory() { }
65
66 // for call by RealTimePluginInstance dtor
67 virtual void releasePlugin(RealTimePluginInstance *, QString identifier) = 0;
68 friend class RealTimePluginInstance;
69
70 static int m_sampleRate;
71 };
72
73 #endif