2 * DISTRHO Plugin Framework (DPF)
3 * Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com>
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.
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.
17 #ifndef DISTRHO_PLUGIN_CHECKS_H_INCLUDED
18 #define DISTRHO_PLUGIN_CHECKS_H_INCLUDED
20 #include "DistrhoPluginInfo.h"
22 // -----------------------------------------------------------------------
23 // Check if all required macros are defined
25 #ifndef DISTRHO_PLUGIN_NAME
26 # error DISTRHO_PLUGIN_NAME undefined!
29 #ifndef DISTRHO_PLUGIN_NUM_INPUTS
30 # error DISTRHO_PLUGIN_NUM_INPUTS undefined!
33 #ifndef DISTRHO_PLUGIN_NUM_OUTPUTS
34 # error DISTRHO_PLUGIN_NUM_OUTPUTS undefined!
37 #ifndef DISTRHO_PLUGIN_URI
38 # error DISTRHO_PLUGIN_URI undefined!
41 // -----------------------------------------------------------------------
42 // Define optional macros if not done yet
44 #ifndef DISTRHO_PLUGIN_HAS_UI
45 # define DISTRHO_PLUGIN_HAS_UI 0
48 #ifndef DISTRHO_PLUGIN_HAS_EXTERNAL_UI
49 # define DISTRHO_PLUGIN_HAS_EXTERNAL_UI 0
52 #ifndef DISTRHO_PLUGIN_IS_RT_SAFE
53 # define DISTRHO_PLUGIN_IS_RT_SAFE 0
56 #ifndef DISTRHO_PLUGIN_IS_SYNTH
57 # define DISTRHO_PLUGIN_IS_SYNTH 0
60 #ifndef DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
61 # define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 0
64 #ifndef DISTRHO_PLUGIN_WANT_LATENCY
65 # define DISTRHO_PLUGIN_WANT_LATENCY 0
68 #ifndef DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
69 # define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 0
72 #ifndef DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
73 # define DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST 0
76 #ifndef DISTRHO_PLUGIN_WANT_PROGRAMS
77 # define DISTRHO_PLUGIN_WANT_PROGRAMS 0
80 #ifndef DISTRHO_PLUGIN_WANT_STATE
81 # define DISTRHO_PLUGIN_WANT_STATE 0
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
89 #ifndef DISTRHO_PLUGIN_WANT_TIMEPOS
90 # define DISTRHO_PLUGIN_WANT_TIMEPOS 0
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
97 # define DISTRHO_UI_FILE_BROWSER 1
101 #ifndef DISTRHO_UI_USER_RESIZABLE
102 # define DISTRHO_UI_USER_RESIZABLE 0
105 #ifndef DISTRHO_UI_USE_NANOVG
106 # define DISTRHO_UI_USE_NANOVG 0
109 // -----------------------------------------------------------------------
110 // Define DISTRHO_PLUGIN_HAS_EMBED_UI if needed
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
116 # define DISTRHO_PLUGIN_HAS_EMBED_UI 0
120 // -----------------------------------------------------------------------
121 // Define DISTRHO_UI_URI if needed
123 #ifndef DISTRHO_UI_URI
124 # define DISTRHO_UI_URI DISTRHO_PLUGIN_URI "#DPF_UI"
127 // -----------------------------------------------------------------------
128 // Test if synth has audio outputs
130 #if DISTRHO_PLUGIN_IS_SYNTH && DISTRHO_PLUGIN_NUM_OUTPUTS == 0
131 # error Synths need audio output to work!
134 // -----------------------------------------------------------------------
135 // Enable MIDI input if synth, test if midi-input disabled when synth
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!
143 // -----------------------------------------------------------------------
144 // Enable state if plugin wants state files (deprecated)
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
155 // -----------------------------------------------------------------------
156 // Enable full state if plugin exports presets
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
164 // -----------------------------------------------------------------------
165 // Disable file browser if using external UI
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
173 // -----------------------------------------------------------------------
174 // Disable UI if DGL or external UI is not available
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
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
186 // -----------------------------------------------------------------------
187 // Prevent users from messing about with DPF internals
189 #ifdef DISTRHO_UI_IS_STANDALONE
190 # error DISTRHO_UI_IS_STANDALONE must not be defined
193 // -----------------------------------------------------------------------
195 #endif // DISTRHO_PLUGIN_CHECKS_H_INCLUDED