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

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