annotate plugin/RealTimePluginFactory.h @ 41:2b6412c1e724

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