annotate plugin/RealTimePluginFactory.h @ 1196:c7b9c902642f spectrogram-minor-refactor

Fix threshold in spectrogram -- it wasn't working in the last release. There is a new protocol for this. Formerly the threshold parameter had a range from -50dB to 0 with the default at -50, and -50 treated internally as "no threshold". However, there was a hardcoded, hidden internal threshold for spectrogram colour mapping at -80dB with anything below this being rounded to zero. Now the threshold parameter has range -81 to -1 with the default at -80, -81 is treated internally as "no threshold", and there is no hidden internal threshold. So the default behaviour is the same as before, an effective -80dB threshold, but it is now possible to change this in both directions. Sessions reloaded from prior versions may look slightly different because, if the session says there should be no threshold, there will now actually be no threshold instead of having the hidden internal one. Still need to do something in the UI to make it apparent that the -81dB setting removes the threshold entirely. This is at least no worse than the previous, also obscured, magic -50dB setting.
author Chris Cannam
date Mon, 01 Aug 2016 16:21:01 +0100
parents a1cd5abcb38b
children 48e9f538e6e9
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@686 28 #include "base/Debug.h"
Chris@1040 29 #include "base/BaseTypes.h"
Chris@686 30
Chris@0 31 class RealTimePluginInstance;
Chris@0 32
Chris@60 33 class RealTimePluginDescriptor
Chris@60 34 {
Chris@60 35 public:
Chris@60 36 std::string name;
Chris@60 37 std::string label;
Chris@60 38 std::string maker;
Chris@60 39 std::string copyright;
Chris@60 40 std::string category;
Chris@60 41 bool isSynth;
Chris@60 42 unsigned int parameterCount;
Chris@60 43 unsigned int audioInputPortCount;
Chris@166 44 unsigned int audioOutputPortCount;
Chris@60 45 unsigned int controlOutputPortCount;
Chris@60 46 std::vector<std::string> controlOutputPortNames;
Chris@60 47 };
Chris@60 48
Chris@0 49 class RealTimePluginFactory
Chris@0 50 {
Chris@0 51 public:
Chris@259 52 virtual ~RealTimePluginFactory();
Chris@259 53
Chris@0 54 static RealTimePluginFactory *instance(QString pluginType);
Chris@0 55 static RealTimePluginFactory *instanceFor(QString identifier);
Chris@0 56 static std::vector<QString> getAllPluginIdentifiers();
Chris@0 57 static void enumerateAllPlugins(std::vector<QString> &);
Chris@0 58
Chris@1040 59 static void setSampleRate(sv_samplerate_t sampleRate) { m_sampleRate = sampleRate; }
Chris@0 60
Chris@0 61 /**
Chris@0 62 * Look up the plugin path and find the plugins in it. Called
Chris@0 63 * automatically after construction of a factory.
Chris@0 64 */
Chris@0 65 virtual void discoverPlugins() = 0;
Chris@0 66
Chris@0 67 /**
Chris@0 68 * Return a reference to a list of all plugin identifiers that can
Chris@0 69 * be created by this factory.
Chris@0 70 */
Chris@0 71 virtual const std::vector<QString> &getPluginIdentifiers() const = 0;
Chris@0 72
Chris@0 73 /**
Chris@0 74 * Append to the given list descriptions of all the available
Chris@0 75 * plugins and their ports. This is in a standard format, see
Chris@0 76 * the LADSPA implementation for details.
Chris@0 77 */
Chris@0 78 virtual void enumeratePlugins(std::vector<QString> &list) = 0;
Chris@0 79
Chris@0 80 /**
Chris@60 81 * Get some basic information about a plugin (rapidly).
Chris@60 82 */
Chris@60 83 virtual const RealTimePluginDescriptor *getPluginDescriptor(QString identifier) const = 0;
Chris@60 84
Chris@60 85 /**
Chris@0 86 * Instantiate a plugin.
Chris@0 87 */
Chris@0 88 virtual RealTimePluginInstance *instantiatePlugin(QString identifier,
Chris@0 89 int clientId,
Chris@0 90 int position,
Chris@1040 91 sv_samplerate_t sampleRate,
Chris@1040 92 int blockSize,
Chris@1040 93 int channels) = 0;
Chris@0 94
Chris@165 95 /**
Chris@165 96 * Get category metadata about a plugin (without instantiating it).
Chris@165 97 */
Chris@165 98 virtual QString getPluginCategory(QString identifier) = 0;
Chris@165 99
Chris@0 100 protected:
Chris@0 101 RealTimePluginFactory() { }
Chris@0 102
Chris@0 103 // for call by RealTimePluginInstance dtor
Chris@0 104 virtual void releasePlugin(RealTimePluginInstance *, QString identifier) = 0;
Chris@0 105 friend class RealTimePluginInstance;
Chris@0 106
Chris@1040 107 static sv_samplerate_t m_sampleRate;
Chris@0 108 };
Chris@0 109
Chris@0 110 #endif