DISTRHO Plugin Framework
 All Classes Functions Variables Modules Pages
DistrhoInfo.hpp
1 /*
2  * DISTRHO Plugin Framework (DPF)
3  * Copyright (C) 2012-2015 Filipe Coelho <falktx@falktx.com>
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any purpose with
6  * or without fee is hereby granted, provided that the above copyright notice and this
7  * permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
10  * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
11  * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
12  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
13  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifdef DOXYGEN
18 
19 #include "src/DistrhoDefines.h"
20 
21 START_NAMESPACE_DISTRHO
22 
23 /* ------------------------------------------------------------------------------------------------------------
24  * Intro */
25 
26 /**
27  @mainpage DISTRHO %Plugin Framework
28 
29  DISTRHO %Plugin Framework (or @b DPF for short)
30  is a plugin framework designed to make development of new plugins an easy and enjoyable task.@n
31  It allows developers to create plugins with custom UIs using a simple C++ API.
32 
33  @section Macros
34  You start by creating a "DistrhoPluginInfo.h" file describing the plugin via macros, see @ref PluginMacros.@n
35  This file is included in the main DPF code to figure out which features for each plugin format to export.
36 
37  For example, a plugin (with %UI) that use states will require LV2 hosts to support Atom and Worker extensions for
38  message passing from the %UI to the plugin.@n
39  If your plugin does not make use of states, the Worker extension is not set as a required feature.
40 
41  @section Plugin
42  The next step is to create your plugin code by subclassing DPF's @ref Plugin class.@n
43  You need to pass the number of parameters in the constructor and also the number of programs and states, if any.
44 
45  Here's an example of an audio plugin that simply mutes the host output:
46  @code
47  class MutePlugin : public Plugin
48  {
49  public:
50  MutePlugin()
51  : Plugin(0, 0, 0) // 0 parameters, 0 programs and 0 states
52  {
53  }
54 
55  protected:
56  const char* getLabel() const override
57  {
58  return "Mute";
59  }
60 
61  const char* getMaker() const override
62  {
63  return "DPF";
64  }
65 
66  const char* getLicense() const override
67  {
68  return "MIT";
69  }
70 
71  uint32_t getVersion() const override
72  {
73  return 0x1000;
74  }
75 
76  int64_t getUniqueId() const override
77  {
78  return cconst('M', 'u', 't', 'e');
79  }
80 
81  void run(const float**, float** outputs, uint32_t frames) override
82  {
83  // get the left and right audio outputs
84  float* const outL = outputs[0];
85  float* const outR = outputs[1];
86 
87  // mute audio
88  std::memset(outL, 0, sizeof(float)*frames);
89  std::memset(outR, 0, sizeof(float)*frames);
90  }
91  };
92  @endcode
93 
94  See the @ref Plugin class for more information and to understand what each function does.
95 
96  @section Parameters
97  describe input and output, automable and rt safe, boolean etc, cv
98 
99  @section Programs
100  describe them
101 
102  @section States
103  describe them
104 
105  @section MIDI
106  describe them
107 
108  @section Latency
109  describe it
110 
111  @section Time-Position
112  describe it
113 
114  @section UI
115  describe them
116 */
117 
118 /* ------------------------------------------------------------------------------------------------------------
119  * Plugin Macros */
120 
121 /**
122  @defgroup PluginMacros Plugin Macros
123 
124  C Macros that describe your plugin. (defined in the "DistrhoPluginInfo.h" file)
125 
126  With these macros you can tell the host what features your plugin requires.@n
127  Depending on which macros you enable, new functions will be available to call and/or override.
128 
129  All values are either integer or strings.@n
130  For boolean-like values 1 means 'on' and 0 means 'off'.
131 
132  The values defined in this group are for documentation purposes only.@n
133  All macros are disabled by default.
134 
135  Only 4 macros are required, they are:
136  - @ref DISTRHO_PLUGIN_NAME
137  - @ref DISTRHO_PLUGIN_NUM_INPUTS
138  - @ref DISTRHO_PLUGIN_NUM_OUTPUTS
139  - @ref DISTRHO_PLUGIN_URI
140  @{
141  */
142 
143 /**
144  The plugin name.@n
145  This is used to identify your plugin before a Plugin instance can be created.
146  @note This macro is required.
147  */
148 #define DISTRHO_PLUGIN_NAME "Plugin Name"
149 
150 /**
151  Number of audio inputs the plugin has.
152  @note This macro is required.
153  */
154 #define DISTRHO_PLUGIN_NUM_INPUTS 2
155 
156 /**
157  Number of audio outputs the plugin has.
158  @note This macro is required.
159  */
160 #define DISTRHO_PLUGIN_NUM_OUTPUTS 2
161 
162 /**
163  The plugin URI when exporting in LV2 format.
164  @note This macro is required.
165  */
166 #define DISTRHO_PLUGIN_URI "urn:distrho:name"
167 
168 /**
169  Wherever the plugin has a custom %UI.
170  @see DISTRHO_UI_USE_NANOVG
171  @see UI
172  */
173 #define DISTRHO_PLUGIN_HAS_UI 1
174 
175 /**
176  Wherever the plugin processing is realtime-safe.@n
177  TODO - list rtsafe requirements
178  */
179 #define DISTRHO_PLUGIN_IS_RT_SAFE 1
180 
181 /**
182  Wherever the plugin is a synth.@n
183  @ref DISTRHO_PLUGIN_WANT_MIDI_INPUT is automatically enabled when this is too.
184  @see DISTRHO_PLUGIN_WANT_MIDI_INPUT
185  */
186 #define DISTRHO_PLUGIN_IS_SYNTH 1
187 
188 /**
189  Enable direct access between the %UI and plugin code.
190  @see UI::getPluginInstancePointer()
191  @note DO NOT USE THIS UNLESS STRICTLY NECESSARY!!
192  Try to avoid it at all costs!
193  */
194 #define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 0
195 
196 /**
197  Wherever the plugin introduces latency during audio or midi processing.
198  @see Plugin::setLatency(uint32_t)
199  */
200 #define DISTRHO_PLUGIN_WANT_LATENCY 1
201 
202 /**
203  Wherever the plugin wants MIDI input.@n
204  This is automatically enabled if @ref DISTRHO_PLUGIN_IS_SYNTH is true.
205  */
206 #define DISTRHO_PLUGIN_WANT_MIDI_INPUT 1
207 
208 /**
209  Wherever the plugin wants MIDI output.
210  @see Plugin::writeMidiEvent(const MidiEvent&)
211  */
212 #define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1
213 
214 /**
215  Wherever the plugin provides its own internal programs.
216  @see Plugin::initProgramName(uint32_t, String&)
217  @see Plugin::setProgram(uint32_t)
218  */
219 #define DISTRHO_PLUGIN_WANT_PROGRAMS 1
220 
221 /**
222  Wherever the plugin uses internal non-parameter data.
223  @see Plugin::initState(uint32_t, String&, String&)
224  @see Plugin::setState(const char*, const char*)
225  */
226 #define DISTRHO_PLUGIN_WANT_STATE 1
227 
228 /**
229  Wherever the plugin wants time position information from the host.
230  @see Plugin::getTimePosition()
231  */
232 #define DISTRHO_PLUGIN_WANT_TIMEPOS 1
233 
234 /**
235  Wherever the %UI uses NanoVG for drawing instead of the default raw OpenGL calls.@n
236  When enabled your %UI instance will subclass @ref NanoWidget instead of @ref Widget.
237  */
238 #define DISTRHO_UI_USE_NANOVG 1
239 
240 /**
241  The %UI URI when exporting in LV2 format.@n
242  By default this is set to @ref DISTRHO_PLUGIN_URI with "#UI" as suffix.
243  */
244 #define DISTRHO_UI_URI DISTRHO_PLUGIN_URI "#UI"
245 
246 /** @} */
247 
248 // -----------------------------------------------------------------------------------------------------------
249 
250 END_NAMESPACE_DISTRHO
251 
252 #endif // DOXYGEN