DPF with Max Gen
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.

634 lines
21KB

  1. #include "gen_exported.h"
  2. namespace gen_exported {
  3. /*******************************************************************************************************************
  4. Copyright (c) 2012 Cycling '74
  5. Permission is hereby granted, free of charge, to any person obtaining a copy of this software
  6. and associated documentation files (the "Software"), to deal in the Software without restriction,
  7. including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
  9. subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in all copies
  11. or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  13. INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  14. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  15. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
  16. OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17. *******************************************************************************************************************/
  18. // global noise generator
  19. Noise noise;
  20. static const int GENLIB_LOOPCOUNT_BAIL = 100000;
  21. // The State struct contains all the state and procedures for the gendsp kernel
  22. typedef struct State {
  23. CommonState __commonstate;
  24. Delay m_delay_21;
  25. Delay m_delay_13;
  26. Delay m_delay_14;
  27. Delay m_delay_12;
  28. Delay m_delay_11;
  29. Delay m_delay_23;
  30. Delay m_delay_15;
  31. Delay m_delay_17;
  32. Delay m_delay_16;
  33. Delay m_delay_19;
  34. Delay m_delay_18;
  35. Delay m_delay_20;
  36. Delay m_delay_22;
  37. Delta m_delta_38;
  38. Delta m_delta_35;
  39. Delta m_delta_41;
  40. Delta m_delta_32;
  41. Phasor m_phasor_31;
  42. Sah m_sah_36;
  43. Sah m_sah_34;
  44. Sah m_sah_37;
  45. Sah m_sah_40;
  46. Sah m_sah_39;
  47. Sah m_sah_33;
  48. Sah m_sah_43;
  49. Sah m_sah_42;
  50. double m_history_4;
  51. double m_history_5;
  52. double m_history_6;
  53. double m_history_7;
  54. double m_history_3;
  55. double m_history_1;
  56. double m_y_2;
  57. double samplerate;
  58. double m_history_10;
  59. double m_history_8;
  60. double samples_to_seconds;
  61. double m_history_9;
  62. double m_ratio_25;
  63. double m_roomsize_24;
  64. double m_decay_27;
  65. double m_damping_26;
  66. double m_mix_29;
  67. double m_shimmer_30;
  68. double m_tone_28;
  69. int vectorsize;
  70. int __exception;
  71. // re-initialize all member variables;
  72. inline void reset(double __sr, int __vs) {
  73. __exception = 0;
  74. vectorsize = __vs;
  75. samplerate = __sr;
  76. m_history_1 = 0;
  77. m_y_2 = 0;
  78. m_history_3 = 0;
  79. m_history_4 = 0;
  80. m_history_5 = 0;
  81. m_history_6 = 0;
  82. m_history_7 = 0;
  83. m_history_8 = 0;
  84. m_history_9 = 0;
  85. m_history_10 = 0;
  86. m_delay_11.reset("m_delay_11", 7000);
  87. m_delay_12.reset("m_delay_12", 5000);
  88. m_delay_13.reset("m_delay_13", 6000);
  89. m_delay_14.reset("m_delay_14", 48000);
  90. m_delay_15.reset("m_delay_15", 16000);
  91. m_delay_16.reset("m_delay_16", 15000);
  92. m_delay_17.reset("m_delay_17", 96000);
  93. m_delay_18.reset("m_delay_18", 12000);
  94. m_delay_19.reset("m_delay_19", 10000);
  95. m_delay_20.reset("m_delay_20", 48000);
  96. m_delay_21.reset("m_delay_21", 48000);
  97. m_delay_22.reset("m_delay_22", 48000);
  98. m_delay_23.reset("m_delay_23", 48000);
  99. m_roomsize_24 = 100;
  100. m_ratio_25 = 2;
  101. m_damping_26 = 75;
  102. m_decay_27 = 50;
  103. m_tone_28 = 3000;
  104. m_mix_29 = 75;
  105. m_shimmer_30 = 50;
  106. samples_to_seconds = (1 / samplerate);
  107. m_phasor_31.reset(0);
  108. m_delta_32.reset(0);
  109. m_sah_33.reset(0);
  110. m_sah_34.reset(0);
  111. m_delta_35.reset(0);
  112. m_sah_36.reset(0);
  113. m_sah_37.reset(0);
  114. m_delta_38.reset(0);
  115. m_sah_39.reset(0);
  116. m_sah_40.reset(0);
  117. m_delta_41.reset(0);
  118. m_sah_42.reset(0);
  119. m_sah_43.reset(0);
  120. genlib_reset_complete(this);
  121. };
  122. // the signal processing routine;
  123. inline int perform(t_sample ** __ins, t_sample ** __outs, int __n) {
  124. vectorsize = __n;
  125. const t_sample * __in1 = __ins[0];
  126. t_sample * __out1 = __outs[0];
  127. t_sample * __out2 = __outs[1];
  128. if (__exception) {
  129. return __exception;
  130. } else if (( (__in1 == 0) || (__out1 == 0) || (__out2 == 0) )) {
  131. __exception = GENLIB_ERR_NULL_BUFFER;
  132. return __exception;
  133. };
  134. double mul_6640 = (m_damping_26 * 0.01);
  135. double mul_6639 = (m_mix_29 * 0.01);
  136. double mul_6641 = (m_shimmer_30 * 0.01);
  137. double expr_6646 = safediv(((m_tone_28 * 2) * 3.1415926535898), 48000);
  138. double sin_6647 = sin(expr_6646);
  139. double clamp_6648 = ((sin_6647 <= 1e-05) ? 1e-05 : ((sin_6647 >= 0.99999) ? 0.99999 : sin_6647));
  140. double expr_6857 = safediv((m_roomsize_24 * 48000), 340);
  141. double mul_6849 = (expr_6857 * 1);
  142. double mul_6846 = (expr_6857 * 0.63245);
  143. double mul_6847 = (expr_6857 * 0.7071);
  144. double mul_6848 = (expr_6857 * 0.81649);
  145. double mul_6644 = (m_decay_27 * 3.6);
  146. double expr_6850 = safepow(0.001, safediv(1, (mul_6644 * 48000)));
  147. double expr_6844 = (-safepow(expr_6850, mul_6849));
  148. double expr_6755 = (-safepow(expr_6850, mul_6846));
  149. double expr_6761 = (-safepow(expr_6850, mul_6847));
  150. double expr_6767 = (-safepow(expr_6850, mul_6848));
  151. double mul_6843 = (expr_6857 * 0.000527);
  152. int int_6842 = int(mul_6843);
  153. double mul_6820 = (int_6842 * 400.600006);
  154. double mul_6799 = (int_6842 * 419.5);
  155. double rsub_6698 = (1 - m_ratio_25);
  156. double mul_6697 = (rsub_6698 * 10);
  157. samples_to_seconds = (1 / samplerate);
  158. double add_6786 = (expr_6857 + 5);
  159. double expr_6779 = safepow(expr_6850, add_6786);
  160. double mul_6827 = (int_6842 * 568.299988);
  161. double mul_6806 = (int_6842 * 566.700012);
  162. double mul_6792 = (expr_6857 * 0.41);
  163. double add_6789 = (mul_6792 + 5);
  164. double expr_6785 = safepow(expr_6850, add_6789);
  165. double mul_6791 = (expr_6857 * 0.3);
  166. double add_6788 = (mul_6791 + 5);
  167. double expr_6783 = safepow(expr_6850, add_6788);
  168. double mul_6790 = (expr_6857 * 0.155);
  169. double add_6787 = (mul_6790 + 5);
  170. double expr_6781 = safepow(expr_6850, add_6787);
  171. double mul_6841 = (expr_6857 * 0.110732);
  172. double mul_6834 = (int_6842 * 162.100006);
  173. double mul_6813 = (int_6842 * 144.800003);
  174. double expr_6861 = safepow(1.0472, m_decay_27);
  175. double sub_6862 = (expr_6861 - 1);
  176. double mul_6643 = (sub_6862 * 0.01);
  177. double mul_6859 = (m_decay_27 * 0.75);
  178. double add_6858 = (mul_6859 + 25);
  179. double mul_6860 = (add_6858 * 0.01);
  180. // the main sample loop;
  181. while ((__n--)) {
  182. const double in1 = (*(__in1++));
  183. double noise_6650 = noise();
  184. double abs_6667 = fabs(noise_6650);
  185. double mul_6673 = (abs_6667 * 0.25);
  186. double noise_6649 = noise();
  187. double abs_6666 = fabs(noise_6649);
  188. double mul_6670 = (abs_6666 * 0.25);
  189. double noise_6651 = noise();
  190. double abs_6668 = fabs(noise_6651);
  191. double mul_6676 = (abs_6668 * 0.25);
  192. double noise_6652 = noise();
  193. double abs_6669 = fabs(noise_6652);
  194. double mul_6679 = (abs_6669 * 0.25);
  195. double tap_6854 = m_delay_23.read_linear(mul_6849);
  196. double tap_6760 = m_delay_22.read_linear(mul_6846);
  197. double tap_6766 = m_delay_21.read_linear(mul_6847);
  198. double tap_6772 = m_delay_20.read_linear(mul_6848);
  199. double mul_6845 = (tap_6854 * expr_6844);
  200. double mix_6913 = (mul_6845 + (mul_6640 * (m_history_10 - mul_6845)));
  201. double mix_6852 = mix_6913;
  202. double mul_6756 = (tap_6760 * expr_6755);
  203. double mix_6914 = (mul_6756 + (mul_6640 * (m_history_9 - mul_6756)));
  204. double mix_6758 = mix_6914;
  205. double mul_6762 = (tap_6766 * expr_6761);
  206. double mix_6915 = (mul_6762 + (mul_6640 * (m_history_8 - mul_6762)));
  207. double mix_6764 = mix_6915;
  208. double mul_6768 = (tap_6772 * expr_6767);
  209. double mix_6916 = (mul_6768 + (mul_6640 * (m_history_7 - mul_6768)));
  210. double mix_6770 = mix_6916;
  211. double tap_6819 = m_delay_19.read_linear(mul_6820);
  212. double mul_6817 = (tap_6819 * 0.625);
  213. double tap_6798 = m_delay_18.read_linear(mul_6799);
  214. double mul_6796 = (tap_6798 * 0.625);
  215. double phasor_6716 = m_phasor_31(mul_6697, samples_to_seconds);
  216. double add_6696 = ((m_history_6 + phasor_6716) + 0.5);
  217. double mod_6695 = safemod(add_6696, 1);
  218. double delta_6675 = m_delta_32(mod_6695);
  219. double sah_6655 = m_sah_33(mul_6673, delta_6675, 0);
  220. int sah_6674 = m_sah_34(4800, delta_6675, 0);
  221. double mul_6663 = (sah_6674 * mod_6695);
  222. double sub_6694 = (mod_6695 - 0.5);
  223. double mul_6693 = (sub_6694 * 3.1415926535898);
  224. double cos_6692 = cos(mul_6693);
  225. double mul_6682 = (cos_6692 * cos_6692);
  226. double add_6690 = ((m_history_5 + phasor_6716) + 0.75);
  227. double mod_6689 = safemod(add_6690, 1);
  228. double delta_6672 = m_delta_35(mod_6689);
  229. double sah_6653 = m_sah_36(mul_6670, delta_6672, 0);
  230. int sah_6671 = m_sah_37(4800, delta_6672, 0);
  231. double mul_6662 = (sah_6671 * mod_6689);
  232. double sub_6688 = (mod_6689 - 0.5);
  233. double mul_6687 = (sub_6688 * 3.1415926535898);
  234. double cos_6686 = cos(mul_6687);
  235. double mul_6681 = (cos_6686 * cos_6686);
  236. double add_6710 = ((m_history_4 + phasor_6716) + 0.25);
  237. double mod_6709 = safemod(add_6710, 1);
  238. double delta_6678 = m_delta_38(mod_6709);
  239. double sah_6657 = m_sah_39(mul_6676, delta_6678, 0);
  240. int sah_6677 = m_sah_40(4800, delta_6678, 0);
  241. double mul_6664 = (sah_6677 * mod_6709);
  242. double sub_6708 = (mod_6709 - 0.5);
  243. double mul_6707 = (sub_6708 * 3.1415926535898);
  244. double cos_6706 = cos(mul_6707);
  245. double mul_6683 = (cos_6706 * cos_6706);
  246. double add_6715 = ((m_history_3 + phasor_6716) + 0);
  247. double mod_6714 = safemod(add_6715, 1);
  248. double delta_6660 = m_delta_41(mod_6714);
  249. double sah_6659 = m_sah_42(mul_6679, delta_6660, 0);
  250. int sah_6680 = m_sah_43(4800, delta_6660, 0);
  251. double mul_6665 = (sah_6680 * mod_6714);
  252. double tap_6702 = m_delay_17.read_linear(mul_6665);
  253. double tap_6703 = m_delay_17.read_linear(mul_6664);
  254. double tap_6704 = m_delay_17.read_linear(mul_6663);
  255. double tap_6705 = m_delay_17.read_linear(mul_6662);
  256. double mul_6685 = (tap_6705 * mul_6681);
  257. double mul_6691 = (tap_6704 * mul_6682);
  258. double mul_6699 = (tap_6703 * mul_6683);
  259. double sub_6713 = (mod_6714 - 0.5);
  260. double mul_6712 = (sub_6713 * 3.1415926535898);
  261. double cos_6711 = cos(mul_6712);
  262. double mul_6684 = (cos_6711 * cos_6711);
  263. double mul_6700 = (tap_6702 * mul_6684);
  264. double add_6918 = (((mul_6700 + mul_6699) + mul_6691) + mul_6685);
  265. double mix_6917 = (m_y_2 + (clamp_6648 * (add_6918 - m_y_2)));
  266. double mix_6645 = mix_6917;
  267. double mix_6919 = (in1 + (mul_6641 * (mix_6645 - in1)));
  268. double mix_6717 = mix_6919;
  269. double mul_6720 = (mix_6717 * 0.707);
  270. double mix_6920 = (mul_6720 + (0.5 * (m_history_1 - mul_6720)));
  271. double mix_6856 = mix_6920;
  272. double add_6750 = (mix_6852 + mix_6770);
  273. double add_6748 = (mix_6764 + mix_6758);
  274. double sub_6747 = (add_6750 - add_6748);
  275. double mul_6729 = (sub_6747 * 0.5);
  276. double add_6743 = (add_6750 + add_6748);
  277. double mul_6726 = (add_6743 * 0.5);
  278. double tap_6826 = m_delay_16.read_linear(mul_6827);
  279. double tap_6805 = m_delay_15.read_linear(mul_6806);
  280. double sub_6749 = (mix_6852 - mix_6770);
  281. double sub_6746 = (mix_6764 - mix_6758);
  282. double sub_6745 = (sub_6749 - sub_6746);
  283. double mul_6728 = (sub_6745 * 0.5);
  284. double add_6744 = (sub_6749 + sub_6746);
  285. double rsub_6742 = (0 - add_6744);
  286. double mul_6727 = (rsub_6742 * 0.5);
  287. double tap_6774 = m_delay_14.read_linear(add_6789);
  288. double tap_6775 = m_delay_14.read_linear(add_6788);
  289. double tap_6776 = m_delay_14.read_linear(add_6787);
  290. double tap_6777 = m_delay_14.read_linear(add_6786);
  291. double mul_6784 = (tap_6774 * expr_6785);
  292. double add_6754 = (mul_6729 + mul_6784);
  293. double mul_6778 = (tap_6777 * expr_6779);
  294. double add_6751 = (mul_6726 + mul_6778);
  295. double mul_6782 = (tap_6775 * expr_6783);
  296. double add_6753 = (mul_6728 + mul_6782);
  297. double mul_6780 = (tap_6776 * expr_6781);
  298. double add_6752 = (mul_6727 + mul_6780);
  299. double mul_6824 = (tap_6826 * 0.625);
  300. double mul_6803 = (tap_6805 * 0.625);
  301. double tap_6840 = m_delay_13.read_linear(mul_6841);
  302. double mul_6838 = (tap_6840 * 0.75);
  303. double sub_6837 = (mix_6856 - mul_6838);
  304. double mul_6836 = (sub_6837 * 0.75);
  305. double add_6835 = (mul_6836 + tap_6840);
  306. double tap_6833 = m_delay_12.read_linear(mul_6834);
  307. double tap_6812 = m_delay_11.read_linear(mul_6813);
  308. double mul_6831 = (tap_6833 * 0.75);
  309. double mul_6810 = (tap_6812 * 0.75);
  310. double mul_6741 = (mul_6729 * mul_6643);
  311. double mul_6739 = (mul_6727 * mul_6643);
  312. double add_6725 = (mul_6741 + mul_6739);
  313. double mul_6740 = (mul_6728 * mul_6643);
  314. double mul_6738 = (mul_6726 * mul_6643);
  315. double add_6724 = (mul_6740 + mul_6738);
  316. double sub_6733 = (add_6725 - add_6724);
  317. double mul_6737 = (mul_6784 * mul_6860);
  318. double mul_6735 = (mul_6780 * mul_6860);
  319. double add_6723 = (mul_6737 + mul_6735);
  320. double mul_6736 = (mul_6782 * mul_6860);
  321. double mul_6734 = (mul_6778 * mul_6860);
  322. double add_6722 = (mul_6736 + mul_6734);
  323. double sub_6732 = (add_6723 - add_6722);
  324. double add_6719 = (sub_6733 + sub_6732);
  325. double add_6731 = (add_6719 + mix_6717);
  326. double sub_6830 = (add_6731 - mul_6831);
  327. double mul_6829 = (sub_6830 * 0.75);
  328. double add_6828 = (mul_6829 + tap_6833);
  329. double sub_6823 = (add_6828 - mul_6824);
  330. double mul_6822 = (sub_6823 * 0.625);
  331. double add_6821 = (mul_6822 + tap_6826);
  332. double sub_6816 = (add_6821 - mul_6817);
  333. double mul_6815 = (sub_6816 * 0.625);
  334. double add_6814 = (mul_6815 + tap_6819);
  335. double mul_6730 = (add_6814 * mul_6639);
  336. double out1 = (in1 + mul_6730);
  337. double add_6721 = (add_6719 + mix_6717);
  338. double sub_6809 = (add_6721 - mul_6810);
  339. double mul_6808 = (sub_6809 * 0.75);
  340. double add_6807 = (mul_6808 + tap_6812);
  341. double sub_6802 = (add_6807 - mul_6803);
  342. double mul_6801 = (sub_6802 * 0.625);
  343. double add_6800 = (mul_6801 + tap_6805);
  344. double sub_6795 = (add_6800 - mul_6796);
  345. double mul_6794 = (sub_6795 * 0.625);
  346. double add_6793 = (mul_6794 + tap_6798);
  347. double mul_6718 = (add_6793 * mul_6639);
  348. double out2 = (in1 + mul_6718);
  349. double history_6851_next_6863 = mix_6852;
  350. double history_6757_next_6864 = mix_6758;
  351. double history_6763_next_6865 = mix_6764;
  352. double history_6769_next_6866 = mix_6770;
  353. double history_6656_next_6867 = sah_6655;
  354. double history_6654_next_6868 = sah_6653;
  355. double history_6658_next_6869 = sah_6657;
  356. double history_6661_next_6870 = sah_6659;
  357. double y0_next_6871 = mix_6645;
  358. double history_6855_next_6872 = mix_6856;
  359. m_delay_23.write(add_6754);
  360. m_delay_22.write(add_6751);
  361. m_delay_21.write(add_6752);
  362. m_delay_20.write(add_6753);
  363. m_delay_19.write(sub_6816);
  364. m_delay_18.write(sub_6795);
  365. m_delay_17.write(in1);
  366. m_delay_16.write(sub_6823);
  367. m_delay_15.write(sub_6802);
  368. m_delay_14.write(add_6835);
  369. m_delay_13.write(sub_6837);
  370. m_delay_12.write(sub_6830);
  371. m_delay_11.write(sub_6809);
  372. m_history_10 = history_6851_next_6863;
  373. m_history_9 = history_6757_next_6864;
  374. m_history_8 = history_6763_next_6865;
  375. m_history_7 = history_6769_next_6866;
  376. m_history_6 = history_6656_next_6867;
  377. m_history_5 = history_6654_next_6868;
  378. m_history_4 = history_6658_next_6869;
  379. m_history_3 = history_6661_next_6870;
  380. m_y_2 = y0_next_6871;
  381. m_history_1 = history_6855_next_6872;
  382. m_delay_11.step();
  383. m_delay_12.step();
  384. m_delay_13.step();
  385. m_delay_14.step();
  386. m_delay_15.step();
  387. m_delay_16.step();
  388. m_delay_17.step();
  389. m_delay_18.step();
  390. m_delay_19.step();
  391. m_delay_20.step();
  392. m_delay_21.step();
  393. m_delay_22.step();
  394. m_delay_23.step();
  395. // assign results to output buffer;
  396. (*(__out1++)) = out1;
  397. (*(__out2++)) = out2;
  398. };
  399. return __exception;
  400. };
  401. inline void set_roomsize(double _value) {
  402. m_roomsize_24 = (_value < 0.1 ? 0.1 : (_value > 300 ? 300 : _value));
  403. };
  404. inline void set_ratio(double _value) {
  405. m_ratio_25 = (_value < 0.5 ? 0.5 : (_value > 2 ? 2 : _value));
  406. };
  407. inline void set_damping(double _value) {
  408. m_damping_26 = (_value < 0 ? 0 : (_value > 100 ? 100 : _value));
  409. };
  410. inline void set_decay(double _value) {
  411. m_decay_27 = (_value < 0.1 ? 0.1 : (_value > 100 ? 100 : _value));
  412. };
  413. inline void set_tone(double _value) {
  414. m_tone_28 = (_value < 500 ? 500 : (_value > 6000 ? 6000 : _value));
  415. };
  416. inline void set_mix(double _value) {
  417. m_mix_29 = (_value < 0 ? 0 : (_value > 100 ? 100 : _value));
  418. };
  419. inline void set_shimmer(double _value) {
  420. m_shimmer_30 = (_value < 0 ? 0 : (_value > 100 ? 100 : _value));
  421. };
  422. } State;
  423. ///
  424. /// Configuration for the genlib API
  425. ///
  426. /// Number of signal inputs and outputs
  427. int gen_kernel_numins = 1;
  428. int gen_kernel_numouts = 2;
  429. int num_inputs() { return gen_kernel_numins; }
  430. int num_outputs() { return gen_kernel_numouts; }
  431. int num_params() { return 7; }
  432. /// Assistive lables for the signal inputs and outputs
  433. const char * gen_kernel_innames[] = { "in1" };
  434. const char * gen_kernel_outnames[] = { "out1", "out2" };
  435. /// Invoke the signal process of a State object
  436. int perform(CommonState *cself, t_sample **ins, long numins, t_sample **outs, long numouts, long n) {
  437. State * self = (State *)cself;
  438. return self->perform(ins, outs, n);
  439. }
  440. /// Reset all parameters and stateful operators of a State object
  441. void reset(CommonState *cself) {
  442. State * self = (State *)cself;
  443. self->reset(cself->sr, cself->vs);
  444. }
  445. /// Set a parameter of a State object
  446. void setparameter(CommonState *cself, long index, double value, void *ref) {
  447. State * self = (State *)cself;
  448. switch (index) {
  449. case 0: self->set_roomsize(value); break;
  450. case 1: self->set_ratio(value); break;
  451. case 2: self->set_damping(value); break;
  452. case 3: self->set_decay(value); break;
  453. case 4: self->set_tone(value); break;
  454. case 5: self->set_mix(value); break;
  455. case 6: self->set_shimmer(value); break;
  456. default: break;
  457. }
  458. }
  459. /// Get the value of a parameter of a State object
  460. void getparameter(CommonState *cself, long index, double *value) {
  461. State *self = (State *)cself;
  462. switch (index) {
  463. case 0: *value = self->m_roomsize_24; break;
  464. case 1: *value = self->m_ratio_25; break;
  465. case 2: *value = self->m_damping_26; break;
  466. case 3: *value = self->m_decay_27; break;
  467. case 4: *value = self->m_tone_28; break;
  468. case 5: *value = self->m_mix_29; break;
  469. case 6: *value = self->m_shimmer_30; break;
  470. default: break;
  471. }
  472. }
  473. /// Allocate and configure a new State object and it's internal CommonState:
  474. void * create(double sr, long vs) {
  475. State *self = new State;
  476. self->reset(sr, vs);
  477. ParamInfo *pi;
  478. self->__commonstate.inputnames = gen_kernel_innames;
  479. self->__commonstate.outputnames = gen_kernel_outnames;
  480. self->__commonstate.numins = gen_kernel_numins;
  481. self->__commonstate.numouts = gen_kernel_numouts;
  482. self->__commonstate.sr = sr;
  483. self->__commonstate.vs = vs;
  484. self->__commonstate.params = (ParamInfo *)genlib_sysmem_newptr(7 * sizeof(ParamInfo));
  485. self->__commonstate.numparams = 7;
  486. // initialize parameter 0 ("m_roomsize_24")
  487. pi = self->__commonstate.params + 0;
  488. pi->name = "roomsize";
  489. pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
  490. pi->defaultvalue = self->m_roomsize_24;
  491. pi->defaultref = 0;
  492. pi->hasinputminmax = false;
  493. pi->inputmin = 0;
  494. pi->inputmax = 1;
  495. pi->hasminmax = true;
  496. pi->outputmin = 0.1;
  497. pi->outputmax = 300;
  498. pi->exp = 0;
  499. pi->units = ""; // no units defined
  500. // initialize parameter 1 ("m_ratio_25")
  501. pi = self->__commonstate.params + 1;
  502. pi->name = "ratio";
  503. pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
  504. pi->defaultvalue = self->m_ratio_25;
  505. pi->defaultref = 0;
  506. pi->hasinputminmax = false;
  507. pi->inputmin = 0;
  508. pi->inputmax = 1;
  509. pi->hasminmax = true;
  510. pi->outputmin = 0.5;
  511. pi->outputmax = 2;
  512. pi->exp = 0;
  513. pi->units = ""; // no units defined
  514. // initialize parameter 2 ("m_damping_26")
  515. pi = self->__commonstate.params + 2;
  516. pi->name = "damping";
  517. pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
  518. pi->defaultvalue = self->m_damping_26;
  519. pi->defaultref = 0;
  520. pi->hasinputminmax = false;
  521. pi->inputmin = 0;
  522. pi->inputmax = 1;
  523. pi->hasminmax = true;
  524. pi->outputmin = 0;
  525. pi->outputmax = 100;
  526. pi->exp = 0;
  527. pi->units = ""; // no units defined
  528. // initialize parameter 3 ("m_decay_27")
  529. pi = self->__commonstate.params + 3;
  530. pi->name = "decay";
  531. pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
  532. pi->defaultvalue = self->m_decay_27;
  533. pi->defaultref = 0;
  534. pi->hasinputminmax = false;
  535. pi->inputmin = 0;
  536. pi->inputmax = 1;
  537. pi->hasminmax = true;
  538. pi->outputmin = 0.1;
  539. pi->outputmax = 100;
  540. pi->exp = 0;
  541. pi->units = ""; // no units defined
  542. // initialize parameter 4 ("m_tone_28")
  543. pi = self->__commonstate.params + 4;
  544. pi->name = "tone";
  545. pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
  546. pi->defaultvalue = self->m_tone_28;
  547. pi->defaultref = 0;
  548. pi->hasinputminmax = false;
  549. pi->inputmin = 0;
  550. pi->inputmax = 1;
  551. pi->hasminmax = true;
  552. pi->outputmin = 500;
  553. pi->outputmax = 6000;
  554. pi->exp = 0;
  555. pi->units = ""; // no units defined
  556. // initialize parameter 5 ("m_mix_29")
  557. pi = self->__commonstate.params + 5;
  558. pi->name = "mix";
  559. pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
  560. pi->defaultvalue = self->m_mix_29;
  561. pi->defaultref = 0;
  562. pi->hasinputminmax = false;
  563. pi->inputmin = 0;
  564. pi->inputmax = 1;
  565. pi->hasminmax = true;
  566. pi->outputmin = 0;
  567. pi->outputmax = 100;
  568. pi->exp = 0;
  569. pi->units = ""; // no units defined
  570. // initialize parameter 6 ("m_shimmer_30")
  571. pi = self->__commonstate.params + 6;
  572. pi->name = "shimmer";
  573. pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
  574. pi->defaultvalue = self->m_shimmer_30;
  575. pi->defaultref = 0;
  576. pi->hasinputminmax = false;
  577. pi->inputmin = 0;
  578. pi->inputmax = 1;
  579. pi->hasminmax = true;
  580. pi->outputmin = 0;
  581. pi->outputmax = 100;
  582. pi->exp = 0;
  583. pi->units = ""; // no units defined
  584. return self;
  585. }
  586. /// Release all resources and memory used by a State object:
  587. void destroy(CommonState *cself) {
  588. State * self = (State *)cself;
  589. genlib_sysmem_freeptr(cself->params);
  590. delete self;
  591. }
  592. } // gen_exported::