annotate plugin/RealTimePluginFactory.h @ 1859:4c5736a517e0

Avoid more recent Qt api, for older platform package builds
author Chris Cannam
date Mon, 18 May 2020 14:06:30 +0100
parents 5f8fbbde08ff
children
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@1581 22 #ifndef SV_REALTIME_PLUGIN_FACTORY_H
Chris@1581 23 #define SV_REALTIME_PLUGIN_FACTORY_H
Chris@0 24
Chris@0 25 #include <QString>
Chris@0 26 #include <vector>
Chris@1830 27 #include <memory>
Chris@0 28
Chris@686 29 #include "base/Debug.h"
Chris@1040 30 #include "base/BaseTypes.h"
Chris@686 31
Chris@0 32 class RealTimePluginInstance;
Chris@0 33
Chris@60 34 class RealTimePluginDescriptor
Chris@60 35 {
Chris@60 36 public:
Chris@60 37 std::string name;
Chris@60 38 std::string label;
Chris@60 39 std::string maker;
Chris@60 40 std::string copyright;
Chris@60 41 std::string category;
Chris@60 42 bool isSynth;
Chris@60 43 unsigned int parameterCount;
Chris@60 44 unsigned int audioInputPortCount;
Chris@166 45 unsigned int audioOutputPortCount;
Chris@60 46 unsigned int controlOutputPortCount;
Chris@60 47 std::vector<std::string> controlOutputPortNames;
Chris@60 48 };
Chris@60 49
Chris@0 50 class RealTimePluginFactory
Chris@0 51 {
Chris@0 52 public:
Chris@259 53 virtual ~RealTimePluginFactory();
Chris@259 54
Chris@0 55 static RealTimePluginFactory *instance(QString pluginType);
Chris@0 56 static RealTimePluginFactory *instanceFor(QString identifier);
Chris@0 57 static std::vector<QString> getAllPluginIdentifiers();
Chris@0 58 static void enumerateAllPlugins(std::vector<QString> &);
Chris@0 59
Chris@1040 60 static void setSampleRate(sv_samplerate_t sampleRate) { m_sampleRate = sampleRate; }
Chris@0 61
Chris@0 62 /**
Chris@0 63 * Look up the plugin path and find the plugins in it. Called
Chris@0 64 * automatically after construction of a factory.
Chris@0 65 */
Chris@0 66 virtual void discoverPlugins() = 0;
Chris@0 67
Chris@0 68 /**
Chris@0 69 * Return a reference to a list of all plugin identifiers that can
Chris@0 70 * be created by this factory.
Chris@0 71 */
Chris@0 72 virtual const std::vector<QString> &getPluginIdentifiers() const = 0;
Chris@0 73
Chris@0 74 /**
Chris@0 75 * Append to the given list descriptions of all the available
Chris@0 76 * plugins and their ports. This is in a standard format, see
Chris@0 77 * the LADSPA implementation for details.
Chris@0 78 */
Chris@0 79 virtual void enumeratePlugins(std::vector<QString> &list) = 0;
Chris@0 80
Chris@0 81 /**
Chris@60 82 * Get some basic information about a plugin (rapidly).
Chris@60 83 */
Chris@1830 84 virtual RealTimePluginDescriptor getPluginDescriptor(QString identifier) const = 0;
Chris@60 85
Chris@60 86 /**
Chris@0 87 * Instantiate a plugin.
Chris@0 88 */
Chris@1830 89 virtual std::shared_ptr<RealTimePluginInstance> instantiatePlugin(QString identifier,
Chris@1429 90 int clientId,
Chris@1429 91 int position,
Chris@1429 92 sv_samplerate_t sampleRate,
Chris@1429 93 int blockSize,
Chris@1429 94 int channels) = 0;
Chris@0 95
Chris@165 96 /**
Chris@165 97 * Get category metadata about a plugin (without instantiating it).
Chris@165 98 */
Chris@165 99 virtual QString getPluginCategory(QString identifier) = 0;
Chris@165 100
Chris@1464 101 /**
Chris@1464 102 * Get the full file path (including both directory and filename)
Chris@1464 103 * of the library file that provides a given plugin
Chris@1464 104 * identifier. Note getPluginIdentifiers() must have been called
Chris@1464 105 * before this has access to the necessary information.
Chris@1464 106 */
Chris@1464 107 virtual QString getPluginLibraryPath(QString identifier) = 0;
Chris@1464 108
Chris@0 109 protected:
Chris@0 110 RealTimePluginFactory() { }
Chris@0 111
Chris@1040 112 static sv_samplerate_t m_sampleRate;
Chris@0 113 };
Chris@0 114
Chris@0 115 #endif