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.

OscilGenUI.fl 32KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048
  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0300
  3. header_name {.h}
  4. code_name {.cc}
  5. decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {private local
  6. }
  7. decl {//License: GNU GPL version 2 or later} {private local
  8. }
  9. decl {\#include "../Synth/OscilGen.h"} {public local
  10. }
  11. decl {\#include "../Misc/Util.h"} {public local
  12. }
  13. decl {\#include "ResonanceUI.h"} {public local
  14. }
  15. decl {\#include "Fl_Oscilloscope.h"} {public local
  16. }
  17. decl {\#include "Fl_OscilSpectrum.h"} {public local
  18. }
  19. decl {\#include "Fl_Osc_Interface.h"} {public local
  20. }
  21. decl {\#include <FL/Fl_Box.H>} {public local
  22. }
  23. decl {\#include <FL/Fl_Group.H>} {public local
  24. }
  25. decl {\#include <FL/Fl_Slider.H>} {public local
  26. }
  27. decl {\#include <math.h>} {private local
  28. }
  29. decl {\#include <stdio.h>} {private local
  30. }
  31. decl {\#include <stdlib.h>} {private local
  32. }
  33. decl {\#include <string.h>} {private local
  34. }
  35. decl {\#include "Fl_Osc_Pane.H"} {public local
  36. }
  37. decl {\#include "Fl_Osc_Dial.H"} {public local
  38. }
  39. decl {\#include "Fl_Osc_Choice.H"} {public local
  40. }
  41. decl {\#include "Fl_Osc_Counter.H"} {public local
  42. }
  43. decl {\#include "Fl_Osc_TSlider.H"} {public local
  44. }
  45. decl {\#include "Fl_Osc_VSlider.H"} {public local
  46. }
  47. decl {\#include "PresetsUI.h"} {public local
  48. }
  49. decl {\#include <FL/fl_draw.H>} {public local
  50. }
  51. decl {using namespace zyncarla;} {public local
  52. }
  53. class OGSlider {: {public Fl_Osc_TSlider}
  54. } {
  55. Function {OGSlider(int x,int y, int w, int h, const char *label=0)
  56. :Fl_Osc_TSlider(x,y,w,h,label)} {open
  57. } { code {phase=false; } {} }
  58. Function {OSC_value(char c)} {open return_type void
  59. } { code {value(phase ? c : 127-c);
  60. selection_color(value() == reset_value ? 0 : 222);
  61. redraw();
  62. } {} }
  63. Function {cb(void)} {open return_type void
  64. } { code {
  65. selection_color(value() == reset_value ? 0 : 222);
  66. if(cb_data.first) cb_data.first(this, cb_data.second);
  67. } {} }
  68. Function {update(void)} {open return_type void
  69. } { code {} {} }
  70. decl {bool phase;} {public local
  71. }
  72. }
  73. class OGWaveChoice {: {public Fl_Osc_Choice}
  74. } {
  75. Function {OGWaveChoice(int x,int y, int w, int h, const char *label=0)
  76. :Fl_Osc_Choice(x,y,w,h,label)} {open
  77. } { code {} {}}
  78. Function {OSC_value(int i)} {open return_type void
  79. } { code { value(i == 127 ? size()-2 : i);
  80. ogui->setbfmodstatus(i); } {} }
  81. Function {cb(void)} {open return_type void
  82. } {
  83. code {
  84. int v = Fl_Osc_Choice::value();
  85. if (value() < size()-2)
  86. oscWrite(ext, "i", v);
  87. else
  88. oscWrite(ext);
  89. if(cb_data.first)
  90. cb_data.first(this, cb_data.second);
  91. } {}}
  92. decl { class OscilEditor *ogui;} { public }
  93. }
  94. class Oscilharmonic {: {public Fl_Group}
  95. } {
  96. Function {make_window()} {open private
  97. } {
  98. Fl_Window harmonic {open
  99. private xywh {467 756 100 225} type Double box NO_BOX
  100. class Fl_Osc_Group visible
  101. } {
  102. Fl_Slider mag {
  103. callback {int x=127-(int)o->value();
  104. //if (x==64) o->selection_color(0);
  105. // else o->selection_color(222);
  106. o->osc->writeValue(o->loc+"magnitude"+to_s(n), (char)x);
  107. if (x==64) {
  108. o->osc->writeValue(o->loc+"phase"+to_s(n), (char)64);
  109. phase->value(64);
  110. phase->selection_color(0);
  111. }
  112. o->osc->requestValue(o->loc+"prepare");
  113. o->osc->requestValue(o->loc+"spectrum");
  114. o->osc->requestValue(o->loc+"waveform");
  115. display->redraw();}
  116. xywh {0 15 15 115} type {Vert Knob} box NO_BOX selection_color 222 maximum 127 step 1 value 64
  117. code0 {o->phase=false;o->ext = "magnitude"+to_s(n);//o->value(127-oscil->Phmag[n]);}
  118. code1 {//if (oscil->Phmag[n]==64) o->selection_color(0);}
  119. class OGSlider
  120. }
  121. Fl_Slider phase {
  122. callback {
  123. o->osc->writeValue(o->loc+"phase"+to_s(n), (char) o->value());
  124. o->osc->requestValue(o->loc+"prepare");
  125. o->osc->requestValue(o->loc+"spectrum");
  126. o->osc->requestValue(o->loc+"waveform");
  127. display->redraw();}
  128. xywh {0 135 15 75} type {Vert Knob} box NO_BOX selection_color 222 maximum 127 step 1 value 64
  129. code0 {o->phase=true;o->ext = "phase"+to_s(n);//o->value(oscil->Phphase[n]);}
  130. class OGSlider
  131. }
  132. Fl_Box {} {
  133. xywh {15 70 5 5} box FLAT_BOX color 45
  134. }
  135. Fl_Box {} {
  136. xywh {15 170 5 5} box FLAT_BOX color 45
  137. }
  138. Fl_Box {} {
  139. label 01
  140. xywh {0 210 20 15} labelfont 1 labelsize 9 align 20
  141. code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));}
  142. }
  143. Fl_Box {} {
  144. label 01
  145. xywh {0 0 20 15} labelfont 1 labelsize 9 align 20
  146. code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));}
  147. }
  148. }
  149. }
  150. Function {Oscilharmonic(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
  151. code {n=0;
  152. display=NULL;} {}
  153. }
  154. Function {init(int n_,Fl_Group *display_, std::string loc_, Fl_Osc_Interface *osc_)} {open
  155. } {
  156. code {assert(osc_);
  157. assert(!loc_.empty());
  158. n=n_;
  159. display=display_;
  160. osc = osc_;
  161. loc = loc_;
  162. make_window();
  163. mag->osc = osc;
  164. mag->loc = loc;
  165. mag->reset_value = 63;
  166. mag->set_transform([](float x){return 63.0f - x;});
  167. phase->osc = osc;
  168. phase->loc = loc;
  169. phase->reset_value = 64;
  170. phase->set_rounding(1);
  171. phase->set_transform([](float x){return 180*(1 - x/64.0f);});
  172. osc->createLink(loc+"magnitude"+to_s(n), mag);
  173. osc->createLink(loc+"phase"+to_s(n), phase);
  174. osc->requestValue(loc+"magnitude"+to_s(n));
  175. osc->requestValue(loc+"phase"+to_s(n));
  176. end();
  177. harmonic->show();} {}
  178. }
  179. Function {refresh()} {open
  180. } {
  181. code {osc->requestValue(loc+"magnitude"+to_s(n));//mag->value(127-oscil->Phmag[n]);
  182. osc->requestValue(loc+"phase"+to_s(n));//phase->value(oscil->Phphase[n]);
  183. } {}
  184. }
  185. Function {~Oscilharmonic()} {open
  186. } {
  187. code {osc->removeLink(loc+"magnitude"+to_s(n), mag);
  188. osc->removeLink(loc+"phase"+to_s(n), phase);
  189. harmonic->hide();
  190. delete harmonic;} {}
  191. }
  192. decl {Fl_Group *display;} {private local
  193. }
  194. decl {int n;} {private local
  195. }
  196. decl {Fl_Osc_Interface *osc;} {private local
  197. }
  198. decl {std::string loc;} {private local
  199. }
  200. }
  201. class OscilEditor {open : {public PresetsUI_}
  202. } {
  203. Function {make_window()} {open
  204. } {
  205. Fl_Window osceditUI {
  206. label {ADsynth Oscillator Editor} open
  207. xywh {52 100 735 595} type Double
  208. code0 {(void)o;//if (oscil->ADvsPAD) o->label("PADsynth Harmonic Content Editor");} visible
  209. } {
  210. Fl_Group dummy {open
  211. xywh {0 0 735 595} box FLAT_BOX
  212. class Fl_Osc_Group
  213. } {
  214. Fl_Button applybutton {
  215. label Apply
  216. callback {
  217. dummy->osc->requestValue(loc+"../prepare");}
  218. xywh {305 285 60 20} box THIN_UP_BOX labelfont 1
  219. code0 {if(adnotep) o->hide();}
  220. code1 {dummy->base = loc;}
  221. code2 {dummy->osc = osc;}
  222. }
  223. Fl_Group oscildisplaygroup {open
  224. xywh {10 10 360 300} box UP_FRAME
  225. } {
  226. Fl_Group {} {open
  227. xywh {15 90 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179
  228. code0 {oscilo=new Fl_Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
  229. code1 {oscilo->parent(o);oscilo->init(false);}
  230. } {}
  231. Fl_Box {} {
  232. label Oscillator
  233. xywh {125 15 110 20} labelfont 1
  234. }
  235. Fl_Value_Slider rndslider {
  236. label rnd
  237. callback {}
  238. tooltip {Oscilator Phase Randomness: smaller than 0 is "group", larger than 0 is for each harmonic} xywh {145 290 100 10} type {Horz Knob} box NO_BOX labelsize 10 align 5 minimum -64 maximum 63 step 1
  239. code0 {(void)o->init("Prand"); if (!adnotep) o->hide();}
  240. class Fl_Osc_VSlider
  241. }
  242. Fl_Group {} {open
  243. xywh {15 35 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63
  244. code0 {oscils=new Fl_OscilSpectrum(o->x(),o->y(),o->w(),o->h(),"");}
  245. code1 {oscils->parent(o);oscils->init(false);}
  246. } {}
  247. Fl_Group {} {open
  248. xywh {251 282 115 25} box UP_FRAME
  249. code0 {if (!adnotep) o->hide();}
  250. } {
  251. Fl_Choice hrndtype {
  252. label {H.rnd}
  253. tooltip {Harmonic Amplitude Randomness} xywh {286 287 50 15} down_box BORDER_BOX labelsize 10 textsize 10
  254. code0 {o->init("Pamprandtype");}
  255. class Fl_Osc_Choice
  256. } {
  257. MenuItem {} {
  258. label None
  259. xywh {65 65 100 20} labelfont 1 labelsize 10
  260. }
  261. MenuItem {} {
  262. label Pow
  263. xywh {75 75 100 20} labelfont 1 labelsize 10
  264. }
  265. MenuItem {} {
  266. label Sin
  267. xywh {85 85 100 20} labelfont 1 labelsize 10
  268. }
  269. }
  270. Fl_Dial hrnddial {
  271. tooltip {Oscillator's spectrum adjust parameter} xywh {345 285 18 18} maximum 127 step 1
  272. code0 {o->init("Pamprandpower");o->reset_value=64;}
  273. class Fl_Osc_Dial
  274. }
  275. }
  276. Fl_Choice magtype {
  277. label {Mag.Type}
  278. callback {redrawoscil();}
  279. xywh {75 285 65 20} down_box BORDER_BOX labelsize 11 when 1 textsize 11
  280. code0 {o->init("Phmagtype");}
  281. class Fl_Osc_Choice
  282. } {
  283. MenuItem {} {
  284. label Linear
  285. xywh {10 10 100 20} labelfont 1 labelsize 11
  286. }
  287. MenuItem {} {
  288. label {-40dB}
  289. xywh {20 20 100 20} labelfont 1 labelsize 11
  290. }
  291. MenuItem {} {
  292. label {-60dB}
  293. xywh {30 30 100 20} labelfont 1 labelsize 11
  294. }
  295. MenuItem {} {
  296. label {-80dB}
  297. xywh {40 40 100 20} labelfont 1 labelsize 11
  298. }
  299. MenuItem {} {
  300. label {-100dB}
  301. xywh {50 50 100 20} labelfont 1 labelsize 11
  302. }
  303. }
  304. }
  305. Fl_Group basefuncdisplaygroup {open
  306. xywh {370 10 360 300} box UP_FRAME
  307. code0 {o->base = loc;}
  308. code1 {o->osc = osc; bftype->ogui = this;}
  309. code2 {assert(osc);}
  310. class Fl_Osc_Group
  311. } {
  312. Fl_Group {} {
  313. xywh {375 90 350 190} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179
  314. code0 {oscilo_base=new Fl_Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
  315. code1 {oscilo_base->parent(o);oscilo_base->init(true);}
  316. } {}
  317. Fl_Dial bfpar {
  318. callback {redrawoscil(); if(bfparval){bfparval->value(o->value());}}
  319. tooltip {Base Function Parameter} xywh {525 285 20 20} minimum -64 maximum 63 step 1
  320. code0 {o->init("Pbasefuncpar");}
  321. class Fl_Osc_Dial
  322. }
  323. Fl_Choice bftype {
  324. label {Base.F..}
  325. callback {basefuncdisplaygroup->redraw();
  326. redrawoscil();
  327. if(!basefuncmodulation) return;
  328. setbfmodstatus(o->value());
  329. }
  330. xywh {375 290 90 15} down_box BORDER_BOX labelsize 10 align 5 when 1 textsize 11
  331. class OGWaveChoice
  332. } {
  333. MenuItem {} {
  334. label Sine
  335. xywh {15 15 100 20} labelfont 1 labelsize 11
  336. }
  337. MenuItem {} {
  338. label Triangle
  339. xywh {25 25 100 20} labelfont 1 labelsize 11
  340. }
  341. MenuItem {} {
  342. label Pulse
  343. xywh {35 35 100 20} labelfont 1 labelsize 11
  344. }
  345. MenuItem {} {
  346. label Saw
  347. xywh {45 45 100 20} labelfont 1 labelsize 11
  348. }
  349. MenuItem {} {
  350. label Power
  351. xywh {55 55 100 20} labelfont 1 labelsize 11
  352. }
  353. MenuItem {} {
  354. label Gauss
  355. xywh {55 55 100 20} labelfont 1 labelsize 11
  356. }
  357. MenuItem {} {
  358. label Diode
  359. xywh {65 65 100 20} labelfont 1 labelsize 11
  360. }
  361. MenuItem {} {
  362. label AbsSine
  363. xywh {75 75 100 20} labelfont 1 labelsize 11
  364. }
  365. MenuItem {} {
  366. label PulseSine
  367. xywh {85 85 100 20} labelfont 1 labelsize 11
  368. }
  369. MenuItem {} {
  370. label StrchSine
  371. xywh {95 95 100 20} labelfont 1 labelsize 11
  372. }
  373. MenuItem {} {
  374. label Chirp
  375. xywh {105 105 100 20} labelfont 1 labelsize 11
  376. }
  377. MenuItem {} {
  378. label AbsStrSine
  379. xywh {107 107 100 20} labelfont 1 labelsize 11
  380. }
  381. MenuItem {} {
  382. label Chebyshev
  383. xywh {117 117 100 20} labelfont 1 labelsize 11
  384. }
  385. MenuItem {} {
  386. label Sqr
  387. xywh {127 127 100 20} labelfont 1 labelsize 11
  388. }
  389. MenuItem {} {
  390. label Spike
  391. xywh {127 127 100 20} labelfont 1 labelsize 11
  392. }
  393. MenuItem {} {
  394. label Circle
  395. xywh {127 127 100 20} labelfont 1 labelsize 11
  396. }
  397. MenuItem {} {
  398. label User
  399. xywh {127 127 100 20} labelfont 1 labelsize 11 hide
  400. }
  401. }
  402. Fl_Box {} {
  403. label {Base Func.}
  404. xywh {485 15 110 20} labelfont 1
  405. }
  406. Fl_Group {} {open
  407. xywh {375 35 350 50} box THIN_DOWN_BOX color 32 selection_color 218 labelcolor 63
  408. code0 {oscils_base=new Fl_OscilSpectrum (o->x(),o->y(),o->w(),o->h(),"");}
  409. code1 {oscils_base->parent(o);oscils_base->init(true);}
  410. } {}
  411. Fl_Value_Output bfparval {
  412. label {Par.}
  413. xywh {495 290 25 15} labelsize 12 minimum -63 maximum 63 step 1
  414. code0 {o->value(bfpar->value());}
  415. }
  416. Fl_Group basefuncmodulation {open
  417. xywh {555 281 169 25} box UP_FRAME
  418. code0 {}
  419. } {
  420. Fl_Choice bfmodtype {
  421. label {B.F.Mod.}
  422. callback {basefuncdisplaygroup->redraw();
  423. redrawoscil();}
  424. tooltip {Base function modulation} xywh {604 286 50 15} down_box BORDER_BOX labelsize 10 when 1 textsize 10
  425. code0 {o->init("Pbasefuncmodulation");}
  426. class Fl_Osc_Choice
  427. } {
  428. MenuItem {} {
  429. label None
  430. xywh {55 55 100 20} labelfont 1 labelsize 10
  431. }
  432. MenuItem {} {
  433. label Rev
  434. xywh {65 65 100 20} labelfont 1 labelsize 10
  435. }
  436. MenuItem {} {
  437. label Sine
  438. xywh {75 75 100 20} labelfont 1 labelsize 10
  439. }
  440. MenuItem {} {
  441. label Pow
  442. xywh {85 85 100 20} labelfont 1 labelsize 10
  443. }
  444. MenuItem {} {
  445. label Chop
  446. xywh {95 95 100 20} labelfont 1 labelsize 10
  447. }
  448. }
  449. Fl_Dial bfmodpar1 {
  450. callback {redrawoscil();}
  451. tooltip {Oscillator's modulation parameter 1} xywh {664 286 15 15} maximum 127 step 1
  452. code0 {o->init("Pbasefuncmodulationpar1");o->reset_value=64;}
  453. class Fl_Osc_Dial
  454. }
  455. Fl_Dial bfmodpar2 {
  456. callback {redrawoscil();}
  457. tooltip {Oscillator's modulation parameter 2} xywh {684 286 15 15} maximum 127 step 1
  458. code0 {o->init("Pbasefuncmodulationpar2");o->reset_value=64;}
  459. class Fl_Osc_Dial
  460. }
  461. Fl_Dial bfmodpar3 {
  462. callback {redrawoscil();} selected
  463. tooltip {Oscillator's modulation parameter 3} xywh {704 286 15 15} maximum 127 step 1
  464. code0 {o->init("Pbasefuncmodulationpar3");o->reset_value=32;}
  465. class Fl_Osc_Dial
  466. }
  467. }
  468. }
  469. Fl_Button {} {
  470. label {Use as base}
  471. callback {osc->requestValue(loc+"use-as-base");
  472. if (autoclearbutton->value()){
  473. for (int i=1;i<(MAX_AD_HARMONICS - 1);i++){
  474. h[i]->mag->value(63);
  475. h[i]->mag->do_callback();
  476. h[i]->phase->value(64);
  477. h[i]->phase->do_callback();
  478. };
  479. harmonicshiftcounter->value(0);
  480. h[0]->mag->value(0);
  481. h[0]->mag->do_callback();
  482. h[0]->phase->value(64);
  483. h[0]->phase->do_callback();
  484. wshbutton->value(0);
  485. wshbutton->do_callback();
  486. fltbutton->value(0);
  487. fltbutton->do_callback();
  488. sabutton->value(0);
  489. sabutton->do_callback();
  490. bfmodtype->value(0);
  491. bfmodtype->do_callback();
  492. };
  493. osc->requestValue(loc+"prepare");
  494. bftype->update();
  495. basefuncdisplaygroup->redraw();
  496. redrawoscil();}
  497. tooltip {Use this Oscillator as base function} xywh {10 318 85 20} box THIN_UP_BOX labelfont 1 labelsize 11
  498. }
  499. Fl_Button {} {
  500. label Close
  501. callback {osceditUI->hide();}
  502. xywh {673 570 62 25} box THIN_UP_BOX
  503. }
  504. Fl_Button {} {
  505. label Clear
  506. callback {if (!fl_choice("Clear the harmonics settings?","No","Yes",NULL)) return;
  507. for (int i=1;i<(MAX_AD_HARMONICS - 1);i++){
  508. h[i]->mag->value(63);
  509. h[i]->mag->do_callback();
  510. h[i]->phase->value(64);
  511. h[i]->phase->do_callback();
  512. };
  513. h[0]->mag->value(0);
  514. h[0]->mag->do_callback();
  515. h[0]->phase->value(64);
  516. h[0]->phase->do_callback();
  517. //harmonics->redraw();
  518. osc->requestValue(loc+"prepare");
  519. redrawoscil();}
  520. xywh {675 510 55 15} box THIN_UP_BOX labelfont 1 labelsize 11
  521. }
  522. Fl_Group {} {
  523. xywh {140 313 150 30} box UP_FRAME
  524. } {
  525. Fl_Choice wshbutton {
  526. label {Wsh.}
  527. callback {basefuncdisplaygroup->redraw();
  528. redrawoscil();}
  529. tooltip {Waveshaping function} xywh {170 320 55 20} down_box BORDER_BOX labelsize 10 when 1 textsize 10
  530. code0 {o->init("Pwaveshapingfunction");}
  531. class Fl_Osc_Choice
  532. } {
  533. MenuItem {} {
  534. label None
  535. xywh {30 30 100 20} labelfont 1 labelsize 10
  536. }
  537. MenuItem {} {
  538. label Atan
  539. xywh {40 40 100 20} labelfont 1 labelsize 10
  540. }
  541. MenuItem {} {
  542. label Asym1
  543. xywh {50 50 100 20} labelfont 1 labelsize 10
  544. }
  545. MenuItem {} {
  546. label Pow
  547. xywh {60 60 100 20} labelfont 1 labelsize 10
  548. }
  549. MenuItem {} {
  550. label Sine
  551. xywh {70 70 100 20} labelfont 1 labelsize 10
  552. }
  553. MenuItem {} {
  554. label Qnts
  555. xywh {80 80 100 20} labelfont 1 labelsize 10
  556. }
  557. MenuItem {} {
  558. label Zigzg
  559. xywh {90 90 100 20} labelfont 1 labelsize 10
  560. }
  561. MenuItem {} {
  562. label Lmt
  563. xywh {100 100 100 20} labelfont 1 labelsize 10
  564. }
  565. MenuItem {} {
  566. label LmtU
  567. xywh {110 110 100 20} labelfont 1 labelsize 10
  568. }
  569. MenuItem {} {
  570. label LmtL
  571. xywh {120 120 100 20} labelfont 1 labelsize 10
  572. }
  573. MenuItem {} {
  574. label ILmt
  575. xywh {132 132 100 20} labelfont 1 labelsize 10
  576. }
  577. MenuItem {} {
  578. label Clip
  579. xywh {142 142 100 20} labelfont 1 labelsize 10
  580. }
  581. MenuItem {} {
  582. label Asym2
  583. xywh {90 90 100 20} labelfont 1 labelsize 10
  584. }
  585. MenuItem {} {
  586. label Pow2
  587. xywh {100 100 100 20} labelfont 1 labelsize 10
  588. }
  589. MenuItem {} {
  590. label Sgm
  591. xywh {95 95 100 20} labelfont 1 labelsize 10
  592. }
  593. }
  594. Fl_Dial wshpar {
  595. callback {redrawoscil();if(wsparval){wsparval->value(o->value());}}
  596. tooltip {Waveshaping Parameter} xywh {265 318 20 20} minimum -64 maximum 63 step 1
  597. code0 {o->init("Pwaveshaping");}
  598. class Fl_Osc_Dial
  599. }
  600. Fl_Value_Output wsparval {
  601. xywh {233 321 25 15} labelsize 12 minimum -63 maximum 63 step 1
  602. code0 {o->value(wshpar->value());}
  603. }
  604. }
  605. Fl_Check_Button autoclearbutton {
  606. label {Clr.}
  607. tooltip {Auto clear when using the oscillator as base function} xywh {98 318 40 20} box THIN_UP_BOX value 1 labelfont 1 labelsize 10
  608. }
  609. Fl_Group {} {
  610. xywh {290 313 155 30} box UP_FRAME
  611. } {
  612. Fl_Choice fltbutton {
  613. label Filter
  614. callback {redrawoscil();}
  615. tooltip {Oscillator's filter type} xywh {320 318 50 20} down_box BORDER_BOX labelsize 10 when 1 textsize 10
  616. code0 {o->init("Pfiltertype");}
  617. class Fl_Osc_Choice
  618. } {
  619. MenuItem {} {
  620. label None
  621. xywh {40 40 100 20} labelfont 1 labelsize 10
  622. }
  623. MenuItem {} {
  624. label LP1
  625. xywh {50 50 100 20} labelfont 1 labelsize 10
  626. }
  627. MenuItem {} {
  628. label HP1a
  629. xywh {60 60 100 20} labelfont 1 labelsize 10
  630. }
  631. MenuItem {} {
  632. label HP1b
  633. xywh {70 70 100 20} labelfont 1 labelsize 10
  634. }
  635. MenuItem {} {
  636. label BP1
  637. xywh {80 80 100 20} labelfont 1 labelsize 10
  638. }
  639. MenuItem {} {
  640. label BS1
  641. xywh {90 90 100 20} labelfont 1 labelsize 10
  642. }
  643. MenuItem {} {
  644. label LP2
  645. xywh {60 60 100 20} labelfont 1 labelsize 10
  646. }
  647. MenuItem {} {
  648. label HP2
  649. xywh {70 70 100 20} labelfont 1 labelsize 10
  650. }
  651. MenuItem {} {
  652. label BP2
  653. xywh {70 70 100 20} labelfont 1 labelsize 10
  654. }
  655. MenuItem {} {
  656. label BS2
  657. xywh {80 80 100 20} labelfont 1 labelsize 10
  658. }
  659. MenuItem {} {
  660. label Cos
  661. xywh {80 80 100 20} labelfont 1 labelsize 10
  662. }
  663. MenuItem {} {
  664. label Sin
  665. xywh {90 90 100 20} labelfont 1 labelsize 10
  666. }
  667. MenuItem {} {
  668. label LSh
  669. xywh {100 100 100 20} labelfont 1 labelsize 10
  670. }
  671. MenuItem {} {
  672. label S
  673. xywh {110 110 100 20} labelfont 1 labelsize 10
  674. }
  675. }
  676. Fl_Dial filtervalue1 {
  677. callback {redrawoscil();}
  678. tooltip {Oscillator's filter parameter1} xywh {372 318 20 20} maximum 127 step 1
  679. code0 {o->init("Pfilterpar1");o->reset_value=64;}
  680. class Fl_Osc_Dial
  681. }
  682. Fl_Check_Button filterpref {
  683. label p
  684. callback {redrawoscil();}
  685. tooltip {Apply the filter before the waveshaping} xywh {420 318 20 20} down_box DOWN_BOX labelsize 10 align 24
  686. }
  687. Fl_Dial filtervalue2 {
  688. callback {redrawoscil();}
  689. tooltip {Oscillator's filter parameter2} xywh {395 318 20 20} maximum 127 step 1
  690. code0 {o->init("Pfilterpar2");o->reset_value=64;}
  691. class Fl_Osc_Dial
  692. }
  693. }
  694. Fl_Group {} {
  695. xywh {595 313 135 30} box UP_FRAME
  696. } {
  697. Fl_Choice sabutton {
  698. label {Sp.adj.}
  699. callback {redrawoscil();}
  700. tooltip {Oscillator's spectrum adjust} xywh {635 318 60 20} down_box BORDER_BOX labelsize 10 when 1 textsize 10
  701. code0 {o->init("Psatype");}
  702. class Fl_Osc_Choice
  703. } {
  704. MenuItem {} {
  705. label None
  706. xywh {60 60 100 20} labelfont 1 labelsize 10
  707. }
  708. MenuItem {} {
  709. label Pow
  710. xywh {70 70 100 20} labelfont 1 labelsize 10
  711. }
  712. MenuItem {} {
  713. label ThrsD
  714. xywh {80 80 100 20} labelfont 1 labelsize 10
  715. }
  716. MenuItem {} {
  717. label ThrsU
  718. xywh {90 90 100 20} labelfont 1 labelsize 10
  719. }
  720. }
  721. Fl_Dial sadjpar {
  722. callback {redrawoscil();}
  723. tooltip {Oscillator's spectrum adjust parameter} xywh {700 318 20 20} maximum 127 step 1
  724. code0 {o->init("Psapar");o->reset_value=64;}
  725. class Fl_Osc_Dial
  726. }
  727. }
  728. Fl_Group {} {
  729. xywh {670 345 65 65} box UP_FRAME
  730. } {
  731. Fl_Counter harmonicshiftcounter {
  732. label {Harmonic Shift}
  733. callback {redrawoscil();}
  734. code0 {o->init("Pharmonicshift");}
  735. xywh {675 370 55 15} type Simple labelsize 10 align 129 minimum -64 maximum 64 step 1 textfont 1 textsize 10
  736. class Fl_Osc_Counter
  737. }
  738. Fl_Check_Button harmonicshiftpre {
  739. label preH
  740. callback {redrawoscil();}
  741. code0 {o->init("Pharmonicshiftfirst");}
  742. tooltip {Apply the harmonic shift before the waveshaping and filtering} xywh {695 390 34 15} down_box DOWN_BOX labelsize 10 align 24
  743. class Fl_Osc_Check
  744. }
  745. Fl_Button {} {
  746. label R
  747. callback {//oscil->Pharmonicshift=0;
  748. harmonicshiftcounter->value(0);
  749. redrawoscil();}
  750. xywh {675 390 20 15} box THIN_UP_BOX labelfont 1 labelsize 10
  751. }
  752. }
  753. Fl_Group {} {
  754. xywh {670 415 65 90} box UP_FRAME
  755. } {
  756. Fl_Choice adhrtype {
  757. label {Adpt.Harm.}
  758. callback {redrawoscil();}
  759. tooltip {The type of the addaptive harmonics} xywh {675 430 55 15} down_box BORDER_BOX labelsize 10 align 129 when 3 textsize 10
  760. code0 {o->init("Padaptiveharmonics");}
  761. class Fl_Osc_Choice
  762. } {
  763. MenuItem {} {
  764. label OFF
  765. xywh {85 85 100 20} labelfont 1 labelsize 10
  766. }
  767. MenuItem {} {
  768. label ON
  769. xywh {95 95 100 20} labelfont 1 labelsize 10
  770. }
  771. MenuItem {} {
  772. label Square
  773. xywh {105 105 100 20} labelfont 1 labelsize 10
  774. }
  775. MenuItem {} {
  776. label 2xSub
  777. xywh {115 115 100 20} labelfont 1 labelsize 10
  778. }
  779. MenuItem {} {
  780. label 2xAdd
  781. xywh {125 125 100 20} labelfont 1 labelsize 10
  782. }
  783. MenuItem {} {
  784. label 3xSub
  785. xywh {125 125 100 20} labelfont 1 labelsize 10
  786. }
  787. MenuItem {} {
  788. label 3xAdd
  789. xywh {135 135 100 20} labelfont 1 labelsize 10
  790. }
  791. MenuItem {} {
  792. label 4xSub
  793. xywh {135 135 100 20} labelfont 1 labelsize 10
  794. }
  795. MenuItem {} {
  796. label 4xAdd
  797. xywh {145 145 100 20} labelfont 1 labelsize 10
  798. }
  799. }
  800. Fl_Dial adhrpow {
  801. label pow
  802. callback {redrawoscil();}
  803. tooltip {Adaptive harmonics power} xywh {705 465 25 25} labelsize 10 maximum 200 step 1
  804. code0 {o->init("Padaptiveharmonicspower");o->reset_value=100;}
  805. class Fl_Osc_Dial
  806. }
  807. Fl_Dial adhrbf {
  808. label baseF
  809. callback {redrawoscil();}
  810. tooltip {Adaptive harmonics base frequency} xywh {675 465 25 25} labelsize 10 maximum 255 step 1
  811. code0 {o->init("Padaptiveharmonicsbasefreq");o->reset_value=128;}
  812. class Fl_Osc_Dial
  813. }
  814. Fl_Slider adhrpar {
  815. code0 {o->init("Padaptiveharmonicspar", 'i');o->reset_value=50;}
  816. callback {redrawoscil();}
  817. xywh {675 450 55 10} type {Horz Knob} box NO_BOX maximum 100 step 1 value 50
  818. class Fl_Osc_TSlider
  819. }
  820. }
  821. Fl_Group {} {
  822. xywh {445 313 150 30} box UP_FRAME
  823. } {
  824. Fl_Choice modtype {
  825. label {Mod.}
  826. callback {redrawoscil();}
  827. tooltip modulation xywh {475 320 50 15} down_box BORDER_BOX labelsize 10 when 1 textsize 10
  828. code0 {o->init("Pmodulation");}
  829. class Fl_Osc_Choice
  830. } {
  831. MenuItem {} {
  832. label None
  833. xywh {65 65 100 20} labelfont 1 labelsize 10
  834. }
  835. MenuItem {} {
  836. label Rev
  837. xywh {75 75 100 20} labelfont 1 labelsize 10
  838. }
  839. MenuItem {} {
  840. label Sine
  841. xywh {85 85 100 20} labelfont 1 labelsize 10
  842. }
  843. MenuItem {} {
  844. label Pow
  845. xywh {95 95 100 20} labelfont 1 labelsize 10
  846. }
  847. }
  848. Fl_Dial modpar1 {
  849. callback {redrawoscil();}
  850. tooltip {Oscillator's modulation parameter 1} xywh {535 320 15 15} maximum 127 step 1
  851. code0 {o->init("Pmodulationpar1");o->reset_value=64;}
  852. class Fl_Osc_Dial
  853. }
  854. Fl_Dial modpar2 {
  855. callback {redrawoscil();}
  856. tooltip {Oscillator's modulation parameter 2} xywh {555 320 15 15} maximum 127 step 1
  857. code0 {o->init("Pmodulationpar2");o->reset_value=64;}
  858. class Fl_Osc_Dial
  859. }
  860. Fl_Dial modpar3 {
  861. callback {redrawoscil();}
  862. tooltip {Oscillator's modulation parameter 3} xywh {575 320 15 15} maximum 127 step 1
  863. code0 {o->init("Pmodulationpar3");o->reset_value=32;}
  864. class Fl_Osc_Dial
  865. }
  866. }
  867. Fl_Button {} {
  868. label Sine
  869. callback {if (!fl_choice("Convert to SINE?","No","Yes",NULL)) return;
  870. osc->requestValue(loc+"convert2sine");
  871. bftype->update();
  872. bfpar->value(0);
  873. bfpar->do_callback();
  874. redrawoscil();
  875. refresh();}
  876. xywh {675 530 55 15} box THIN_UP_BOX labelfont 1 labelsize 11
  877. }
  878. Fl_Button {} {
  879. label C
  880. callback {presetsui->copy(dummy->loc());}
  881. xywh {675 550 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
  882. }
  883. Fl_Button {} {
  884. label P
  885. callback {presetsui->paste(dummy->loc(), this);}
  886. xywh {705 550 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
  887. }
  888. Fl_Scroll _this_has_to_be_the_last {
  889. xywh {10 345 660 250} type HORIZONTAL box FLAT_BOX
  890. } {
  891. Fl_Pack harmonics {open
  892. xywh {15 350 650 225} type HORIZONTAL
  893. code0 {for (int i=0;i<(MAX_AD_HARMONICS - 1);i++){h[i]=new Oscilharmonic(0,0,20,o->h(),"");h[i]->init(i,oscildisplaygroup,loc,osc);}}
  894. } {}
  895. }
  896. }
  897. }
  898. }
  899. Function {OscilEditor(bool adnotep_, std::string loc_, Fl_Osc_Interface *osc_)} {open
  900. } {
  901. code { assert(osc_);
  902. assert(!loc_.empty());
  903. initialized = false;
  904. adnotep = adnotep_;
  905. osc = osc_;
  906. loc = loc_;
  907. oscilo = NULL;
  908. oscilo_base = NULL;
  909. oscils = NULL;
  910. oscils_base = NULL;
  911. osceditUI = NULL;
  912. dummy = NULL;
  913. applybutton = NULL;
  914. oscildisplaygroup = NULL;
  915. rndslider = NULL;
  916. hrndtype = NULL;
  917. magtype = NULL;
  918. basefuncdisplaygroup = NULL;
  919. bfpar = NULL;
  920. bftype = NULL;
  921. make_window();
  922. bftype->init("Pcurrentbasefunc");
  923. initialized = true;
  924. refresh();
  925. osceditUI->show();} {}
  926. }
  927. Function {~OscilEditor()} {open
  928. } {
  929. code {osceditUI->hide();
  930. for (int i=0; i<(MAX_AD_HARMONICS - 1); ++i)
  931. delete h[i];
  932. delete oscilo;
  933. delete oscilo_base;
  934. delete oscils;
  935. delete oscils_base;
  936. delete osceditUI;} {}
  937. }
  938. Function {refresh()} {} {
  939. code {magtype->update();
  940. for (int i=0;i<(MAX_AD_HARMONICS - 1);i++) h[i]->refresh();
  941. osc->requestValue(loc+"prepare");
  942. basefuncdisplaygroup->redraw();
  943. redrawoscil();} {}
  944. }
  945. Function {redrawoscil()} {open
  946. } {
  947. code {
  948. if(!initialized) //Must have been called during initialization
  949. return;
  950. //get data from backend
  951. osc->requestValue(loc+"prepare");
  952. oscilo->update();
  953. oscils->update();
  954. oscilo_base->update();
  955. oscils_base->update();} {}
  956. }
  957. Function {setbfmodstatus(int menuentry)} {open
  958. } {
  959. code {
  960. switch (menuentry){
  961. case 0:
  962. bfpar->deactivate();
  963. bfparval->deactivate();
  964. basefuncmodulation->deactivate();
  965. break;
  966. case 127:
  967. bfpar->deactivate();
  968. bfparval->deactivate();
  969. basefuncmodulation->activate();
  970. break;
  971. default:
  972. bfpar->activate();
  973. bfparval->activate();
  974. basefuncmodulation->activate();
  975. }
  976. } {} }
  977. decl {Oscilharmonic *h[(MAX_AD_HARMONICS - 1)];} {private local
  978. }
  979. decl {std::string loc;} {private local
  980. }
  981. decl {Fl_Osc_Interface *osc;} {private local
  982. }
  983. decl {Fl_Oscilloscope *oscilo, *oscilo_base;} {private local
  984. }
  985. decl {Fl_OscilSpectrum *oscils, *oscils_base;} {private local
  986. }
  987. decl {bool adnotep;} {private local
  988. }
  989. decl {bool initialized;} {private local
  990. }
  991. }