iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
IPlugConstants.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
21#include <stdint.h>
22#include "IPlugPlatform.h"
23
24BEGIN_IPLUG_NAMESPACE
25
26#if !defined(SAMPLE_TYPE_FLOAT) && !defined(SAMPLE_TYPE_DOUBLE)
27#define SAMPLE_TYPE_DOUBLE
28#endif
29
30#ifdef SAMPLE_TYPE_DOUBLE
31using PLUG_SAMPLE_DST = double;
32using PLUG_SAMPLE_SRC = float;
33#else
34using PLUG_SAMPLE_DST = float;
35using PLUG_SAMPLE_SRC = double;
36#endif
37
38using sample = PLUG_SAMPLE_DST;
39
40#define LOGFILE "IPlugLog.txt"
41#define MAX_PROCESS_TRACE_COUNT 100
42#define MAX_IDLE_TRACE_COUNT 15
43
44enum EIPlugPluginType
45{
46 kEffect = 0,
47 kInstrument = 1,
48 kMIDIEffect = 2,
49 kGenerator = 3
50};
51
52enum EVST3ParamIDs
53{
54#ifdef IPLUG1_COMPATIBILITY
55 kBypassParam = 'bpas',
56 kPresetParam = 'prst',
57 kMIDICCParamStartIdx
58#else
59 kBypassParam = 65536,
60 kPresetParam, // not used unless baked in presets declared
61 kMIDICCParamStartIdx
62#endif
63};
64
65static const double PI = 3.1415926535897932384626433832795;
66
71static const double AMP_DB = 8.685889638065036553;
76static const double IAMP_DB = 0.11512925464970;
77static const double DEFAULT_SAMPLE_RATE = 48000.0;
78static const int MAX_PRESET_NAME_LEN = 256;
79#define UNUSED_PRESET_NAME "empty"
80#define DEFAULT_USER_PRESET_NAME "user preset"
81
82#define AU_MAX_IO_CHANNELS 128
83
84#define MAX_MACOS_PATH_LEN 1024
85#define MAX_WIN32_PATH_LEN 256
86#define MAX_WIN32_PARAM_LEN 256
87#define IPLUG_WIN_MAX_WIDE_PATH 4096
88
89#define MAX_PLUGIN_NAME_LEN 128
90
91#define MAX_PARAM_NAME_LEN 32 // e.g. "Gain"
92#define MAX_PARAM_LABEL_LEN 32 // e.g. "Percent"
93#define MAX_PARAM_DISPLAY_LEN 32 // e.g. "100" / "Mute"
94#define MAX_PARAM_GROUP_LEN 32 // e.g. "oscillator section"
95#define MAX_BUS_NAME_LEN 32 // e.g. "sidechain input"
96#define MAX_CHAN_NAME_LEN 32 // e.g. "input 1"
97
98#define MAX_VERSION_STR_LEN 32
99#define MAX_BUILD_INFO_STR_LEN 256
100static const int MAX_PARAM_DISPLAY_PRECISION = 6;
101
102#define MAX_AAX_PARAMID_LEN 32
103
104#define PARAM_UNINIT 99.99e-9
105
106#ifndef MAX_BLOB_LENGTH
107#define MAX_BLOB_LENGTH 2048
108#endif
109
110#ifndef IDLE_TIMER_RATE
111#define IDLE_TIMER_RATE 20 // this controls the frequency of data going from processor to editor (and OnIdle calls)
112#endif
113
114#ifndef MAX_SYSEX_SIZE
115#define MAX_SYSEX_SIZE 512
116#endif
117
118#define PARAM_TRANSFER_SIZE 512
119#define MIDI_TRANSFER_SIZE 32
120#define SYSEX_TRANSFER_SIZE 4
121
122// All version ints are stored as 0xVVVVRRMM: V = version, R = revision, M = minor revision.
123#define IPLUG_VERSION 0x010000
124#define IPLUG_VERSION_MAGIC 'pfft'
125
126static const int DEFAULT_BLOCK_SIZE = 1024;
127static const double DEFAULT_TEMPO = 120.0;
128static const int kNoParameter = -1;
129static const int kNoValIdx = -1;
130static const int kNoTag = -1;
131
132#define MAX_BUS_CHANS 64 // wild cards in channel i/o strings will result in this many channels
133
134//#if defined VST3_API || defined VST3C_API || defined VST3P_API
135//#undef stricmp
136//#undef strnicmp
137//#include "pluginterfaces/vst/vsttypes.h"
138//static const uint64_t kInvalidBusType = Steinberg::Vst::SpeakerArr::kEmpty;
139//#elif defined AU_API || AUv3_API
140//#include <CoreAudio/CoreAudio.h>
141//static const uint64_t kInvalidBusType = kAudioChannelLayoutTag_Unknown;
142//#elif defined AAX_API
143//#include "AAX_Enums.h"
144//static const uint64_t kInvalidBusType = AAX_eStemFormat_None;
145//#else
146//static const uint64_t kInvalidBusType = 0;
147//#endif
148
153{
154 kReset,
155 kHost,
156 kPresetRecall,
157 kUI,
158 kDelegate,
159 kRecompile, // for JIT
160 kUnknown,
161 kNumParamSources
162};
163
164static const char* ParamSourceStrs[kNumParamSources] = { "Reset", "Host", "Preset", "UI", "Editor Delegate", "Recompile", "Unknown"};
165
170{
171 kInput = 0,
172 kOutput = 1
173};
174
175static const char* RoutingDirStrs[2] = { "Input", "Output" };
176
177enum EAPI
178{
179 kAPIVST2 = 0,
180 kAPIVST3 = 1,
181 kAPIAU = 2,
182 kAPIAUv3 = 3,
183 kAPIAAX = 4,
184 kAPIAPP = 5,
185 kAPIWAM = 6,
186 kAPIWEB = 7,
187 kAPICLAP = 8
188};
189
194{
195 kHostUninit = -1,
196 kHostUnknown = 0,
197 kHostReaper,
198 kHostProTools,
199 kHostCubase,
200 kHostNuendo,
201 kHostSonar,
202 kHostVegas,
203 kHostFL,
204 kHostSamplitude,
205 kHostAbletonLive,
206 kHostTracktion,
207 kHostNTracks,
208 kHostMelodyneStudio,
209 kHostVSTScanner,
210 kHostAULab,
211 kHostForte,
212 kHostChainer,
213 kHostAudition,
214 kHostOrion,
215 kHostBias,
216 kHostSAWStudio,
217 kHostLogic,
218 kHostGarageBand,
219 kHostDigitalPerformer,
220 kHostStandalone,
221 kHostAudioMulch,
222 kHostStudioOne,
223 kHostVST3TestHost,
224 kHostArdour,
225 kHostRenoise,
226 kHostOpenMPT,
227 kHostWaveLab,
228 kHostWaveLabElements,
229 kHostTwistedWave,
230 kHostBitwig,
231 kHostWWW,
232
233 kHostReason,
234 kHostGoldWave5x,
235 kHostWaveform,
236 kHostAudacity,
237 kHostAcoustica,
238 kHostPluginDoctor,
239 kHostiZotopeRX,
240 kHostSAVIHost,
241 kHostBlueCat,
242 kHostMixbus32C
243
244 // These hosts don't report the host name:
245 // EnergyXT2
246 // MiniHost
247};
248
249enum EResourceLocation
250{
251 kNotFound = 0,
252 kAbsolutePath,
253 kWinBinary,
254 kPreloadedTexture
255};
256
257// These constants come from vstpreset.cpp, allowing saving of VST3 format presets without including the VST3 SDK
258typedef char ChunkID[4];
259
260enum ChunkType
261{
262 kHeader,
263 kComponentState,
264 kControllerState,
265 kProgramData,
266 kMetaInfo,
267 kChunkList,
268 kNumPresetChunks
269};
270
271static const ChunkID commonChunks[kNumPresetChunks] = {
272 {'V', 'S', 'T', '3'}, // kHeader
273 {'C', 'o', 'm', 'p'}, // kComponentState
274 {'C', 'o', 'n', 't'}, // kControllerState
275 {'P', 'r', 'o', 'g'}, // kProgramData
276 {'I', 'n', 'f', 'o'}, // kMetaInfo
277 {'L', 'i', 's', 't'} // kChunkList
278};
279
280// Preset Header: header id + version + class id + list offset
281static const int32_t kFormatVersion = 1;
282static const int32_t kClassIDSize = 32; // ASCII-encoded FUID
283static const int32_t kHeaderSize = sizeof (ChunkID) + sizeof (int32_t) + kClassIDSize + sizeof (int64_t);
284//static const int32_t kListOffsetPos = kHeaderSize - sizeof (int64_t);
285
286// Preset Version Constants
287static const int kFXPVersionNum = 1;
288static const int kFXBVersionNum = 2;
289
290// This enumeration must match win32 Fkeys as specified in winuser.h
291enum ESpecialKey
292{
293 kFVIRTKEY = 0x01,
294 kFSHIFT = 0x04,
295 kFCONTROL = 0x08,
296 kFALT = 0x10,
297 kFLWIN = 0x20
298};
299
300// This enumeration must match win32 virtual keys as specified in winuser.h
301enum EVirtualKey
302{
303 kVK_NONE = 0x00,
304
305 kVK_LBUTTON = 0x01,
306 kVK_RBUTTON = 0x02,
307 kVK_MBUTTON = 0x04,
308
309 kVK_BACK = 0x08,
310 kVK_TAB = 0x09,
311
312 kVK_CLEAR = 0x0C,
313 kVK_RETURN = 0x0D,
314
315 kVK_SHIFT = 0x10,
316 kVK_CONTROL = 0x11,
317 kVK_MENU = 0x12,
318 kVK_PAUSE = 0x13,
319 kVK_CAPITAL = 0x14,
320
321 kVK_ESCAPE = 0x1B,
322
323 kVK_SPACE = 0x20,
324 kVK_PRIOR = 0x21,
325 kVK_NEXT = 0x22,
326 kVK_END = 0x23,
327 kVK_HOME = 0x24,
328 kVK_LEFT = 0x25,
329 kVK_UP = 0x26,
330 kVK_RIGHT = 0x27,
331 kVK_DOWN = 0x28,
332 kVK_SELECT = 0x29,
333 kVK_PRINT = 0x2A,
334 kVK_SNAPSHOT = 0x2C,
335 kVK_INSERT = 0x2D,
336 kVK_DELETE = 0x2E,
337 kVK_HELP = 0x2F,
338
339 kVK_0 = 0x30,
340 kVK_1 = 0x31,
341 kVK_2 = 0x32,
342 kVK_3 = 0x33,
343 kVK_4 = 0x34,
344 kVK_5 = 0x35,
345 kVK_6 = 0x36,
346 kVK_7 = 0x37,
347 kVK_8 = 0x38,
348 kVK_9 = 0x39,
349 kVK_A = 0x41,
350 kVK_B = 0x42,
351 kVK_C = 0x43,
352 kVK_D = 0x44,
353 kVK_E = 0x45,
354 kVK_F = 0x46,
355 kVK_G = 0x47,
356 kVK_H = 0x48,
357 kVK_I = 0x49,
358 kVK_J = 0x4A,
359 kVK_K = 0x4B,
360 kVK_L = 0x4C,
361 kVK_M = 0x4D,
362 kVK_N = 0x4E,
363 kVK_O = 0x4F,
364 kVK_P = 0x50,
365 kVK_Q = 0x51,
366 kVK_R = 0x52,
367 kVK_S = 0x53,
368 kVK_T = 0x54,
369 kVK_U = 0x55,
370 kVK_V = 0x56,
371 kVK_W = 0x57,
372 kVK_X = 0x58,
373 kVK_Y = 0x59,
374 kVK_Z = 0x5A,
375
376 kVK_LWIN = 0x5B,
377
378 kVK_NUMPAD0 = 0x60,
379 kVK_NUMPAD1 = 0x61,
380 kVK_NUMPAD2 = 0x62,
381 kVK_NUMPAD3 = 0x63,
382 kVK_NUMPAD4 = 0x64,
383 kVK_NUMPAD5 = 0x65,
384 kVK_NUMPAD6 = 0x66,
385 kVK_NUMPAD7 = 0x67,
386 kVK_NUMPAD8 = 0x68,
387 kVK_NUMPAD9 = 0x69,
388 kVK_MULTIPLY = 0x6A,
389 kVK_ADD = 0x6B,
390 kVK_SEPARATOR = 0x6C,
391 kVK_SUBTRACT = 0x6D,
392 kVK_DECIMAL = 0x6E,
393 kVK_DIVIDE = 0x6F,
394 kVK_F1 = 0x70,
395 kVK_F2 = 0x71,
396 kVK_F3 = 0x72,
397 kVK_F4 = 0x73,
398 kVK_F5 = 0x74,
399 kVK_F6 = 0x75,
400 kVK_F7 = 0x76,
401 kVK_F8 = 0x77,
402 kVK_F9 = 0x78,
403 kVK_F10 = 0x79,
404 kVK_F11 = 0x7A,
405 kVK_F12 = 0x7B,
406 kVK_F13 = 0x7C,
407 kVK_F14 = 0x7D,
408 kVK_F15 = 0x7E,
409 kVK_F16 = 0x7F,
410 kVK_F17 = 0x80,
411 kVK_F18 = 0x81,
412 kVK_F19 = 0x82,
413 kVK_F20 = 0x83,
414 kVK_F21 = 0x84,
415 kVK_F22 = 0x85,
416 kVK_F23 = 0x86,
417 kVK_F24 = 0x87,
418
419 kVK_NUMLOCK = 0x90,
420 kVK_SCROLL = 0x91
421};
422
423END_IPLUG_NAMESPACE
424
Include to get consistently named preprocessor macros for different platforms and logging functionali...
EParamSource
Used to identify the source of a parameter change.
ERoute
Used to identify whether a bus/channel connection is an input or an output.
static const double IAMP_DB
Magic number for dB to gain conversion.
static const double AMP_DB
Magic number for gain to dB conversion.
EHost
Host identifier.