Audio plugin host https://kx.studio/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.

590 lines
19KB

  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. SUBnoteParameters.cpp - Parameters for SUBnote (SUBsynth)
  4. Copyright (C) 2002-2005 Nasca Octavian Paul
  5. Author: Nasca Octavian Paul
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or (at your option) any later version.
  10. */
  11. #include "../globals.h"
  12. #include "SUBnoteParameters.h"
  13. #include "EnvelopeParams.h"
  14. #include "FilterParams.h"
  15. #include "../Misc/Util.h"
  16. #include "../Misc/Time.h"
  17. #include <cstdio>
  18. #include <cmath>
  19. #include <rtosc/ports.h>
  20. #include <rtosc/port-sugar.h>
  21. #define rObject SUBnoteParameters
  22. using namespace rtosc;
  23. #define rBegin [](const char *msg, RtData &d) { \
  24. SUBnoteParameters *obj = (SUBnoteParameters*) d.obj
  25. #define rEnd }
  26. #undef rChangeCb
  27. #define rChangeCb if (obj->time) { obj->last_update_timestamp = obj->time->time(); }
  28. static const rtosc::Ports SUBnotePorts = {
  29. rSelf(SUBnoteParameters),
  30. rPaste,
  31. rToggle(Pstereo, rShort("stereo"), "Stereo Enable"),
  32. rParamZyn(PVolume, rShort("volume"), "Volume"),
  33. rParamZyn(PPanning, rShort("panning"), "Left Right Panning"),
  34. rParamZyn(PAmpVelocityScaleFunction, rShort("sense"), "Amplitude Velocity Sensing function"),
  35. rParamI(PDetune, rShort("detune"), "Detune in detune type units"),
  36. rParamI(PCoarseDetune, rShort("cdetune"), "Coarse Detune"),
  37. //Real values needed
  38. rOption(PDetuneType, rShort("det. scl."), rOptions(100 cents, 200 cents, 500 cents), "Detune Scale"),
  39. rToggle(PFreqEnvelopeEnabled, rShort("enable"), "Enable for Frequency Envelope"),
  40. rToggle(PBandWidthEnvelopeEnabled, rShort("enable"), "Enable for Bandwidth Envelope"),
  41. rToggle(PGlobalFilterEnabled, rShort("enable"), "Enable for Global Filter"),
  42. rParamZyn(PGlobalFilterVelocityScale, rShort("scale"), "Filter Velocity Magnitude"),
  43. rParamZyn(PGlobalFilterVelocityScaleFunction, rShort("sense"), "Filter Velocity Function Shape"),
  44. //rRecur(FreqEnvelope, EnvelopeParams),
  45. //rToggle(),//continue
  46. rToggle(Pfixedfreq, rShort("fixed freq"), "Base frequency fixed frequency enable"),
  47. rParamZyn(PfixedfreqET, rShort("fixed ET"), "Equal temeperate control for fixed frequency operation"),
  48. rParamZyn(PBendAdjust, rShort("bend"), "Pitch bend adjustment"),
  49. rParamZyn(POffsetHz, rShort("+ Hz"), "Voice constant offset"),
  50. #undef rChangeCb
  51. #define rChangeCb obj->updateFrequencyMultipliers(); if (obj->time) { \
  52. obj->last_update_timestamp = obj->time->time(); }
  53. rParamI(POvertoneSpread.type, rMap(min, 0), rMap(max, 7), rShort("spread type")
  54. rOptions(Harmonic, ShiftU, ShiftL, PowerU, PowerL, Sine, Power, Shift),
  55. "Spread of harmonic frequencies"),
  56. rParamI(POvertoneSpread.par1, rMap(min, 0), rMap(max, 255), rShort("p1"),
  57. "Overtone Parameter"),
  58. rParamI(POvertoneSpread.par2, rMap(min, 0), rMap(max, 255), rShort("p2"),
  59. "Overtone Parameter"),
  60. rParamI(POvertoneSpread.par3, rMap(min, 0), rMap(max, 255), rShort("p3"),
  61. "Overtone Parameter"),
  62. #undef rChangeCb
  63. #define rChangeCb if (obj->time) { obj->last_update_timestamp = obj->time->time(); }
  64. rParamZyn(Pnumstages, rShort("stages"), rMap(min, 1), rMap(max, 5), "Number of filter stages"),
  65. rParamZyn(Pbandwidth, rShort("bandwidth"), "Bandwidth of filters"),
  66. rParamZyn(Phmagtype, rShort("mag. type"),"How the magnitudes are computed (0=linear,1=-60dB,2=-60dB)"),
  67. rArray(Phmag, MAX_SUB_HARMONICS, "Harmonic magnitudes"),
  68. rArray(Phrelbw, MAX_SUB_HARMONICS, "Relative bandwidth"),
  69. rParamZyn(Pbwscale, rShort("stretch"), "Bandwidth scaling with frequency"),
  70. rRecurp(AmpEnvelope, "Amplitude envelope"),
  71. rRecurp(FreqEnvelope, "Frequency Envelope"),
  72. rRecurp(BandWidthEnvelope, "Bandwidth Envelope"),
  73. rRecurp(GlobalFilterEnvelope, "Post Filter Envelope"),
  74. rRecurp(GlobalFilter, "Post Filter"),
  75. rOption(Pstart, rShort("initial"), rOptions(zero, random, ones), "How harmonics are initialized"),
  76. {"clear:", rDoc("Reset all harmonics to equal bandwidth/zero amplitude"), NULL,
  77. rBegin;
  78. for(int i=0; i<MAX_SUB_HARMONICS; ++i) {
  79. obj->Phmag[i] = 0;
  80. obj->Phrelbw[i] = 64;
  81. }
  82. obj->Phmag[0] = 127;
  83. rEnd},
  84. {"detunevalue:", rDoc("Get note detune value"), NULL,
  85. rBegin;
  86. d.reply(d.loc, "f", getdetune(obj->PDetuneType, 0, obj->PDetune));
  87. rEnd},
  88. //weird stuff for PCoarseDetune
  89. {"octave::c:i", rProp(parameter) rDoc("Note octave shift"), NULL,
  90. rBegin;
  91. if(!rtosc_narguments(msg)) {
  92. int k=obj->PCoarseDetune/1024;
  93. if (k>=8) k-=16;
  94. d.reply(d.loc, "i", k);
  95. } else {
  96. int k=(int) rtosc_argument(msg, 0).i;
  97. if (k<0) k+=16;
  98. obj->PCoarseDetune = k*1024 + obj->PCoarseDetune%1024;
  99. }
  100. rEnd},
  101. {"coarsedetune::c:i", rProp(parameter) rDoc("Note coarse detune"), NULL,
  102. rBegin;
  103. if(!rtosc_narguments(msg)) {
  104. int k=obj->PCoarseDetune%1024;
  105. if (k>=512) k-=1024;
  106. d.reply(d.loc, "i", k);
  107. } else {
  108. int k=(int) rtosc_argument(msg, 0).i;
  109. if (k<0) k+=1024;
  110. obj->PCoarseDetune = k + (obj->PCoarseDetune/1024)*1024;
  111. }
  112. rEnd},
  113. {"response:", rDoc("Filter response at 440Hz. with 48kHz sample rate\n\n"
  114. "Format: stages, filter*active_filters\n"
  115. " filter = [frequency, bandwidth, amplitude]"),
  116. NULL,
  117. rBegin;
  118. //Identify the active harmonics
  119. int pos[MAX_SUB_HARMONICS];
  120. int harmonics;
  121. obj->activeHarmonics(pos, harmonics);
  122. float base_freq = 440.0f;
  123. char types[3*MAX_SUB_HARMONICS+2];
  124. rtosc_arg_t args[3*MAX_SUB_HARMONICS+1];
  125. args[0].i = obj->Pnumstages;
  126. types[0] = 'i';
  127. for(int n=0; n<harmonics; ++n) {
  128. const float freq = base_freq * obj->POvertoneFreqMult[pos[n]];
  129. //the bandwidth is not absolute(Hz); it is relative to frequency
  130. const float bw = obj->convertBandwidth(obj->Pbandwidth,
  131. obj->Pnumstages, freq, obj->Pbwscale, obj->Phrelbw[pos[n]]);
  132. //try to keep same amplitude on all freqs and bw. (empirically)
  133. const float hgain = obj->convertHarmonicMag(obj->Phmag[pos[n]],
  134. obj->Phmagtype);
  135. const float gain = hgain * sqrt(1500.0f / (bw * freq));
  136. int base = 1+3*n;
  137. args[base + 0].f = freq;
  138. args[base + 1].f = bw;
  139. args[base + 2].f = gain;
  140. types[base + 0] = 'f';
  141. types[base + 1] = 'f';
  142. types[base + 2] = 'f';
  143. }
  144. types[3*harmonics+1] = 0;
  145. d.replyArray(d.loc, types, args);
  146. rEnd},
  147. };
  148. #undef rChangeCb
  149. #undef rBegin
  150. #undef rEnd
  151. const rtosc::Ports &SUBnoteParameters::ports = SUBnotePorts;
  152. SUBnoteParameters::SUBnoteParameters(const AbsTime *time_)
  153. : Presets(), time(time_), last_update_timestamp(0)
  154. {
  155. setpresettype("Psubsynth");
  156. AmpEnvelope = new EnvelopeParams(64, 1, time_);
  157. AmpEnvelope->ADSRinit_dB(0, 40, 127, 25);
  158. FreqEnvelope = new EnvelopeParams(64, 0, time_);
  159. FreqEnvelope->ASRinit(30, 50, 64, 60);
  160. BandWidthEnvelope = new EnvelopeParams(64, 0, time_);
  161. BandWidthEnvelope->ASRinit_bw(100, 70, 64, 60);
  162. GlobalFilter = new FilterParams(2, 80, 40, time_);
  163. GlobalFilterEnvelope = new EnvelopeParams(0, 1, time_);
  164. GlobalFilterEnvelope->ADSRinit_filter(64, 40, 64, 70, 60, 64);
  165. defaults();
  166. }
  167. void SUBnoteParameters::activeHarmonics(int *pos, int &harmonics) const
  168. {
  169. harmonics = 0;
  170. for(int n = 0; n < MAX_SUB_HARMONICS; ++n) {
  171. if(Phmag[n] == 0)
  172. continue;
  173. pos[harmonics++] = n;
  174. }
  175. }
  176. float SUBnoteParameters::convertBandwidth(int bw_, int stages, float freq,
  177. int scale, int relbw)
  178. {
  179. //the bandwidth is not absolute(Hz); it is relative to frequency
  180. float bw = powf(10, (bw_ - 127.0f) / 127.0f * 4) * stages;
  181. //Bandwidth Scale
  182. bw *= powf(1000 / freq, (scale - 64.0f) / 64.0f * 3.0f);
  183. //Relative BandWidth
  184. bw *= powf(100, (relbw - 64.0f) / 64.0f);
  185. if(bw > 25.0f)
  186. bw = 25.0f;
  187. return bw;
  188. }
  189. float SUBnoteParameters::convertHarmonicMag(int mag, int type)
  190. {
  191. const float hmagnew = 1.0f - mag / 127.0f;
  192. switch(type) {
  193. case 1:
  194. return expf(hmagnew * logf(0.01f));
  195. break;
  196. case 2:
  197. return expf(hmagnew * logf(0.001f));
  198. break;
  199. case 3:
  200. return expf(hmagnew * logf(0.0001f));
  201. break;
  202. case 4:
  203. return expf(hmagnew * logf(0.00001f));
  204. break;
  205. default:
  206. return 1.0f - hmagnew;
  207. }
  208. }
  209. void SUBnoteParameters::defaults()
  210. {
  211. PVolume = 96;
  212. PPanning = 64;
  213. PAmpVelocityScaleFunction = 90;
  214. Pfixedfreq = 0;
  215. PfixedfreqET = 0;
  216. PBendAdjust = 88; // 64 + 24
  217. POffsetHz = 64;
  218. Pnumstages = 2;
  219. Pbandwidth = 40;
  220. Phmagtype = 0;
  221. Pbwscale = 64;
  222. Pstereo = 1;
  223. Pstart = 1;
  224. PDetune = 8192;
  225. PCoarseDetune = 0;
  226. PDetuneType = 1;
  227. PFreqEnvelopeEnabled = 0;
  228. PBandWidthEnvelopeEnabled = 0;
  229. POvertoneSpread.type = 0;
  230. POvertoneSpread.par1 = 0;
  231. POvertoneSpread.par2 = 0;
  232. POvertoneSpread.par3 = 0;
  233. updateFrequencyMultipliers();
  234. for(int n = 0; n < MAX_SUB_HARMONICS; ++n) {
  235. Phmag[n] = 0;
  236. Phrelbw[n] = 64;
  237. }
  238. Phmag[0] = 127;
  239. PGlobalFilterEnabled = 0;
  240. PGlobalFilterVelocityScale = 64;
  241. PGlobalFilterVelocityScaleFunction = 64;
  242. AmpEnvelope->defaults();
  243. FreqEnvelope->defaults();
  244. BandWidthEnvelope->defaults();
  245. GlobalFilter->defaults();
  246. GlobalFilterEnvelope->defaults();
  247. }
  248. SUBnoteParameters::~SUBnoteParameters()
  249. {
  250. delete (AmpEnvelope);
  251. delete (FreqEnvelope);
  252. delete (BandWidthEnvelope);
  253. delete (GlobalFilter);
  254. delete (GlobalFilterEnvelope);
  255. }
  256. void SUBnoteParameters::add2XML(XMLwrapper& xml)
  257. {
  258. xml.addpar("num_stages", Pnumstages);
  259. xml.addpar("harmonic_mag_type", Phmagtype);
  260. xml.addpar("start", Pstart);
  261. xml.beginbranch("HARMONICS");
  262. for(int i = 0; i < MAX_SUB_HARMONICS; ++i) {
  263. if((Phmag[i] == 0) && (xml.minimal))
  264. continue;
  265. xml.beginbranch("HARMONIC", i);
  266. xml.addpar("mag", Phmag[i]);
  267. xml.addpar("relbw", Phrelbw[i]);
  268. xml.endbranch();
  269. }
  270. xml.endbranch();
  271. xml.beginbranch("AMPLITUDE_PARAMETERS");
  272. xml.addparbool("stereo", Pstereo);
  273. xml.addpar("volume", PVolume);
  274. xml.addpar("panning", PPanning);
  275. xml.addpar("velocity_sensing", PAmpVelocityScaleFunction);
  276. xml.beginbranch("AMPLITUDE_ENVELOPE");
  277. AmpEnvelope->add2XML(xml);
  278. xml.endbranch();
  279. xml.endbranch();
  280. xml.beginbranch("FREQUENCY_PARAMETERS");
  281. xml.addparbool("fixed_freq", Pfixedfreq);
  282. xml.addpar("fixed_freq_et", PfixedfreqET);
  283. xml.addpar("bend_adjust", PBendAdjust);
  284. xml.addpar("offset_hz", POffsetHz);
  285. xml.addpar("detune", PDetune);
  286. xml.addpar("coarse_detune", PCoarseDetune);
  287. xml.addpar("overtone_spread_type", POvertoneSpread.type);
  288. xml.addpar("overtone_spread_par1", POvertoneSpread.par1);
  289. xml.addpar("overtone_spread_par2", POvertoneSpread.par2);
  290. xml.addpar("overtone_spread_par3", POvertoneSpread.par3);
  291. xml.addpar("detune_type", PDetuneType);
  292. xml.addpar("bandwidth", Pbandwidth);
  293. xml.addpar("bandwidth_scale", Pbwscale);
  294. xml.addparbool("freq_envelope_enabled", PFreqEnvelopeEnabled);
  295. if((PFreqEnvelopeEnabled != 0) || (!xml.minimal)) {
  296. xml.beginbranch("FREQUENCY_ENVELOPE");
  297. FreqEnvelope->add2XML(xml);
  298. xml.endbranch();
  299. }
  300. xml.addparbool("band_width_envelope_enabled", PBandWidthEnvelopeEnabled);
  301. if((PBandWidthEnvelopeEnabled != 0) || (!xml.minimal)) {
  302. xml.beginbranch("BANDWIDTH_ENVELOPE");
  303. BandWidthEnvelope->add2XML(xml);
  304. xml.endbranch();
  305. }
  306. xml.endbranch();
  307. xml.beginbranch("FILTER_PARAMETERS");
  308. xml.addparbool("enabled", PGlobalFilterEnabled);
  309. if((PGlobalFilterEnabled != 0) || (!xml.minimal)) {
  310. xml.beginbranch("FILTER");
  311. GlobalFilter->add2XML(xml);
  312. xml.endbranch();
  313. xml.addpar("filter_velocity_sensing",
  314. PGlobalFilterVelocityScaleFunction);
  315. xml.addpar("filter_velocity_sensing_amplitude",
  316. PGlobalFilterVelocityScale);
  317. xml.beginbranch("FILTER_ENVELOPE");
  318. GlobalFilterEnvelope->add2XML(xml);
  319. xml.endbranch();
  320. }
  321. xml.endbranch();
  322. }
  323. void SUBnoteParameters::updateFrequencyMultipliers(void) {
  324. float par1 = POvertoneSpread.par1 / 255.0f;
  325. float par1pow = powf(10.0f,
  326. -(1.0f - POvertoneSpread.par1 / 255.0f) * 3.0f);
  327. float par2 = POvertoneSpread.par2 / 255.0f;
  328. float par3 = 1.0f - POvertoneSpread.par3 / 255.0f;
  329. float result;
  330. float tmp = 0.0f;
  331. int thresh = 0;
  332. for(int n = 0; n < MAX_SUB_HARMONICS; ++n) {
  333. float n1 = n + 1.0f;
  334. switch(POvertoneSpread.type) {
  335. case 1:
  336. thresh = (int)(100.0f * par2 * par2) + 1;
  337. if (n1 < thresh)
  338. result = n1;
  339. else
  340. result = n1 + 8.0f * (n1 - thresh) * par1pow;
  341. break;
  342. case 2:
  343. thresh = (int)(100.0f * par2 * par2) + 1;
  344. if (n1 < thresh)
  345. result = n1;
  346. else
  347. result = n1 + 0.9f * (thresh - n1) * par1pow;
  348. break;
  349. case 3:
  350. tmp = par1pow * 100.0f + 1.0f;
  351. result = powf(n / tmp, 1.0f - 0.8f * par2) * tmp + 1.0f;
  352. break;
  353. case 4:
  354. result = n * (1.0f - par1pow) +
  355. powf(0.1f * n, 3.0f * par2 + 1.0f) *
  356. 10.0f * par1pow + 1.0f;
  357. break;
  358. case 5:
  359. result = n1 + 2.0f * sinf(n * par2 * par2 * PI * 0.999f) *
  360. sqrt(par1pow);
  361. break;
  362. case 6:
  363. tmp = powf(2.0f * par2, 2.0f) + 0.1f;
  364. result = n * powf(par1 * powf(0.8f * n, tmp) + 1.0f, tmp) +
  365. 1.0f;
  366. break;
  367. case 7:
  368. result = (n1 + par1) / (par1 + 1);
  369. break;
  370. default:
  371. result = n1;
  372. }
  373. float iresult = floor(result + 0.5f);
  374. POvertoneFreqMult[n] = iresult + par3 * (result - iresult);
  375. }
  376. }
  377. #define doPaste(x) this->x = sub.x;
  378. #define doPPaste(x) this->x->paste(*sub.x);
  379. void SUBnoteParameters::paste(SUBnoteParameters &sub)
  380. {
  381. doPaste(Pstereo);
  382. doPaste(PVolume);
  383. doPaste(PPanning);
  384. doPaste(PAmpVelocityScaleFunction);
  385. doPPaste(AmpEnvelope);
  386. //Frequency Parameters
  387. doPaste(PDetune);
  388. doPaste(PCoarseDetune);
  389. doPaste(PDetuneType);
  390. doPaste(PBendAdjust);
  391. doPaste(POffsetHz);
  392. doPaste(PFreqEnvelopeEnabled);
  393. doPPaste(FreqEnvelope);
  394. doPaste(PBandWidthEnvelopeEnabled);
  395. doPPaste(BandWidthEnvelope);
  396. //Filter Parameters (Global)
  397. doPaste(PGlobalFilterEnabled);
  398. doPPaste(GlobalFilter);
  399. doPaste(PGlobalFilterVelocityScale);
  400. doPaste(PGlobalFilterVelocityScaleFunction);
  401. doPPaste(GlobalFilterEnvelope);
  402. //Other Parameters
  403. doPaste(Pfixedfreq);
  404. doPaste(PfixedfreqET);
  405. doPaste(POvertoneSpread.type);
  406. doPaste(POvertoneSpread.par1);
  407. doPaste(POvertoneSpread.par2);
  408. doPaste(POvertoneSpread.par3);
  409. for(int i=0; i<MAX_SUB_HARMONICS; ++i)
  410. doPaste(POvertoneFreqMult[i]);
  411. doPaste(Pnumstages);
  412. doPaste(Pbandwidth);
  413. doPaste(Phmagtype);
  414. for(int i=0; i<MAX_SUB_HARMONICS; ++i) {
  415. doPaste(Phmag[i]);
  416. doPaste(Phrelbw[i]);
  417. }
  418. doPaste(Pbwscale);
  419. doPaste(Pstart);
  420. if ( time ) {
  421. last_update_timestamp = time->time();
  422. }
  423. }
  424. void SUBnoteParameters::getfromXML(XMLwrapper& xml)
  425. {
  426. Pnumstages = xml.getpar127("num_stages", Pnumstages);
  427. Phmagtype = xml.getpar127("harmonic_mag_type", Phmagtype);
  428. Pstart = xml.getpar127("start", Pstart);
  429. if(xml.enterbranch("HARMONICS")) {
  430. Phmag[0] = 0;
  431. for(int i = 0; i < MAX_SUB_HARMONICS; ++i) {
  432. if(xml.enterbranch("HARMONIC", i) == 0)
  433. continue;
  434. Phmag[i] = xml.getpar127("mag", Phmag[i]);
  435. Phrelbw[i] = xml.getpar127("relbw", Phrelbw[i]);
  436. xml.exitbranch();
  437. }
  438. xml.exitbranch();
  439. }
  440. if(xml.enterbranch("AMPLITUDE_PARAMETERS")) {
  441. Pstereo = xml.getparbool("stereo", Pstereo);
  442. PVolume = xml.getpar127("volume", PVolume);
  443. PPanning = xml.getpar127("panning", PPanning);
  444. PAmpVelocityScaleFunction = xml.getpar127("velocity_sensing",
  445. PAmpVelocityScaleFunction);
  446. if(xml.enterbranch("AMPLITUDE_ENVELOPE")) {
  447. AmpEnvelope->getfromXML(xml);
  448. xml.exitbranch();
  449. }
  450. xml.exitbranch();
  451. }
  452. if(xml.enterbranch("FREQUENCY_PARAMETERS")) {
  453. Pfixedfreq = xml.getparbool("fixed_freq", Pfixedfreq);
  454. PfixedfreqET = xml.getpar127("fixed_freq_et", PfixedfreqET);
  455. PBendAdjust = xml.getpar127("bend_adjust", PBendAdjust);
  456. POffsetHz = xml.getpar127("offset_hz", POffsetHz);
  457. PDetune = xml.getpar("detune", PDetune, 0, 16383);
  458. PCoarseDetune = xml.getpar("coarse_detune", PCoarseDetune, 0, 16383);
  459. POvertoneSpread.type =
  460. xml.getpar127("overtone_spread_type", POvertoneSpread.type);
  461. POvertoneSpread.par1 =
  462. xml.getpar("overtone_spread_par1", POvertoneSpread.par1, 0, 255);
  463. POvertoneSpread.par2 =
  464. xml.getpar("overtone_spread_par2", POvertoneSpread.par2, 0, 255);
  465. POvertoneSpread.par3 =
  466. xml.getpar("overtone_spread_par3", POvertoneSpread.par3, 0, 255);
  467. updateFrequencyMultipliers();
  468. PDetuneType = xml.getpar127("detune_type", PDetuneType);
  469. Pbandwidth = xml.getpar127("bandwidth", Pbandwidth);
  470. Pbwscale = xml.getpar127("bandwidth_scale", Pbwscale);
  471. PFreqEnvelopeEnabled = xml.getparbool("freq_envelope_enabled",
  472. PFreqEnvelopeEnabled);
  473. if(xml.enterbranch("FREQUENCY_ENVELOPE")) {
  474. FreqEnvelope->getfromXML(xml);
  475. xml.exitbranch();
  476. }
  477. PBandWidthEnvelopeEnabled = xml.getparbool(
  478. "band_width_envelope_enabled",
  479. PBandWidthEnvelopeEnabled);
  480. if(xml.enterbranch("BANDWIDTH_ENVELOPE")) {
  481. BandWidthEnvelope->getfromXML(xml);
  482. xml.exitbranch();
  483. }
  484. xml.exitbranch();
  485. }
  486. if(xml.enterbranch("FILTER_PARAMETERS")) {
  487. PGlobalFilterEnabled = xml.getparbool("enabled", PGlobalFilterEnabled);
  488. if(xml.enterbranch("FILTER")) {
  489. GlobalFilter->getfromXML(xml);
  490. xml.exitbranch();
  491. }
  492. PGlobalFilterVelocityScaleFunction = xml.getpar127(
  493. "filter_velocity_sensing",
  494. PGlobalFilterVelocityScaleFunction);
  495. PGlobalFilterVelocityScale = xml.getpar127(
  496. "filter_velocity_sensing_amplitude",
  497. PGlobalFilterVelocityScale);
  498. if(xml.enterbranch("FILTER_ENVELOPE")) {
  499. GlobalFilterEnvelope->getfromXML(xml);
  500. xml.exitbranch();
  501. }
  502. xml.exitbranch();
  503. }
  504. }