iPlug2 - C++ Audio Plug-in Framework
IPlug_include_in_plug_hdr.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the iPlug 2 library. Copyright (C) the iPlug 2 developers.
5 
6  See LICENSE.txt for more info.
7 
8  ==============================================================================
9 */
10 
11 #pragma once
12 
20 #include <cstdio>
21 #include "IPlugPlatform.h"
22 #include "config.h"
23 
24 #define API_EXT2
25 #ifdef VST2_API
26 #ifdef REAPER_PLUGIN
27  #define LICE_PROVIDED_BY_APP
28 // #define SWELL_PROVIDED_BY_APP
29  #include "IPlugReaperVST2.h"
30  #define PLUGIN_API_BASE IPlugReaperVST2
31 
32  #ifdef FillRect
33  #undef FillRect
34  #endif
35  #ifdef DrawText
36  #undef DrawText
37  #endif
38  #ifdef Polygon
39  #undef Polygon
40  #endif
41 
42 #else
43  #include "IPlugVST2.h"
44  #define PLUGIN_API_BASE IPlugVST2
45 #endif
46  #define API_EXT "vst"
47 #elif defined AU_API
48  #include "IPlugAU.h"
49  #define PLUGIN_API_BASE IPlugAU
50  #define API_EXT "audiounit"
51 #elif defined AUv3_API
52  #include "IPlugAUv3.h"
53  #define PLUGIN_API_BASE IPlugAUv3
54  #define API_EXT "app"
55  #undef API_EXT2
56  #define API_EXT2 ".AUv3"
57 #elif defined AAX_API
58  #include "IPlugAAX.h"
59  #define PLUGIN_API_BASE IPlugAAX
60  #define API_EXT "aax"
61  #define PROTOOLS
62 #elif defined APP_API
63  #include "IPlugAPP.h"
64  #define PLUGIN_API_BASE IPlugAPP
65  #define API_EXT "app"
66 #elif defined WAM_API
67  #include "IPlugWAM.h"
68  #define PLUGIN_API_BASE IPlugWAM
69 #elif defined WEB_API
70  #include "IPlugWeb.h"
71  #define PLUGIN_API_BASE IPlugWeb
72 #elif defined VST3_API
73  #define IPLUG_VST3
74  #include "IPlugVST3.h"
75  #define PLUGIN_API_BASE IPlugVST3
76  #define API_EXT "vst3"
77 #elif defined VST3C_API
78  #define IPLUG_VST3
79  #include "IPlugVST3_Controller.h"
80  #define PLUGIN_API_BASE IPlugVST3Controller
81  #undef PLUG_CLASS_NAME
82  #define PLUG_CLASS_NAME VST3Controller
83  #define API_EXT "vst3"
84 #elif defined VST3P_API
85  #define IPLUG_VST3
86  #include "IPlugVST3_Processor.h"
87  #define PLUGIN_API_BASE IPlugVST3Processor
88  #define API_EXT "vst3"
89 #else
90  #error "No API defined!"
91 #endif
92 
93 BEGIN_IPLUG_NAMESPACE
94 using Plugin = PLUGIN_API_BASE;
95 END_IPLUG_NAMESPACE
96 
97 #ifdef OS_WIN
98  #define EXPORT __declspec(dllexport)
99  #define BUNDLE_ID ""
100 #elif defined OS_MAC
101  #define BUNDLE_ID BUNDLE_DOMAIN "." BUNDLE_MFR "." API_EXT "." BUNDLE_NAME API_EXT2
102  #define EXPORT __attribute__ ((visibility("default")))
103 #elif defined OS_IOS
104  #define BUNDLE_ID BUNDLE_DOMAIN "." BUNDLE_MFR "." BUNDLE_NAME API_EXT2
105  #define EXPORT __attribute__ ((visibility("default")))
106 #elif defined OS_LINUX
107  //TODO:
108 #elif defined OS_WEB
109  #define BUNDLE_ID ""
110 #else
111  #error "No OS defined!"
112 #endif
113 
114 #if !defined NO_IGRAPHICS && !defined VST3P_API
116 #endif
117 
118 #define STRINGISE_IMPL(x) #x
119 #define STRINGISE(x) STRINGISE_IMPL(x)
120 
121 // Use: #pragma message WARN("My message")
122 #if _MSC_VER
123 # define FILE_LINE_LINK __FILE__ "(" STRINGISE(__LINE__) ") : "
124 # define WARN(exp) (FILE_LINE_LINK "WARNING: " exp)
125 #else//__GNUC__ - may need other defines for different compilers
126 # define WARN(exp) ("WARNING: " exp)
127 #endif
128 
129 #ifndef PLUG_NAME
130  #error You need to define PLUG_NAME in config.h - The name of your plug-in, with no spaces
131 #endif
132 
133 #ifndef PLUG_MFR
134  #error You need to define PLUG_MFR in config.h - The manufacturer name
135 #endif
136 
137 #ifndef PLUG_TYPE
138  #error You need to define PLUG_TYPE in config.h. 0 = Effect, 1 = Instrument, 2 = MIDI Effect
139 #endif
140 
141 #ifndef PLUG_VERSION_HEX
142  #error You need to define PLUG_VERSION_HEX in config.h - The hexadecimal version number in the form 0xVVVVRRMM: V = version, R = revision, M = minor revision.
143 #endif
144 
145 #ifndef PLUG_UNIQUE_ID
146  #error You need to define PLUG_UNIQUE_ID in config.h - The unique four char ID for your plug-in, e.g. 'IPeF'
147 #endif
148 
149 #ifndef PLUG_MFR_ID
150  #error You need to define PLUG_MFR_ID in config.h - The unique four char ID for your manufacturer, e.g. 'Acme'
151 #endif
152 
153 #ifndef PLUG_CLASS_NAME
154  #error PLUG_CLASS_NAME not defined - this is the name of your main iPlug plug-in class (no spaces allowed)
155 #endif
156 
157 #ifndef BUNDLE_NAME
158  #error BUNDLE_NAME not defined - this is the product name part of the plug-in's bundle ID (used on macOS and iOS)
159 #endif
160 
161 #ifndef BUNDLE_MFR
162  #error BUNDLE_MFR not defined - this is the manufacturer name part of the plug-in's bundle ID (used on macOS and iOS)
163 #endif
164 
165 #ifndef BUNDLE_DOMAIN
166  #error BUNDLE_DOMAIN not defined - this is the domain name part of the plug-in's bundle ID (used on macOS and iOS)
167 #endif
168 
169 #ifndef PLUG_CHANNEL_IO
170  #error PLUG_CHANNEL_IO not defined - you need to specify the input and output configurations of the plug-in e.g. "2-2"
171 #endif
172 
173 #ifndef PLUG_LATENCY
174  #define PLUG_LATENCY 0
175 #endif
176 
177 #ifndef PLUG_DOES_MIDI_IN
178  #pragma message WARN("PLUG_DOES_MIDI_IN not defined, setting to 0")
179  #define PLUG_DOES_MIDI_IN 0
180 #endif
181 
182 #ifndef PLUG_DOES_MIDI_OUT
183  #pragma message WARN("PLUG_DOES_MIDI_OUT not defined, setting to 0")
184  #define PLUG_DOES_MIDI_OUT 0
185 #endif
186 
187 #ifndef PLUG_DOES_MPE
188  #pragma message WARN("PLUG_DOES_MPE not defined, setting to 0")
189  #define PLUG_DOES_MPE 0
190 #endif
191 
192 #ifndef PLUG_DOES_STATE_CHUNKS
193  #pragma message WARN("PLUG_DOES_STATE_CHUNKS not defined, setting to 0")
194  #define PLUG_DOES_STATE_CHUNKS 0
195 #endif
196 
197 #ifndef PLUG_HAS_UI
198  #pragma message WARN("PLUG_HAS_UI not defined, setting to 0")
199  #define PLUG_HAS_UI 0
200 #endif
201 
202 #ifndef PLUG_WIDTH
203  #pragma message WARN("PLUG_WIDTH not defined, setting to 500px")
204  #define PLUG_WIDTH 500
205 #endif
206 
207 #ifndef PLUG_HEIGHT
208  #pragma message WARN("PLUG_HEIGHT not defined, setting to 500px")
209  #define PLUG_HEIGHT 500
210 #endif
211 
212 #ifndef PLUG_MIN_WIDTH
213  #define PLUG_MIN_WIDTH (PLUG_WIDTH / 2)
214 #endif
215 
216 #ifndef PLUG_MIN_HEIGHT
217  #define PLUG_MIN_HEIGHT (PLUG_HEIGHT / 2)
218 #endif
219 
220 #ifndef PLUG_MAX_WIDTH
221  #define PLUG_MAX_WIDTH (PLUG_WIDTH * 2)
222 #endif
223 
224 #ifndef PLUG_MAX_HEIGHT
225  #define PLUG_MAX_HEIGHT (PLUG_HEIGHT * 2)
226 #endif
227 
228 #ifndef PLUG_FPS
229  #pragma message WARN("PLUG_FPS not defined, setting to 60")
230  #define PLUG_FPS 60
231 #endif
232 
233 #ifndef PLUG_SHARED_RESOURCES
234  #pragma message WARN("PLUG_SHARED_RESOURCES not defined, setting to 0")
235  #define PLUG_SHARED_RESOURCES 0
236 #else
237  #ifndef SHARED_RESOURCES_SUBPATH
238  #pragma message WARN("SHARED_RESOURCES_SUBPATH not defined, setting to PLUG_NAME")
239  #define SHARED_RESOURCES_SUBPATH PLUG_NAME
240  #endif
241 #endif
242 
243 #ifdef IPLUG_VST3
244  #ifndef PLUG_VERSION_STR
245  #error You need to define PLUG_VERSION_STR in config.h - A string to identify the version number
246  #endif
247 
248  #ifndef PLUG_URL_STR
249  #pragma message WARN("PLUG_URL_STR not defined, setting to empty string")
250  #define PLUG_URL_STR ""
251  #endif
252 
253  #ifndef PLUG_EMAIL_STR
254  #pragma message WARN("PLUG_EMAIL_STR not defined, setting to empty string")
255  #define PLUG_EMAIL_STR ""
256  #endif
257 
258  #ifndef PLUG_COPYRIGHT_STR
259  #pragma message WARN("PLUG_COPYRIGHT_STR not defined, setting to empty string")
260  #define PLUG_COPYRIGHT_STR ""
261  #endif
262 
263  #ifndef VST3_SUBCATEGORY
264  #pragma message WARN("VST3_SUBCATEGORY not defined, setting to other")
265  #define VST3_SUBCATEGORY "Other"
266  #endif
267 #endif
268 
269 #ifdef AU_API
270  #ifndef AUV2_ENTRY
271  #error AUV2_ENTRY not defined - the name of the entry point for a component manager AUv2 plug-in, without quotes
272  #endif
273  #ifndef AUV2_ENTRY_STR
274  #error AUV2_ENTRY_STR not defined - the name of the entry point for a component manager AUv2 plug-in, with quotes
275  #endif
276  #ifndef AUV2_FACTORY
277  #error AUV2_FACTORY not defined - the name of the entry point for a AUPlugIn AUv2 plug-in, without quotes
278  #endif
279  #if PLUG_HAS_UI
280  #ifndef AUV2_VIEW_CLASS
281  #error AUV2_VIEW_CLASS not defined - the name of the Objective-C class for the AUv2 plug-in's view, without quotes
282  #endif
283  #ifndef AUV2_VIEW_CLASS_STR
284  #error AUV2_VIEW_CLASS_STR not defined - the name of the Objective-C class for the AUv2 plug-in's view, with quotes
285  #endif
286  #endif
287 #endif
288 
289 #ifdef AAX_API
290  #ifndef AAX_TYPE_IDS
291  #error AAX_TYPE_IDS not defined - list of comma separated four char IDs, that correspond to the different possible channel layouts of your plug-in, e.g. 'EFN1', 'EFN2'
292  #endif
293 
294  #ifndef AAX_PLUG_MFR_STR
295  #error AAX_PLUG_MFR_STR not defined - The manufacturer name as it will appear in Pro tools preset manager
296  #endif
297 
298  #ifndef AAX_PLUG_NAME_STR
299  #error AAX_PLUG_NAME_STR not defined - The plug-in name string, which may include shorten names separated with newline characters, e.g. "IPlugEffect\nIPEF"
300  #endif
301 
302  #ifndef AAX_PLUG_CATEGORY_STR
303  #error AAX_PLUG_CATEGORY_STR not defined - String defining the category for your plug-in, e.g. "Effect"
304  #endif
305 
306  #if AAX_DOES_AUDIOSUITE
307  #ifndef AAX_TYPE_IDS_AUDIOSUITE
308  #error AAX_TYPE_IDS_AUDIOSUITE not defined - list of comma separated four char IDs, that correspond to the different possible channel layouts of your plug-in when running off-line in audio suite mode, e.g. 'EFA1', 'EFA2'
309  #endif
310  #endif
311 #endif
Standalone application base class for an IPlug plug-in.
Include to get consistently named preprocessor macros for different platforms and logging functionali...
VST3 Processor API-base class for a distributed IPlug VST3 plug-in.
AAX API base class for an IPlug plug-in.
AudioUnit v2 API base class for an IPlug plug-in.
VST3 base class for a non-distributed IPlug VST3 plug-in.
VST3 Controller API-base class for a distributed IPlug VST3 plug-in.
AudioUnit v3 API base class for an IPlug plug-in.
IGraphics header include Include this file in the main header if using IGraphics outside a plugin con...