Chris@49: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@0: Chris@0: /* Chris@52: Sonic Visualiser Chris@52: An audio file viewer and annotation editor. Chris@52: Centre for Digital Music, Queen Mary, University of London. Chris@52: This file copyright 2006 Chris Cannam. Chris@0: Chris@52: This program is free software; you can redistribute it and/or Chris@52: modify it under the terms of the GNU General Public License as Chris@52: published by the Free Software Foundation; either version 2 of the Chris@52: License, or (at your option) any later version. See the file Chris@52: COPYING included with this distribution for more information. Chris@0: */ Chris@0: Chris@0: /* Chris@0: This is a modified version of a source file from the Chris@0: Rosegarden MIDI and audio sequencer and notation editor. Chris@17: This file copyright 2000-2006 Chris Cannam. Chris@0: */ Chris@0: Chris@0: #ifndef _REALTIME_PLUGIN_FACTORY_H_ Chris@0: #define _REALTIME_PLUGIN_FACTORY_H_ Chris@0: Chris@0: #include Chris@0: #include Chris@0: Chris@0: class RealTimePluginInstance; Chris@0: Chris@0: class RealTimePluginFactory Chris@0: { Chris@0: public: Chris@0: static RealTimePluginFactory *instance(QString pluginType); Chris@0: static RealTimePluginFactory *instanceFor(QString identifier); Chris@0: static std::vector getAllPluginIdentifiers(); Chris@0: static void enumerateAllPlugins(std::vector &); Chris@0: Chris@0: static void setSampleRate(int sampleRate) { m_sampleRate = sampleRate; } Chris@0: Chris@0: /** Chris@0: * Look up the plugin path and find the plugins in it. Called Chris@0: * automatically after construction of a factory. Chris@0: */ Chris@0: virtual void discoverPlugins() = 0; Chris@0: Chris@0: /** Chris@0: * Return a reference to a list of all plugin identifiers that can Chris@0: * be created by this factory. Chris@0: */ Chris@0: virtual const std::vector &getPluginIdentifiers() const = 0; Chris@0: Chris@0: /** Chris@0: * Append to the given list descriptions of all the available Chris@0: * plugins and their ports. This is in a standard format, see Chris@0: * the LADSPA implementation for details. Chris@0: */ Chris@0: virtual void enumeratePlugins(std::vector &list) = 0; Chris@0: Chris@0: /** Chris@0: * Instantiate a plugin. Chris@0: */ Chris@0: virtual RealTimePluginInstance *instantiatePlugin(QString identifier, Chris@0: int clientId, Chris@0: int position, Chris@0: unsigned int sampleRate, Chris@0: unsigned int blockSize, Chris@0: unsigned int channels) = 0; Chris@0: Chris@0: protected: Chris@0: RealTimePluginFactory() { } Chris@0: Chris@0: // for call by RealTimePluginInstance dtor Chris@0: virtual void releasePlugin(RealTimePluginInstance *, QString identifier) = 0; Chris@0: friend class RealTimePluginInstance; Chris@0: Chris@0: static int m_sampleRate; Chris@0: }; Chris@0: Chris@0: #endif