annotate plugin/RealTimePluginFactory.h @ 57:7439f1696314

* Add editing for auralisation plugin parameters and programs * Rename and reorganise the sample plugin sample set
author Chris Cannam
date Thu, 23 Mar 2006 15:49:41 +0000
parents d397ea0a79f5
children 3086ff194ea0
rev   line source
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@52 7 This file copyright 2006 Chris Cannam.
Chris@0 8
Chris@52 9 This program is free software; you can redistribute it and/or
Chris@52 10 modify it under the terms of the GNU General Public License as
Chris@52 11 published by the Free Software Foundation; either version 2 of the
Chris@52 12 License, or (at your option) any later version. See the file
Chris@52 13 COPYING included with this distribution for more information.
Chris@0 14 */
Chris@0 15
Chris@0 16 /*
Chris@0 17 This is a modified version of a source file from the
Chris@0 18 Rosegarden MIDI and audio sequencer and notation editor.
Chris@17 19 This file copyright 2000-2006 Chris Cannam.
Chris@0 20 */
Chris@0 21
Chris@0 22 #ifndef _REALTIME_PLUGIN_FACTORY_H_
Chris@0 23 #define _REALTIME_PLUGIN_FACTORY_H_
Chris@0 24
Chris@0 25 #include <QString>
Chris@0 26 #include <vector>
Chris@0 27
Chris@0 28 class RealTimePluginInstance;
Chris@0 29
Chris@0 30 class RealTimePluginFactory
Chris@0 31 {
Chris@0 32 public:
Chris@0 33 static RealTimePluginFactory *instance(QString pluginType);
Chris@0 34 static RealTimePluginFactory *instanceFor(QString identifier);
Chris@0 35 static std::vector<QString> getAllPluginIdentifiers();
Chris@0 36 static void enumerateAllPlugins(std::vector<QString> &);
Chris@0 37
Chris@0 38 static void setSampleRate(int sampleRate) { m_sampleRate = sampleRate; }
Chris@0 39
Chris@0 40 /**
Chris@0 41 * Look up the plugin path and find the plugins in it. Called
Chris@0 42 * automatically after construction of a factory.
Chris@0 43 */
Chris@0 44 virtual void discoverPlugins() = 0;
Chris@0 45
Chris@0 46 /**
Chris@0 47 * Return a reference to a list of all plugin identifiers that can
Chris@0 48 * be created by this factory.
Chris@0 49 */
Chris@0 50 virtual const std::vector<QString> &getPluginIdentifiers() const = 0;
Chris@0 51
Chris@0 52 /**
Chris@0 53 * Append to the given list descriptions of all the available
Chris@0 54 * plugins and their ports. This is in a standard format, see
Chris@0 55 * the LADSPA implementation for details.
Chris@0 56 */
Chris@0 57 virtual void enumeratePlugins(std::vector<QString> &list) = 0;
Chris@0 58
Chris@0 59 /**
Chris@0 60 * Instantiate a plugin.
Chris@0 61 */
Chris@0 62 virtual RealTimePluginInstance *instantiatePlugin(QString identifier,
Chris@0 63 int clientId,
Chris@0 64 int position,
Chris@0 65 unsigned int sampleRate,
Chris@0 66 unsigned int blockSize,
Chris@0 67 unsigned int channels) = 0;
Chris@0 68
Chris@0 69 protected:
Chris@0 70 RealTimePluginFactory() { }
Chris@0 71
Chris@0 72 // for call by RealTimePluginInstance dtor
Chris@0 73 virtual void releasePlugin(RealTimePluginInstance *, QString identifier) = 0;
Chris@0 74 friend class RealTimePluginInstance;
Chris@0 75
Chris@0 76 static int m_sampleRate;
Chris@0 77 };
Chris@0 78
Chris@0 79 #endif