External plugins for Carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

zynaddsubfx-src.cpp 12KB

6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. /*
  2. * Carla Native Plugins
  3. * Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  16. */
  17. #include "CarlaDefines.h"
  18. #define PLUGINVERSION
  19. #define SOURCE_DIR "/usr/share/zynaddsubfx/examples"
  20. #undef override
  21. // ignore some compiler warnings
  22. #if defined(__clang__)
  23. # pragma clang diagnostic push
  24. # pragma clang diagnostic ignored "-Winconsistent-missing-override"
  25. # pragma clang diagnostic ignored "-Wunused-private-field"
  26. #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
  27. # pragma GCC diagnostic push
  28. # pragma GCC diagnostic ignored "-Wliteral-suffix"
  29. # if __GNUC__ >= 6
  30. # pragma GCC diagnostic ignored "-Wshift-negative-value"
  31. # pragma GCC diagnostic ignored "-Wmisleading-indentation"
  32. # endif
  33. #endif
  34. // base c-style headers
  35. #include "zynaddsubfx/tlsf/tlsf.h"
  36. #include "zynaddsubfx/rtosc/rtosc.h"
  37. #ifdef SKIP_ZYN_SYNTH
  38. # define PRId64 P_INT64
  39. # define PRIi64 P_INT64
  40. # define PRIx64 P_UINT64
  41. # define PRId32 "%d"
  42. # define PRIi32 "%i"
  43. # define PRIx32 "%x"
  44. #endif
  45. // C-code includes
  46. extern "C" {
  47. #include "zynaddsubfx/tlsf/tlsf.c"
  48. #undef TLSF_64BIT
  49. #undef tlsf_decl
  50. #undef tlsf_fls_sizet
  51. #undef tlsf_cast
  52. #undef tlsf_min
  53. #undef tlsf_max
  54. #undef tlsf_assert
  55. #undef _tlsf_glue2
  56. #undef _tlsf_glue
  57. #undef tlsf_static_assert
  58. #undef tlsf_insist
  59. #include "zynaddsubfx/rtosc/dispatch.c"
  60. #include "zynaddsubfx/rtosc/rtosc.c"
  61. #ifdef CARLA_OS_WIN
  62. # include "zynaddsubfx/rtosc/pretty-format.c"
  63. #endif
  64. }
  65. // rtosc includes
  66. #include "zynaddsubfx/rtosc/cpp/automations.cpp"
  67. #include "zynaddsubfx/rtosc/cpp/midimapper.cpp"
  68. #include "zynaddsubfx/rtosc/cpp/miditable.cpp"
  69. #undef RTOSC_INVALID_MIDI
  70. #undef MAX_UNHANDLED_PATH
  71. #include "zynaddsubfx/rtosc/cpp/ports.cpp"
  72. #undef __builtin_expect
  73. #include "zynaddsubfx/rtosc/cpp/subtree-serialize.cpp"
  74. #include "zynaddsubfx/rtosc/cpp/thread-link.cpp"
  75. #undef off_t
  76. #include "zynaddsubfx/rtosc/cpp/undo-history.cpp"
  77. // zynaddsubfx includes
  78. #include "zynaddsubfx/version.cpp"
  79. #ifndef SKIP_ZYN_SYNTH
  80. #include "zynaddsubfx/Containers/MultiPseudoStack.cpp"
  81. #undef rBegin
  82. #undef rObject
  83. #undef rStdString
  84. #undef rStdStringCb
  85. #undef rChangeCb
  86. #define rChangeCb
  87. #include "zynaddsubfx/Containers/NotePool.cpp"
  88. #undef rBegin
  89. #undef rObject
  90. #undef rStdString
  91. #undef rStdStringCb
  92. #undef rChangeCb
  93. #define rChangeCb
  94. #include "zynaddsubfx/Containers/ScratchString.cpp"
  95. #undef rBegin
  96. #undef rObject
  97. #undef rStdString
  98. #undef rStdStringCb
  99. #undef rChangeCb
  100. #define rChangeCb
  101. #include "zynaddsubfx/Misc/Bank.cpp"
  102. #undef INSTRUMENT_EXTENSION
  103. #undef FORCE_BANK_DIR_FILE
  104. #undef rBegin
  105. #undef rObject
  106. #undef rStdString
  107. #undef rStdStringCb
  108. #undef rChangeCb
  109. #define rChangeCb
  110. #define INSTRUMENT_EXTENSION INSTRUMENT_EXTENSION_DB
  111. #include "zynaddsubfx/Misc/BankDb.cpp"
  112. #undef INSTRUMENT_EXTENSION
  113. #undef rBegin
  114. #undef rObject
  115. #undef rStdString
  116. #undef rStdStringCb
  117. #undef rChangeCb
  118. #define rChangeCb
  119. #include "zynaddsubfx/Misc/CallbackRepeater.cpp"
  120. #undef rBegin
  121. #undef rObject
  122. #undef rStdString
  123. #undef rStdStringCb
  124. #undef rChangeCb
  125. #define rChangeCb
  126. #include "zynaddsubfx/Misc/Config.cpp"
  127. #undef rBegin
  128. #undef rObject
  129. #undef rStdString
  130. #undef rStdStringCb
  131. #undef rChangeCb
  132. #define rChangeCb
  133. #include "zynaddsubfx/Misc/Master.cpp"
  134. #undef rObject
  135. #undef rStdString
  136. #undef rStdStringCb
  137. #undef rChangeCb
  138. #define rChangeCb
  139. #include "zynaddsubfx/Misc/Microtonal.cpp"
  140. #undef MAX_LINE_SIZE
  141. #undef rBegin
  142. #undef rObject
  143. #undef rStdString
  144. #undef rStdStringCb
  145. #undef rChangeCb
  146. #define rChangeCb
  147. #include "zynaddsubfx/Misc/MiddleWare.cpp"
  148. #undef rBegin
  149. #undef rObject
  150. #undef rStdString
  151. #undef rStdStringCb
  152. #undef rChangeCb
  153. #define rChangeCb
  154. #include "zynaddsubfx/Misc/Part.cpp"
  155. #undef CLONE
  156. #undef rBegin
  157. #undef rObject
  158. #undef rStdString
  159. #undef rStdStringCb
  160. #undef rChangeCb
  161. #define rChangeCb
  162. #include "zynaddsubfx/Misc/PresetExtractor.cpp"
  163. #undef rBegin
  164. #undef rObject
  165. #undef rStdString
  166. #undef rStdStringCb
  167. #undef rChangeCb
  168. #define rChangeCb
  169. #include "zynaddsubfx/Misc/Recorder.cpp"
  170. #undef rBegin
  171. #undef rObject
  172. #undef rStdString
  173. #undef rStdStringCb
  174. #undef rChangeCb
  175. #define rChangeCb
  176. #include "zynaddsubfx/Misc/WavFile.cpp"
  177. #undef rBegin
  178. #undef rObject
  179. #undef rStdString
  180. #undef rStdStringCb
  181. #undef rChangeCb
  182. #define rChangeCb
  183. #include "zynaddsubfx/Params/ADnoteParameters.cpp"
  184. #undef EXPAND
  185. #undef rBegin
  186. #undef rObject
  187. #undef rStdString
  188. #undef rStdStringCb
  189. #undef rChangeCb
  190. #define rChangeCb
  191. #include "zynaddsubfx/Params/Controller.cpp"
  192. #undef rBegin
  193. #undef rObject
  194. #undef rStdString
  195. #undef rStdStringCb
  196. #undef rChangeCb
  197. #define rChangeCb
  198. #include "zynaddsubfx/Params/EnvelopeParams.cpp"
  199. #undef rBegin
  200. #undef rObject
  201. #undef rStdString
  202. #undef rStdStringCb
  203. #undef rChangeCb
  204. #define rChangeCb
  205. #include "zynaddsubfx/Params/LFOParams.cpp"
  206. #undef rBegin
  207. #undef rObject
  208. #undef rStdString
  209. #undef rStdStringCb
  210. #undef rChangeCb
  211. #define rChangeCb
  212. #include "zynaddsubfx/Params/PADnoteParameters.cpp"
  213. #undef PC
  214. #undef P_C
  215. #undef rBegin
  216. #undef rObject
  217. #undef rStdString
  218. #undef rStdStringCb
  219. #undef rChangeCb
  220. #define rChangeCb
  221. #include "zynaddsubfx/Params/SUBnoteParameters.cpp"
  222. #undef doPaste
  223. #undef doPPaste
  224. #undef rBegin
  225. #undef rObject
  226. #undef rStdString
  227. #undef rStdStringCb
  228. #undef rChangeCb
  229. #define rChangeCb
  230. #include "zynaddsubfx/Synth/ADnote.cpp"
  231. #undef rBegin
  232. #undef rObject
  233. #undef rStdString
  234. #undef rStdStringCb
  235. #undef rChangeCb
  236. #define rChangeCb
  237. #include "zynaddsubfx/Synth/Envelope.cpp"
  238. #undef rBegin
  239. #undef rObject
  240. #undef rStdString
  241. #undef rStdStringCb
  242. #undef rChangeCb
  243. #define rChangeCb
  244. #include "zynaddsubfx/Synth/LFO.cpp"
  245. #undef rBegin
  246. #undef rObject
  247. #undef rStdString
  248. #undef rStdStringCb
  249. #undef rChangeCb
  250. #define rChangeCb
  251. #include "zynaddsubfx/Synth/ModFilter.cpp"
  252. #undef rBegin
  253. #undef rObject
  254. #undef rStdString
  255. #undef rStdStringCb
  256. #undef rChangeCb
  257. #define rChangeCb
  258. #include "zynaddsubfx/Synth/OscilGen.cpp"
  259. #undef PC
  260. #undef DIFF
  261. #undef PRESERVE
  262. #undef RESTORE
  263. #undef FUNC
  264. #undef FILTER
  265. #undef rBegin
  266. #undef rObject
  267. #undef rStdString
  268. #undef rStdStringCb
  269. #undef rChangeCb
  270. #define rChangeCb
  271. #include "zynaddsubfx/Synth/PADnote.cpp"
  272. #undef rBegin
  273. #undef rObject
  274. #undef rStdString
  275. #undef rStdStringCb
  276. #undef rChangeCb
  277. #define rChangeCb
  278. #include "zynaddsubfx/Synth/Resonance.cpp"
  279. #undef rBegin
  280. #undef rObject
  281. #undef rStdString
  282. #undef rStdStringCb
  283. #undef rChangeCb
  284. #define rChangeCb
  285. #include "zynaddsubfx/Synth/SUBnote.cpp"
  286. #undef rBegin
  287. #undef rObject
  288. #undef rStdString
  289. #undef rStdStringCb
  290. #undef rChangeCb
  291. #define rChangeCb
  292. #include "zynaddsubfx/Synth/SynthNote.cpp"
  293. #undef rBegin
  294. #undef rObject
  295. #undef rStdString
  296. #undef rStdStringCb
  297. #undef rChangeCb
  298. #define rChangeCb
  299. #include "zynaddsubfx/Synth/WatchPoint.cpp"
  300. #undef rBegin
  301. #undef rObject
  302. #undef rStdString
  303. #undef rStdStringCb
  304. #undef rChangeCb
  305. #define rChangeCb
  306. #include "zynaddsubfx/UI/ConnectionDummy.cpp"
  307. #undef rBegin
  308. #undef rObject
  309. #undef rStdString
  310. #undef rStdStringCb
  311. #undef rChangeCb
  312. #define rChangeCb
  313. #include "zynaddsubfx/globals.cpp"
  314. #endif // ! SKIP_ZYN_SYNTH
  315. #include "zynaddsubfx/DSP/AnalogFilter.cpp"
  316. #undef rBegin
  317. #undef rObject
  318. #undef rStdString
  319. #undef rStdStringCb
  320. #undef rChangeCb
  321. #define rChangeCb
  322. #include "zynaddsubfx/DSP/FFTwrapper.cpp"
  323. #undef rBegin
  324. #undef rObject
  325. #undef rStdString
  326. #undef rStdStringCb
  327. #undef rChangeCb
  328. #define rChangeCb
  329. #include "zynaddsubfx/DSP/Filter.cpp"
  330. #undef rBegin
  331. #undef rObject
  332. #undef rStdString
  333. #undef rStdStringCb
  334. #undef rChangeCb
  335. #define rChangeCb
  336. #include "zynaddsubfx/DSP/FormantFilter.cpp"
  337. #undef rBegin
  338. #undef rObject
  339. #undef rStdString
  340. #undef rStdStringCb
  341. #undef rChangeCb
  342. #define rChangeCb
  343. #include "zynaddsubfx/DSP/SVFilter.cpp"
  344. #undef rBegin
  345. #undef rObject
  346. #undef rStdString
  347. #undef rStdStringCb
  348. #undef rChangeCb
  349. #define rChangeCb
  350. #include "zynaddsubfx/DSP/Unison.cpp"
  351. #undef rBegin
  352. #undef rObject
  353. #undef rStdString
  354. #undef rStdStringCb
  355. #undef rChangeCb
  356. #define rChangeCb
  357. #include "zynaddsubfx/Effects/Alienwah.cpp"
  358. #undef rBegin
  359. #undef rObject
  360. #undef rStdString
  361. #undef rStdStringCb
  362. #undef rChangeCb
  363. #define rChangeCb
  364. #include "zynaddsubfx/Effects/Chorus.cpp"
  365. #undef rBegin
  366. #undef rObject
  367. #undef rStdString
  368. #undef rStdStringCb
  369. #undef rChangeCb
  370. #define rChangeCb
  371. #include "zynaddsubfx/Effects/Distorsion.cpp"
  372. #undef rBegin
  373. #undef rObject
  374. #undef rStdString
  375. #undef rStdStringCb
  376. #undef rChangeCb
  377. #define rChangeCb
  378. #include "zynaddsubfx/Effects/DynamicFilter.cpp"
  379. #undef rBegin
  380. #undef rObject
  381. #undef rStdString
  382. #undef rStdStringCb
  383. #undef rChangeCb
  384. #define rChangeCb
  385. #include "zynaddsubfx/Effects/Echo.cpp"
  386. #undef MAX_DELAY
  387. #undef rBegin
  388. #undef rObject
  389. #undef rStdString
  390. #undef rStdStringCb
  391. #undef rChangeCb
  392. #define rChangeCb
  393. #include "zynaddsubfx/Effects/Effect.cpp"
  394. #undef rBegin
  395. #undef rObject
  396. #undef rStdString
  397. #undef rStdStringCb
  398. #undef rChangeCb
  399. #define rChangeCb
  400. #include "zynaddsubfx/Effects/EffectLFO.cpp"
  401. #undef rBegin
  402. #undef rObject
  403. #undef rStdString
  404. #undef rStdStringCb
  405. #undef rChangeCb
  406. #define rChangeCb
  407. #include "zynaddsubfx/Effects/EffectMgr.cpp"
  408. #undef rBegin
  409. #undef rObject
  410. #undef rStdString
  411. #undef rStdStringCb
  412. #undef rChangeCb
  413. #define rChangeCb
  414. #include "zynaddsubfx/Effects/EQ.cpp"
  415. #undef rBegin
  416. #undef rObject
  417. #undef rStdString
  418. #undef rStdStringCb
  419. #undef rChangeCb
  420. #define rChangeCb
  421. #include "zynaddsubfx/Effects/Phaser.cpp"
  422. #undef PHASER_LFO_SHAPE
  423. #undef ONE_
  424. #undef ZERO_
  425. #undef rBegin
  426. #undef rObject
  427. #undef rStdString
  428. #undef rStdStringCb
  429. #undef rChangeCb
  430. #define rChangeCb
  431. #include "zynaddsubfx/Effects/Reverb.cpp"
  432. #undef rBegin
  433. #undef rObject
  434. #undef rStdString
  435. #undef rStdStringCb
  436. #undef rChangeCb
  437. #define rChangeCb
  438. #include "zynaddsubfx/Misc/Allocator.cpp"
  439. #undef rBegin
  440. #undef rObject
  441. #undef rStdString
  442. #undef rStdStringCb
  443. #undef rChangeCb
  444. #define rChangeCb
  445. #include "zynaddsubfx/Misc/Util.cpp"
  446. #undef rBegin
  447. #undef rObject
  448. #undef rStdString
  449. #undef rStdStringCb
  450. #undef rChangeCb
  451. #define rChangeCb
  452. #include "zynaddsubfx/Misc/WaveShapeSmps.cpp"
  453. #undef rBegin
  454. #undef rObject
  455. #undef rStdString
  456. #undef rStdStringCb
  457. #undef rChangeCb
  458. #define rChangeCb
  459. #include "zynaddsubfx/Misc/XMLwrapper.cpp"
  460. #undef rBegin
  461. #undef rObject
  462. #undef rStdString
  463. #undef rStdStringCb
  464. #undef rChangeCb
  465. #define rChangeCb
  466. #include "zynaddsubfx/Params/FilterParams.cpp"
  467. #undef rBegin
  468. #undef rObject
  469. #undef rStdString
  470. #undef rStdStringCb
  471. #undef rChangeCb
  472. #define rChangeCb
  473. #include "zynaddsubfx/Params/Presets.cpp"
  474. #undef rBegin
  475. #undef rObject
  476. #undef rStdString
  477. #undef rStdStringCb
  478. #undef rChangeCb
  479. #define rChangeCb
  480. #include "zynaddsubfx/Params/PresetsArray.cpp"
  481. #undef rBegin
  482. #undef rObject
  483. #undef rStdString
  484. #undef rStdStringCb
  485. #undef rChangeCb
  486. #define rChangeCb
  487. #include "zynaddsubfx/Params/PresetsStore.cpp"
  488. #undef rBegin
  489. #undef rObject
  490. #undef rStdString
  491. #undef rStdStringCb
  492. #undef rChangeCb
  493. #define rChangeCb
  494. #if defined(__clang__)
  495. # pragma clang diagnostic pop
  496. #elif defined(__GNUC__) && (__GNUC__ >= 6)
  497. # pragma GCC diagnostic pop
  498. #endif
  499. #ifndef SKIP_ZYN_SYNTH
  500. // Dummy variables and functions for linking purposes
  501. namespace zyncarla {
  502. class WavFile;
  503. namespace Nio {
  504. void masterSwap(Master*){}
  505. bool setSource(std::string){return true;}
  506. bool setSink(std::string){return true;}
  507. std::set<std::string> getSources(void){return std::set<std::string>();}
  508. std::set<std::string> getSinks(void){return std::set<std::string>();}
  509. std::string getSource(void){return "";}
  510. std::string getSink(void){return "";}
  511. void waveNew(WavFile*){}
  512. void waveStart(){}
  513. void waveStop(){}
  514. }
  515. }
  516. #endif // ! SKIP_ZYN_SYNTH
  517. #ifdef CARLA_OS_WIN
  518. rtosc_version rtosc_current_version()
  519. {
  520. return ((rtosc_version) { 0, 0, 0 } );
  521. }
  522. void rtosc_version_print_to_12byte_str(const rtosc_version* v,
  523. char* _12bytes)
  524. {
  525. snprintf(_12bytes, 12, "%u.%u.%u",
  526. (unsigned)v->major, (unsigned)v->minor, (unsigned)v->revision);
  527. }
  528. #endif