LMMS
Loading...
Searching...
No Matches
DistrhoPluginChecks.h
Go to the documentation of this file.
1/*
2 * DISTRHO Plugin Framework (DPF)
3 * Copyright (C) 2012-2022 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#ifndef DISTRHO_PLUGIN_CHECKS_H_INCLUDED
18#define DISTRHO_PLUGIN_CHECKS_H_INCLUDED
19
20#include "DistrhoPluginInfo.h"
21
22// -----------------------------------------------------------------------
23// Check if all required macros are defined
24
25#ifndef DISTRHO_PLUGIN_NAME
26# error DISTRHO_PLUGIN_NAME undefined!
27#endif
28
29#ifndef DISTRHO_PLUGIN_NUM_INPUTS
30# error DISTRHO_PLUGIN_NUM_INPUTS undefined!
31#endif
32
33#ifndef DISTRHO_PLUGIN_NUM_OUTPUTS
34# error DISTRHO_PLUGIN_NUM_OUTPUTS undefined!
35#endif
36
37#ifndef DISTRHO_PLUGIN_URI
38# error DISTRHO_PLUGIN_URI undefined!
39#endif
40
41// -----------------------------------------------------------------------
42// Define optional macros if not done yet
43
44#ifndef DISTRHO_PLUGIN_HAS_UI
45# define DISTRHO_PLUGIN_HAS_UI 0
46#endif
47
48#ifndef DISTRHO_PLUGIN_HAS_EXTERNAL_UI
49# define DISTRHO_PLUGIN_HAS_EXTERNAL_UI 0
50#endif
51
52#ifndef DISTRHO_PLUGIN_IS_RT_SAFE
53# define DISTRHO_PLUGIN_IS_RT_SAFE 0
54#endif
55
56#ifndef DISTRHO_PLUGIN_IS_SYNTH
57# define DISTRHO_PLUGIN_IS_SYNTH 0
58#endif
59
60#ifndef DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
61# define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 0
62#endif
63
64#ifndef DISTRHO_PLUGIN_WANT_LATENCY
65# define DISTRHO_PLUGIN_WANT_LATENCY 0
66#endif
67
68#ifndef DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
69# define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 0
70#endif
71
72#ifndef DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
73# define DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST 0
74#endif
75
76#ifndef DISTRHO_PLUGIN_WANT_PROGRAMS
77# define DISTRHO_PLUGIN_WANT_PROGRAMS 0
78#endif
79
80#ifndef DISTRHO_PLUGIN_WANT_STATE
81# define DISTRHO_PLUGIN_WANT_STATE 0
82#endif
83
84#ifndef DISTRHO_PLUGIN_WANT_FULL_STATE
85# define DISTRHO_PLUGIN_WANT_FULL_STATE 0
86# define DISTRHO_PLUGIN_WANT_FULL_STATE_WAS_NOT_SET
87#endif
88
89#ifndef DISTRHO_PLUGIN_WANT_TIMEPOS
90# define DISTRHO_PLUGIN_WANT_TIMEPOS 0
91#endif
92
93#ifndef DISTRHO_UI_FILE_BROWSER
94# if defined(DGL_FILE_BROWSER_DISABLED) || DISTRHO_PLUGIN_HAS_EXTERNAL_UI
95# define DISTRHO_UI_FILE_BROWSER 0
96# else
97# define DISTRHO_UI_FILE_BROWSER 1
98# endif
99#endif
100
101#ifndef DISTRHO_UI_USER_RESIZABLE
102# define DISTRHO_UI_USER_RESIZABLE 0
103#endif
104
105#ifndef DISTRHO_UI_USE_NANOVG
106# define DISTRHO_UI_USE_NANOVG 0
107#endif
108
109// -----------------------------------------------------------------------
110// Define DISTRHO_PLUGIN_HAS_EMBED_UI if needed
111
112#ifndef DISTRHO_PLUGIN_HAS_EMBED_UI
113# if (defined(DGL_CAIRO) && defined(HAVE_CAIRO)) || (defined(DGL_OPENGL) && defined(HAVE_OPENGL))
114# define DISTRHO_PLUGIN_HAS_EMBED_UI 1
115# else
116# define DISTRHO_PLUGIN_HAS_EMBED_UI 0
117# endif
118#endif
119
120// -----------------------------------------------------------------------
121// Define DISTRHO_UI_URI if needed
122
123#ifndef DISTRHO_UI_URI
124# define DISTRHO_UI_URI DISTRHO_PLUGIN_URI "#DPF_UI"
125#endif
126
127// -----------------------------------------------------------------------
128// Test if synth has audio outputs
129
130#if DISTRHO_PLUGIN_IS_SYNTH && DISTRHO_PLUGIN_NUM_OUTPUTS == 0
131# error Synths need audio output to work!
132#endif
133
134// -----------------------------------------------------------------------
135// Enable MIDI input if synth, test if midi-input disabled when synth
136
137#ifndef DISTRHO_PLUGIN_WANT_MIDI_INPUT
138# define DISTRHO_PLUGIN_WANT_MIDI_INPUT DISTRHO_PLUGIN_IS_SYNTH
139#elif DISTRHO_PLUGIN_IS_SYNTH && ! DISTRHO_PLUGIN_WANT_MIDI_INPUT
140# error Synths need MIDI input to work!
141#endif
142
143// -----------------------------------------------------------------------
144// Enable state if plugin wants state files (deprecated)
145
146#ifdef DISTRHO_PLUGIN_WANT_STATEFILES
147# warning DISTRHO_PLUGIN_WANT_STATEFILES is deprecated
148# undef DISTRHO_PLUGIN_WANT_STATEFILES
149# if ! DISTRHO_PLUGIN_WANT_STATE
150# undef DISTRHO_PLUGIN_WANT_STATE
151# define DISTRHO_PLUGIN_WANT_STATE 1
152# endif
153#endif
154
155// -----------------------------------------------------------------------
156// Enable full state if plugin exports presets
157
158#if DISTRHO_PLUGIN_WANT_PROGRAMS && DISTRHO_PLUGIN_WANT_STATE && defined(DISTRHO_PLUGIN_WANT_FULL_STATE_WAS_NOT_SET)
159# warning Plugins with programs and state should implement full state API too
160# undef DISTRHO_PLUGIN_WANT_FULL_STATE
161# define DISTRHO_PLUGIN_WANT_FULL_STATE 1
162#endif
163
164// -----------------------------------------------------------------------
165// Disable file browser if using external UI
166
167#if DISTRHO_UI_FILE_BROWSER && DISTRHO_PLUGIN_HAS_EXTERNAL_UI
168# warning file browser APIs do not work for external UIs
169# undef DISTRHO_UI_FILE_BROWSER 0
170# define DISTRHO_UI_FILE_BROWSER 0
171#endif
172
173// -----------------------------------------------------------------------
174// Disable UI if DGL or external UI is not available
175
176#if (defined(DGL_CAIRO) && ! defined(HAVE_CAIRO)) || (defined(DGL_OPENGL) && ! defined(HAVE_OPENGL))
177# undef DISTRHO_PLUGIN_HAS_EMBED_UI
178# define DISTRHO_PLUGIN_HAS_EMBED_UI 0
179#endif
180
181#if DISTRHO_PLUGIN_HAS_UI && ! DISTRHO_PLUGIN_HAS_EMBED_UI && ! DISTRHO_PLUGIN_HAS_EXTERNAL_UI
182# undef DISTRHO_PLUGIN_HAS_UI
183# define DISTRHO_PLUGIN_HAS_UI 0
184#endif
185
186// -----------------------------------------------------------------------
187// Prevent users from messing about with DPF internals
188
189#ifdef DISTRHO_UI_IS_STANDALONE
190# error DISTRHO_UI_IS_STANDALONE must not be defined
191#endif
192
193// -----------------------------------------------------------------------
194
195#endif // DISTRHO_PLUGIN_CHECKS_H_INCLUDED