VstDefinitions.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925
  1. /*
  2. * VstDefinitions.h
  3. * ----------------
  4. * Purpose: Definition of all VST-related constants, function prototypes and structures.
  5. * Notes : Based on BeRo's independent VST header, a clean-room implementation based
  6. * on several third-party information sources.
  7. * The original header, licensed under the Zlib license, can be found at
  8. * https://github.com/BeRo1985/br808/blob/master/VSTi/VST/VST.pas
  9. * Authors: OpenMPT Devs
  10. * Benjamin "BeRo" Rosseaux
  11. * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
  12. */
  13. #pragma once
  14. #include "openmpt/all/BuildSettings.hpp"
  15. #if MPT_OS_WINDOWS
  16. #define VSTCALLBACK __cdecl
  17. #else
  18. #define VSTCALLBACK
  19. #endif
  20. namespace Vst
  21. {
  22. inline constexpr int32 kVstVersion = 2400;
  23. enum VstStringLengths
  24. {
  25. kVstMaxProgNameLen = 24,
  26. kVstMaxParamStrLen = 8,
  27. kVstMaxVendorStrLen = 64,
  28. kVstMaxProductStrLen = 64,
  29. kVstMaxEffectNameLen = 32,
  30. kVstMaxNameLen = 64,
  31. kVstMaxLabelLen = 64,
  32. kVstMaxShortLabelLen = 8,
  33. kVstMaxCategLabelLen = 24,
  34. kVstMaxFileNameLen = 100,
  35. };
  36. enum VstFlags : int32
  37. {
  38. effFlagsHasEditor = 1 << 0,
  39. effFlagsHasClip = 1 << 1,
  40. effFlagsHasVu = 1 << 2,
  41. effFlagsCanMono = 1 << 3,
  42. effFlagsCanReplacing = 1 << 4,
  43. effFlagsProgramChunks = 1 << 5,
  44. effFlagsIsSynth = 1 << 8,
  45. effFlagsNoSoundInStop = 1 << 9,
  46. effFlagsExtIsAsync = 1 << 10,
  47. effFlagsExtHasBuffer = 1 << 11,
  48. effFlagsCanDoubleReplacing = 1 << 12,
  49. };
  50. enum VstOpcodeToPlugin : int32
  51. {
  52. effOpen = 0,
  53. effClose = 1,
  54. effSetProgram = 2,
  55. effGetProgram = 3,
  56. effSetProgramName = 4,
  57. effGetProgramName = 5,
  58. effGetParamLabel = 6,
  59. effGetParamDisplay = 7,
  60. effGetParamName = 8,
  61. effGetVu = 9,
  62. effSetSampleRate = 10,
  63. effSetBlockSize = 11,
  64. effMainsChanged = 12,
  65. effEditGetRect = 13,
  66. effEditOpen = 14,
  67. effEditClose = 15,
  68. effEditDraw = 16,
  69. effEditMouse = 17,
  70. effEditKey = 18,
  71. effEditIdle = 19,
  72. effEditTop = 20,
  73. effEditSleep = 21,
  74. effIdentify = 22,
  75. effGetChunk = 23,
  76. effSetChunk = 24,
  77. effProcessEvents = 25,
  78. effCanBeAutomated = 26,
  79. effString2Parameter = 27,
  80. effGetNumProgramCategories = 28,
  81. effGetProgramNameIndexed = 29,
  82. effCopyProgram = 30,
  83. effConnectInput = 31,
  84. effConnectOutput = 32,
  85. effGetInputProperties = 33,
  86. effGetOutputProperties = 34,
  87. effGetPlugCategory = 35,
  88. effGetCurrentPosition = 36,
  89. effGetDestinationBuffer = 37,
  90. effOfflineNotify = 38,
  91. effOfflinePrepare = 39,
  92. effOfflineRun = 40,
  93. effProcessVarIo = 41,
  94. effSetSpeakerArrangement = 42,
  95. effSetBlockSizeAndSampleRate = 43,
  96. effSetBypass = 44,
  97. effGetEffectName = 45,
  98. effGetErrorText = 46,
  99. effGetVendorString = 47,
  100. effGetProductString = 48,
  101. effGetVendorVersion = 49,
  102. effVendorSpecific = 50,
  103. effCanDo = 51,
  104. effGetTailSize = 52,
  105. effIdle = 53,
  106. effGetIcon = 54,
  107. effSetViewPosition = 55,
  108. effGetParameterProperties = 56,
  109. effKeysRequired = 57,
  110. effGetVstVersion = 58,
  111. effEditKeyDown = 59,
  112. effEditKeyUp = 60,
  113. effSetEditKnobMode = 61,
  114. effGetMidiProgramName = 62,
  115. effGetCurrentMidiProgram = 63,
  116. effGetMidiProgramCategory = 64,
  117. effHasMidiProgramsChanged = 65,
  118. effGetMidiKeyName = 66,
  119. effBeginSetProgram = 67,
  120. effEndSetProgram = 68,
  121. effGetSpeakerArrangement = 69,
  122. effShellGetNextPlugin = 70,
  123. effStartProcess = 71,
  124. effStopProcess = 72,
  125. effSetTotalSampleToProcess = 73,
  126. effSetPanLaw = 74,
  127. effBeginLoadBank = 75,
  128. effBeginLoadProgram = 76,
  129. effSetProcessPrecision = 77,
  130. effGetNumMidiInputChannels = 78,
  131. effGetNumMidiOutputChannels = 79,
  132. };
  133. enum VstOpcodeToHost : int32
  134. {
  135. audioMasterAutomate = 0,
  136. audioMasterVersion = 1,
  137. audioMasterCurrentId = 2,
  138. audioMasterIdle = 3,
  139. audioMasterPinConnected = 4,
  140. audioMasterWantMidi = 6,
  141. audioMasterGetTime = 7,
  142. audioMasterProcessEvents = 8,
  143. audioMasterSetTime = 9,
  144. audioMasterTempoAt = 10,
  145. audioMasterGetNumAutomatableParameters = 11,
  146. audioMasterGetParameterQuantization = 12,
  147. audioMasterIOChanged = 13,
  148. audioMasterNeedIdle = 14,
  149. audioMasterSizeWindow = 15,
  150. audioMasterGetSampleRate = 16,
  151. audioMasterGetBlockSize = 17,
  152. audioMasterGetInputLatency = 18,
  153. audioMasterGetOutputLatency = 19,
  154. audioMasterGetPreviousPlug = 20,
  155. audioMasterGetNextPlug = 21,
  156. audioMasterWillReplaceOrAccumulate = 22,
  157. audioMasterGetCurrentProcessLevel = 23,
  158. audioMasterGetAutomationState = 24,
  159. audioMasterOfflineStart = 25,
  160. audioMasterOfflineRead = 26,
  161. audioMasterOfflineWrite = 27,
  162. audioMasterOfflineGetCurrentPass = 28,
  163. audioMasterOfflineGetCurrentMetaPass = 29,
  164. audioMasterSetOutputSampleRate = 30,
  165. audioMasterGetOutputSpeakerArrangement = 31,
  166. audioMasterGetVendorString = 32,
  167. audioMasterGetProductString = 33,
  168. audioMasterGetVendorVersion = 34,
  169. audioMasterVendorSpecific = 35,
  170. audioMasterSetIcon = 36,
  171. audioMasterCanDo = 37,
  172. audioMasterGetLanguage = 38,
  173. audioMasterOpenWindow = 39,
  174. audioMasterCloseWindow = 40,
  175. audioMasterGetDirectory = 41,
  176. audioMasterUpdateDisplay = 42,
  177. audioMasterBeginEdit = 43,
  178. audioMasterEndEdit = 44,
  179. audioMasterOpenFileSelector = 45,
  180. audioMasterCloseFileSelector = 46,
  181. audioMasterEditFile = 47,
  182. audioMasterGetChunkFile = 48,
  183. audioMasterGetInputSpeakerArrangement = 49,
  184. };
  185. enum VstEventTypes : int32
  186. {
  187. kVstMidiType = 1,
  188. kVstAudioType = 2,
  189. kVstVideoType = 3,
  190. kVstParameterType = 4,
  191. kVstTriggerType = 5,
  192. kVstSysExType = 6,
  193. };
  194. enum VstEventFlags : int32
  195. {
  196. kVstMidiEventIsRealtime = 1 << 0,
  197. };
  198. enum VstTimeInfoFlags : int32
  199. {
  200. kVstTransportChanged = 1,
  201. kVstTransportPlaying = 1 << 1,
  202. kVstTransportCycleActive = 1 << 2,
  203. kVstTransportRecording = 1 << 3,
  204. kVstAutomationWriting = 1 << 6,
  205. kVstAutomationReading = 1 << 7,
  206. kVstNanosValid = 1 << 8,
  207. kVstPpqPosValid = 1 << 9,
  208. kVstTempoValid = 1 << 10,
  209. kVstBarsValid = 1 << 11,
  210. kVstCyclePosValid = 1 << 12,
  211. kVstTimeSigValid = 1 << 13,
  212. kVstSmpteValid = 1 << 14,
  213. kVstClockValid = 1 << 15,
  214. };
  215. enum VstSmpteFrameRate : int32
  216. {
  217. kVstSmpte24fps = 0,
  218. kVstSmpte25fps = 1,
  219. kVstSmpte2997fps = 2,
  220. kVstSmpte30fps = 3,
  221. kVstSmpte2997dfps = 4,
  222. kVstSmpte30dfps = 5,
  223. kVstSmpteFilm16mm = 6,
  224. kVstSmpteFilm35mm = 7,
  225. kVstSmpte239fps = 10,
  226. kVstSmpte249fps = 11,
  227. kVstSmpte599fps = 12,
  228. kVstSmpte60fps = 13,
  229. };
  230. enum VstLanguage : int32
  231. {
  232. kVstLangEnglish = 1,
  233. kVstLangGerman = 2,
  234. kVstLangFrench = 3,
  235. kVstLangItalian = 4,
  236. kVstLangSpanish = 5,
  237. kVstLangJapanese = 6,
  238. };
  239. enum VstProcessPrecision : int32
  240. {
  241. kVstProcessPrecision32 = 0,
  242. kVstProcessPrecision64 = 1,
  243. };
  244. enum VstParameterFlags : int32
  245. {
  246. kVstParameterIsSwitch = 1 << 0,
  247. kVstParameterUsesIntegerMinMax = 1 << 1,
  248. kVstParameterUsesFloatStep = 1 << 2,
  249. kVstParameterUsesIntStep = 1 << 3,
  250. kVstParameterSupportsDisplayIndex = 1 << 4,
  251. kVstParameterSupportsDisplayCategory = 1 << 5,
  252. kVstParameterCanRamp = 1 << 6,
  253. };
  254. enum VstPinPropertiesFlags : int32
  255. {
  256. kVstPinIsActive = 1 << 0,
  257. kVstPinIsStereo = 1 << 1,
  258. kVstPinUseSpeaker = 1 << 2,
  259. };
  260. enum VstPlugCategory : int32
  261. {
  262. kPlugCategUnknown = 0,
  263. kPlugCategEffect = 1,
  264. kPlugCategSynth = 2,
  265. kPlugCategAnalysis = 3,
  266. kPlugCategMastering = 4,
  267. kPlugCategSpacializer = 5,
  268. kPlugCategRoomFx = 6,
  269. kPlugSurroundFx = 7,
  270. kPlugCategRestoration = 8,
  271. kPlugCategOfflineProcess = 9,
  272. kPlugCategShell = 10,
  273. kPlugCategGenerator = 11,
  274. kPlugCategMaxCount = 12,
  275. };
  276. enum VstMidiProgramNameFlags : int32
  277. {
  278. kMidiIsOmni = 1,
  279. };
  280. enum VstSpeakerType : int32
  281. {
  282. kSpeakerUndefined = 0x7FFFFFFF,
  283. kSpeakerM = 0,
  284. kSpeakerL = 1,
  285. kSpeakerR = 2,
  286. kSpeakerC = 3,
  287. kSpeakerLfe = 4,
  288. kSpeakerLs = 5,
  289. kSpeakerRs = 6,
  290. kSpeakerLc = 7,
  291. kSpeakerRc = 8,
  292. kSpeakerS = 9,
  293. kSpeakerCs = kSpeakerS,
  294. kSpeakerSl = 10,
  295. kSpeakerSr = 11,
  296. kSpeakerTm = 12,
  297. kSpeakerTfl = 13,
  298. kSpeakerTfc = 14,
  299. kSpeakerTfr = 15,
  300. kSpeakerTrl = 16,
  301. kSpeakerTrc = 17,
  302. kSpeakerTrr = 18,
  303. kSpeakerLfe2 = 19,
  304. kSpeakerU32 = -32,
  305. kSpeakerU31 = -31,
  306. kSpeakerU30 = -30,
  307. kSpeakerU29 = -29,
  308. kSpeakerU28 = -28,
  309. kSpeakerU27 = -27,
  310. kSpeakerU26 = -26,
  311. kSpeakerU25 = -25,
  312. kSpeakerU24 = -24,
  313. kSpeakerU23 = -23,
  314. kSpeakerU22 = -22,
  315. kSpeakerU21 = -21,
  316. kSpeakerU20 = -20,
  317. kSpeakerU19 = -19,
  318. kSpeakerU18 = -18,
  319. kSpeakerU17 = -17,
  320. kSpeakerU16 = -16,
  321. kSpeakerU15 = -15,
  322. kSpeakerU14 = -14,
  323. kSpeakerU13 = -13,
  324. kSpeakerU12 = -12,
  325. kSpeakerU11 = -11,
  326. kSpeakerU10 = -10,
  327. kSpeakerU9 = -9,
  328. kSpeakerU8 = -8,
  329. kSpeakerU7 = -7,
  330. kSpeakerU6 = -6,
  331. kSpeakerU5 = -5,
  332. kSpeakerU4 = -4,
  333. kSpeakerU3 = -3,
  334. kSpeakerU2 = -2,
  335. kSpeakerU1 = -1,
  336. };
  337. enum VstSpeakerArrangementType : int32
  338. {
  339. kSpeakerArrUserDefined = -2,
  340. kSpeakerArrEmpty = -1,
  341. kSpeakerArrMono = 0,
  342. kSpeakerArrStereo = 1,
  343. kSpeakerArrStereoSurround = 2,
  344. kSpeakerArrStereoCenter = 3,
  345. kSpeakerArrStereoSide = 4,
  346. kSpeakerArrStereoCLfe = 5,
  347. kSpeakerArr30Cine = 6,
  348. kSpeakerArr30Music = 7,
  349. kSpeakerArr31Cine = 8,
  350. kSpeakerArr31Music = 9,
  351. kSpeakerArr40Cine = 10,
  352. kSpeakerArr40Music = 11,
  353. kSpeakerArr41Cine = 12,
  354. kSpeakerArr41Music = 13,
  355. kSpeakerArr50 = 14,
  356. kSpeakerArr51 = 15,
  357. kSpeakerArr60Cine = 16,
  358. kSpeakerArr60Music = 17,
  359. kSpeakerArr61Cine = 18,
  360. kSpeakerArr61Music = 19,
  361. kSpeakerArr70Cine = 20,
  362. kSpeakerArr70Music = 21,
  363. kSpeakerArr71Cine = 22,
  364. kSpeakerArr71Music = 23,
  365. kSpeakerArr80Cine = 24,
  366. kSpeakerArr80Music = 25,
  367. kSpeakerArr81Cine = 26,
  368. kSpeakerArr81Music = 27,
  369. kSpeakerArr102 = 28,
  370. kNumSpeakerArr = 29,
  371. };
  372. enum VstOfflineTaskFlags : int32
  373. {
  374. kVstOfflineUnvalidParameter = 1 << 0,
  375. kVstOfflineNewFile = 1 << 1,
  376. kVstOfflinePlugError = 1 << 10,
  377. kVstOfflineInterleavedAudio = 1 << 11,
  378. kVstOfflineTempOutputFile = 1 << 12,
  379. kVstOfflineFloatOutputFile = 1 << 13,
  380. kVstOfflineRandomWrite = 1 << 14,
  381. kVstOfflineStretch = 1 << 15,
  382. kVstOfflineNoThread = 1 << 16,
  383. };
  384. enum VstOfflineOption : int32
  385. {
  386. kVstOfflineAudio = 0,
  387. kVstOfflinePeaks = 1,
  388. kVstOfflineParameter = 2,
  389. kVstOfflineMarker = 3,
  390. kVstOfflineCursor = 4,
  391. kVstOfflineSelection = 5,
  392. kVstOfflineQueryFiles = 6,
  393. };
  394. enum VstAudioFileFlags : int32
  395. {
  396. kVstOfflineReadOnly = 1 << 0,
  397. kVstOfflineNoRateConversion = 1 << 1,
  398. kVstOfflineNoChannelChange = 1 << 2,
  399. kVstOfflineCanProcessSelection = 1 << 10,
  400. kVstOfflineNoCrossfade = 1 << 11,
  401. kVstOfflineWantRead = 1 << 12,
  402. kVstOfflineWantWrite = 1 << 13,
  403. kVstOfflineWantWriteMarker = 1 << 14,
  404. kVstOfflineWantMoveCursor = 1 << 15,
  405. kVstOfflineWantSelect = 1 << 16,
  406. };
  407. enum VstVirtualKey : uint8
  408. {
  409. VKEY_BACK = 1,
  410. VKEY_TAB = 2,
  411. VKEY_CLEAR = 3,
  412. VKEY_RETURN = 4,
  413. VKEY_PAUSE = 5,
  414. VKEY_ESCAPE = 6,
  415. VKEY_SPACE = 7,
  416. VKEY_NEXT = 8,
  417. VKEY_END = 9,
  418. VKEY_HOME = 10,
  419. VKEY_LEFT = 11,
  420. VKEY_UP = 12,
  421. VKEY_RIGHT = 13,
  422. VKEY_DOWN = 14,
  423. VKEY_PAGEUP = 15,
  424. VKEY_PAGEDOWN = 16,
  425. VKEY_SELECT = 17,
  426. VKEY_PRINT = 18,
  427. VKEY_ENTER = 19,
  428. VKEY_SNAPSHOT = 20,
  429. VKEY_INSERT = 21,
  430. VKEY_DELETE = 22,
  431. VKEY_HELP = 23,
  432. VKEY_NUMPAD0 = 24,
  433. VKEY_NUMPAD1 = 25,
  434. VKEY_NUMPAD2 = 26,
  435. VKEY_NUMPAD3 = 27,
  436. VKEY_NUMPAD4 = 28,
  437. VKEY_NUMPAD5 = 29,
  438. VKEY_NUMPAD6 = 30,
  439. VKEY_NUMPAD7 = 31,
  440. VKEY_NUMPAD8 = 32,
  441. VKEY_NUMPAD9 = 33,
  442. VKEY_MULTIPLY = 34,
  443. VKEY_ADD = 35,
  444. VKEY_SEPARATOR = 36,
  445. VKEY_SUBTRACT = 37,
  446. VKEY_DECIMAL = 38,
  447. VKEY_DIVIDE = 39,
  448. VKEY_F1 = 40,
  449. VKEY_F2 = 41,
  450. VKEY_F3 = 42,
  451. VKEY_F4 = 43,
  452. VKEY_F5 = 44,
  453. VKEY_F6 = 45,
  454. VKEY_F7 = 46,
  455. VKEY_F8 = 47,
  456. VKEY_F9 = 48,
  457. VKEY_F10 = 49,
  458. VKEY_F11 = 50,
  459. VKEY_F12 = 51,
  460. VKEY_NUMLOCK = 52,
  461. VKEY_SCROLL = 53,
  462. VKEY_SHIFT = 54,
  463. VKEY_CONTROL = 55,
  464. VKEY_ALT = 56,
  465. VKEY_EQUALS = 57,
  466. };
  467. enum VstModifierKey : uint8
  468. {
  469. MODIFIER_SHIFT = 1 << 0,
  470. MODIFIER_ALTERNATE = 1 << 1,
  471. MODIFIER_COMMAND = 1 << 2,
  472. MODIFIER_CONTROL = 1 << 3,
  473. };
  474. enum VstFileSelectCommand : int32
  475. {
  476. kVstFileLoad = 0,
  477. kVstFileSave = 1,
  478. kVstMultipleFilesLoad = 2,
  479. kVstDirectorySelect = 3,
  480. };
  481. enum VstFileSelectType : int32
  482. {
  483. kVstFileType = 0,
  484. };
  485. enum VstPanLaw : int32
  486. {
  487. kLinearPanLaw = 0,
  488. kEqualPowerPanLaw = 1,
  489. };
  490. enum VstProcessLevel : int32
  491. {
  492. kVstProcessLevelUnknown = 0,
  493. kVstProcessLevelUser = 1,
  494. kVstProcessLevelRealtime = 2,
  495. kVstProcessLevelPrefetch = 3,
  496. kVstProcessLevelOffline = 4,
  497. };
  498. enum VstAutomationState : int32
  499. {
  500. kVstAutomationUnsupported = 0,
  501. kVstAutomationOff = 1,
  502. kVstAutomationRead = 2,
  503. kVstAutomationWrite = 3,
  504. kVstAutomationReadWrite = 4,
  505. };
  506. namespace HostCanDo
  507. {
  508. inline constexpr char sendVstEvents[] = "sendVstEvents";
  509. inline constexpr char sendVstMidiEvent[] = "sendVstMidiEvent";
  510. inline constexpr char sendVstTimeInfo[] = "sendVstTimeInfo";
  511. inline constexpr char receiveVstEvents[] = "receiveVstEvents";
  512. inline constexpr char receiveVstMidiEvent[] = "receiveVstMidiEvent";
  513. inline constexpr char reportConnectionChanges[] = "reportConnectionChanges";
  514. inline constexpr char acceptIOChanges[] = "acceptIOChanges";
  515. inline constexpr char sizeWindow[] = "sizeWindow";
  516. inline constexpr char asyncProcessing[] = "asyncProcessing";
  517. inline constexpr char ofline[] = "offline";
  518. inline constexpr char supplyIdle[] = "supplyIdle";
  519. inline constexpr char supportShell[] = "supportShell";
  520. inline constexpr char openFileSelector[] = "openFileSelector";
  521. inline constexpr char closeFileSelector[] = "closeFileSelector";
  522. inline constexpr char startStopProcess[] = "startStopProcess";
  523. inline constexpr char shellCategory[] = "shellCategory";
  524. inline constexpr char editFile[] = "editFile";
  525. inline constexpr char sendVstMidiEventFlagIsRealtime[] = "sendVstMidiEventFlagIsRealtime";
  526. } // namespace HostCanDo
  527. namespace PluginCanDo
  528. {
  529. inline constexpr char sendVstEvents[] = "sendVstEvents";
  530. inline constexpr char sendVstMidiEvent[] = "sendVstMidiEvent";
  531. inline constexpr char receiveVstEvents[] = "receiveVstEvents";
  532. inline constexpr char receiveVstMidiEvent[] = "receiveVstMidiEvent";
  533. inline constexpr char receiveVstTimeInfo[] = "receiveVstTimeInfo";
  534. inline constexpr char offline[] = "offline";
  535. inline constexpr char midiProgramNames[] = "midiProgramNames";
  536. inline constexpr char bypass[] = "bypass";
  537. inline constexpr char MPE[] = "MPE";
  538. } // namespace PluginCanDo
  539. struct AEffect;
  540. typedef intptr_t(VSTCALLBACK *AudioMasterCallbackFunc)(AEffect *effect, VstOpcodeToHost opcode, int32 index, intptr_t value, void *ptr, float opt);
  541. typedef intptr_t(VSTCALLBACK *DispatcherFunc)(AEffect *effect, VstOpcodeToPlugin opcode, int32 index, intptr_t value, void *ptr, float opt);
  542. typedef void(VSTCALLBACK *ProcessProc)(AEffect *effect, float **inputs, float **outputs, int32 sampleFrames);
  543. typedef void(VSTCALLBACK *ProcessDoubleProc)(AEffect *effect, double **inputs, double **outputs, int32 sampleFrames);
  544. typedef void(VSTCALLBACK *SetParameterProc)(AEffect *effect, int32 index, float parameter);
  545. typedef float(VSTCALLBACK *GetParameterFunc)(AEffect *effect, int32 index);
  546. typedef AEffect *(VSTCALLBACK *MainProc)(AudioMasterCallbackFunc audioMaster);
  547. #pragma pack(push, 8)
  548. struct AEffect
  549. {
  550. int32 magic;
  551. DispatcherFunc dispatcher;
  552. ProcessProc process;
  553. SetParameterProc setParameter;
  554. GetParameterFunc getParameter;
  555. int32 numPrograms;
  556. uint32 numParams;
  557. int32 numInputs;
  558. int32 numOutputs;
  559. VstFlags flags;
  560. void *reservedForHost1;
  561. void *reservedForHost2;
  562. int32 initialDelay;
  563. int32 realQualities;
  564. int32 offQualities;
  565. float ioRatio;
  566. void *object;
  567. void *user;
  568. int32 uniqueID;
  569. int32 version;
  570. ProcessProc processReplacing;
  571. ProcessDoubleProc processDoubleReplacing;
  572. };
  573. struct ERect
  574. {
  575. int16 top, left, bottom, right;
  576. int16 Width() const { return right - left; }
  577. int16 Height() const { return bottom - top; }
  578. };
  579. struct VstEvent
  580. {
  581. VstEventTypes type;
  582. int32 byteSize;
  583. int32 deltaFrames;
  584. VstEventFlags flags;
  585. };
  586. struct VstEvents
  587. {
  588. static constexpr size_t MAX_EVENTS = 256;
  589. int32 numEvents;
  590. intptr_t reserved;
  591. VstEvent *events[MAX_EVENTS];
  592. size_t size() { return numEvents; }
  593. auto begin() { return std::begin(events); }
  594. auto end() { return std::begin(events) + numEvents; }
  595. auto begin() const { return std::begin(events); }
  596. auto end() const { return std::begin(events) + numEvents; }
  597. auto cbegin() const { return std::cbegin(events); }
  598. auto cend() const { return std::cbegin(events) + numEvents; }
  599. };
  600. struct VstMidiEvent : public VstEvent
  601. {
  602. int32 noteLength;
  603. int32 noteOffset;
  604. uint32 midiData;
  605. int8 detune;
  606. int8 noteOffVelocity;
  607. int8 reserved1;
  608. int8 reserved2;
  609. };
  610. struct VstMidiSysexEvent : public VstEvent
  611. {
  612. int32 dumpBytes;
  613. intptr_t reserved1;
  614. const std::byte *sysexDump;
  615. intptr_t reserved2;
  616. };
  617. struct VstTimeInfo
  618. {
  619. double samplePos;
  620. double sampleRate;
  621. double nanoSeconds;
  622. double ppqPos;
  623. double tempo;
  624. double barStartPos;
  625. double cycleStartPos;
  626. double cycleEndPos;
  627. int32 timeSigNumerator;
  628. int32 timeSigDenominator;
  629. int32 smpteOffset;
  630. VstSmpteFrameRate smpteFrameRate;
  631. int32 samplesToNextClock;
  632. VstTimeInfoFlags flags;
  633. };
  634. struct VstVariableIo
  635. {
  636. float **inputs;
  637. float **outputs;
  638. int32 numSamplesInput;
  639. int32 numSamplesOutput;
  640. int32 *numSamplesInputProcessed;
  641. int32 *numSamplesOutputProcessed;
  642. };
  643. struct VstParameterProperties
  644. {
  645. float stepFloat;
  646. float smallStepFloat;
  647. float largeStepFloat;
  648. char label[kVstMaxLabelLen];
  649. VstParameterFlags flags;
  650. int32 minInteger;
  651. int32 maxInteger;
  652. int32 stepInteger;
  653. int32 largeStepInteger;
  654. char shortLabel[kVstMaxShortLabelLen];
  655. int16 displayIndex;
  656. int16 category;
  657. int16 numParametersInCategory;
  658. int16 reserved;
  659. char categoryLabel[kVstMaxCategLabelLen];
  660. int8 reserved2[16];
  661. };
  662. struct VstPinProperties
  663. {
  664. char label[kVstMaxLabelLen];
  665. VstPinPropertiesFlags flags;
  666. VstSpeakerArrangementType arragementType;
  667. char shortLabel[kVstMaxShortLabelLen];
  668. int8 reserved[48];
  669. };
  670. struct MidiProgramName
  671. {
  672. int32 thisProgramIndex;
  673. char name[kVstMaxNameLen];
  674. int8 midiProgram;
  675. int8 midiBankMSB;
  676. int8 midiBankLSB;
  677. int8 reserved;
  678. int32 parentCategoryIndex;
  679. VstMidiProgramNameFlags flags;
  680. };
  681. struct MidiProgramCategory
  682. {
  683. int32 thisCategoryIndex;
  684. char name[kVstMaxNameLen];
  685. int32 parentCategoryIndex;
  686. int32 flags;
  687. };
  688. struct MidiKeyName
  689. {
  690. int32 thisProgramIndex;
  691. int32 thisKeyNumber;
  692. char keyName[kVstMaxNameLen];
  693. int32 reserved;
  694. int32 flags;
  695. };
  696. struct VstSpeakerProperties
  697. {
  698. float azimuth;
  699. float elevation;
  700. float radius;
  701. float reserved1;
  702. char name[kVstMaxNameLen];
  703. VstSpeakerType type;
  704. int8 reserved2[28];
  705. };
  706. struct VstSpeakerArrangement
  707. {
  708. VstSpeakerArrangementType type;
  709. int32 numChannels;
  710. VstSpeakerProperties speakers[8];
  711. };
  712. struct VstOfflineTask
  713. {
  714. char processName[96];
  715. double readPosition;
  716. double writePosition;
  717. int32 readCount;
  718. int32 writeCount;
  719. int32 sizeInputBuffer;
  720. int32 sizeOutputBuffer;
  721. void *inputBuffer;
  722. void *outputBuffer;
  723. double positionToProcessFrom;
  724. double numFramesToProcess;
  725. double maxFramesToWrite;
  726. void *extraBuffer;
  727. int32 value;
  728. int32 index;
  729. double numFramesInSourceFile;
  730. double sourceSampleRate;
  731. double destinationSampleRate;
  732. int32 numSourceChannels;
  733. int32 numDestinationChannels;
  734. int32 sourceFormat;
  735. int32 destinationFormat;
  736. char outputText[512];
  737. double progress;
  738. int32 progressMode;
  739. char progressText[100];
  740. VstOfflineTaskFlags flags;
  741. int32 returnValue;
  742. void *hostOwned;
  743. void *plugOwned;
  744. int8 reserved[1024];
  745. };
  746. struct VstAudioFile
  747. {
  748. VstAudioFileFlags flags;
  749. void *hostOwned;
  750. void *plugOwned;
  751. char name[kVstMaxFileNameLen];
  752. int32 uniqueID;
  753. double sampleRate;
  754. int32 numChannels;
  755. double numFrames;
  756. int32 format;
  757. double editCursorPosition;
  758. double selectionStart;
  759. double selectionSize;
  760. int32 selectedChannelsMask;
  761. int32 numMarkers;
  762. int32 timeRulerUnit;
  763. double timeRulerOffset;
  764. double tempo;
  765. int32 timeSigNumerator;
  766. int32 timeSigDenominator;
  767. int32 ticksPerBlackNote;
  768. int32 smtpeFrameRate;
  769. int8 reserved[64];
  770. };
  771. struct VstAudioFileMarker
  772. {
  773. double position;
  774. char name[32];
  775. int32 type;
  776. int32 id;
  777. int32 reserved;
  778. };
  779. struct VstWindow
  780. {
  781. char title[128];
  782. int16 xPos;
  783. int16 yPos;
  784. int16 width;
  785. int16 height;
  786. int32 style;
  787. void *parent;
  788. void *userHandle;
  789. void *windowHandle;
  790. int8 reserved[104];
  791. };
  792. struct VstKeyCode
  793. {
  794. int32 characterCode;
  795. VstVirtualKey virtualCode;
  796. VstModifierKey modifierCode;
  797. };
  798. struct VstFileType
  799. {
  800. char name[128];
  801. char macType[8];
  802. char dosType[8];
  803. char unixType[8];
  804. char mimeType1[128];
  805. char mimeType2[128];
  806. };
  807. struct VstFileSelect
  808. {
  809. VstFileSelectCommand command;
  810. VstFileSelectType type;
  811. int32 macCreator;
  812. int32 numFileTypes;
  813. VstFileType *fileTypes;
  814. char title[1024];
  815. char *initialPath;
  816. char *returnPath;
  817. int32 sizeReturnPath;
  818. char **returnMultiplePaths;
  819. int32 numReturnPaths;
  820. intptr_t reserved;
  821. int8 reserved2[116];
  822. };
  823. struct VstPatchChunkInfo
  824. {
  825. int32 version;
  826. int32 pluginUniqueID;
  827. int32 pluginVersion;
  828. int32 numElements;
  829. int8 reserved[48];
  830. };
  831. #pragma pack(pop)
  832. int32 constexpr FourCC(const char (&cc)[5])
  833. {
  834. return static_cast<int32>(static_cast<uint32>(cc[3]) | (static_cast<uint32>(cc[2]) << 8) | (static_cast<uint32>(cc[1]) << 16) | (static_cast<uint32>(cc[0]) << 24));
  835. }
  836. inline constexpr int32 kEffectMagic = FourCC("VstP");
  837. template <typename T>
  838. constexpr T *FromIntPtr(intptr_t v)
  839. {
  840. return reinterpret_cast<T *>(v);
  841. }
  842. template <typename T>
  843. constexpr intptr_t ToIntPtr(T *v)
  844. {
  845. return reinterpret_cast<intptr_t>(v);
  846. }
  847. } // namespace Vst