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