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.

PADnoteUI.fl 35KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120
  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0110
  3. header_name {.h}
  4. code_name {.cc}
  5. decl {\#include "../Params/PADnoteParameters.h"} {public
  6. }
  7. decl {\#include "../Misc/Util.h"} {public
  8. }
  9. decl {\#include "../Misc/Master.h"} {public
  10. }
  11. decl {\#include "ResonanceUI.h"} {public
  12. }
  13. decl {\#include <FL/Fl_Box.H>} {public
  14. }
  15. decl {\#include <FL/Fl_Group.H>} {public
  16. }
  17. decl {\#include <FL/Fl_File_Chooser.H>} {public
  18. }
  19. decl {\#include <math.h>} {}
  20. decl {\#include <stdio.h>} {}
  21. decl {\#include <stdlib.h>} {}
  22. decl {\#include <string.h>} {}
  23. decl {\#include "WidgetPDial.h"} {public
  24. }
  25. decl {\#include "EnvelopeUI.h"} {public
  26. }
  27. decl {\#include "LFOUI.h"} {public
  28. }
  29. decl {\#include "FilterUI.h"} {public
  30. }
  31. decl {\#include "OscilGenUI.h"} {public
  32. }
  33. decl {\#include "PresetsUI.h"} {public
  34. }
  35. class PADnoteHarmonicProfile {: {public Fl_Box}
  36. } {
  37. Function {PADnoteHarmonicProfile(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} {
  38. code {pars=NULL;} {}
  39. }
  40. Function {init(PADnoteParameters *pars,Master *master_)} {} {
  41. code {master=master_;
  42. this->pars=pars;} {}
  43. }
  44. Function {draw()} {} {
  45. code {int ox=x(),oy=y(),lx=w(),ly=h();
  46. if (!visible()) return;
  47. float smps[lx];
  48. float realbw=pars->getprofile(smps,lx);
  49. bool active=active_r();
  50. //draw the equivalent bandwidth
  51. if (active) fl_color(220,220,220);
  52. else fl_color(160,165,165);
  53. fl_line_style(FL_DASH);
  54. int rbw=(int)(realbw*(lx-1.0)/2.0);
  55. fl_begin_line();
  56. for (int i=lx/2-rbw;i<(lx/2+rbw);i++) { fl_vertex(ox+i,oy); }
  57. fl_end_line();
  58. fl_line_style(FL_DASH);
  59. if (active) fl_color(200,200,200);
  60. else fl_color(160,160,160);
  61. for (int i=1;i<10;i++){
  62. int kx=(int)(lx/10.0*i);
  63. fl_line( ox + kx, oy, ox + kx, oy + ly - 1 );
  64. };
  65. for (int i=1;i<5;i++){
  66. int ky=(int)(ly/5.0*i);
  67. fl_line(ox,oy+ly-ky,ox+lx,oy+ly-ky-1);
  68. };
  69. fl_color(120,120,120);
  70. fl_line_style(FL_DASH);
  71. fl_line(ox+lx/2,oy,ox+lx/2,oy+ly);
  72. //draw the graph
  73. fl_line_style(FL_SOLID);
  74. if (active) fl_color(180,210,240);
  75. else fl_color(150,150,155);
  76. fl_color( fl_color_add_alpha( fl_color(), 127 ) );
  77. fl_begin_polygon();
  78. fl_vertex( ox, oy + h() );
  79. for (int i=0;i<lx;i++){
  80. int val=(int) ((ly-2)*smps[i]);
  81. // fl_vertex(ox+i,oy+ly-1);
  82. fl_vertex(ox+i,oy+ly-1-val);
  83. // if (active) fl_color(0,0,100);
  84. // else fl_color(150,150,150);
  85. // if (i>0)
  86. // {
  87. // fl_vertex(ox+i-1,oy+ly-2-old);
  88. // fl_vertex(ox+i,oy+ly-2-val);
  89. // }
  90. };
  91. fl_vertex( ox + w(), oy + h() );
  92. fl_end_polygon();
  93. fl_line_style(FL_DASH);
  94. if (active) fl_color(0,100,220);
  95. else fl_color(150,160,170);
  96. fl_line(ox+lx/2-rbw,oy,ox+lx/2-rbw,oy+ly-1);
  97. fl_line(ox+lx/2+rbw,oy,ox+lx/2+rbw,oy+ly-1);
  98. fl_line_style(0);} {}
  99. }
  100. decl {Master *master;} {}
  101. decl {PADnoteParameters *pars;} {public
  102. }
  103. }
  104. class PADnoteOvertonePosition {: {public Fl_Box}
  105. } {
  106. Function {PADnoteOvertonePosition(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} {
  107. code {pars=NULL;} {}
  108. }
  109. Function {init(PADnoteParameters *pars,Master *master_)} {} {
  110. code {master=master_;
  111. this->pars=pars;} {}
  112. }
  113. Function {draw()} {} {
  114. code {if (!visible()) return;
  115. const int maxdb=60;
  116. int ox=x(),oy=y(),lx=w(),ly=h();
  117. const int maxharmonic=64;
  118. for (int i=1;i<maxharmonic;i++){
  119. fl_color(100,100,100);
  120. fl_line_style(FL_DOT);
  121. if (i%5==0) fl_line_style(0);
  122. if (i%10==0) fl_color(120,120,120);
  123. int kx=(int)(lx/(float)maxharmonic*i);
  124. fl_line(ox+kx,oy,ox+kx,oy+ly);
  125. };
  126. int n=synth->oscilsize/2;
  127. float spc[n];
  128. for (int i=0;i<n;i++) spc[i]=0.0;
  129. pthread_mutex_lock(&master->mutex);
  130. pars->oscilgen->getspectrum(n,spc,0);
  131. pthread_mutex_unlock(&master->mutex);
  132. //normalize
  133. float max=0;
  134. for (int i=0;i<n;i++){
  135. float x=fabs(spc[i]);
  136. if (max<x) max=x;
  137. }
  138. if (max<0.000001) max=1.0;
  139. max=max*1.05;
  140. float spectrum[lx];
  141. for (int i=0;i<lx;i++) spectrum[i]=0;
  142. for (int i=1;i<n;i++){
  143. float nhr=pars->getNhr(i);
  144. int kx=(int)(lx/(float)maxharmonic*nhr);
  145. if ((kx<0)||(kx>lx)) continue;
  146. spectrum[kx]=spc[i-1]/max+1e-9;
  147. };
  148. fl_color(180,0,0);
  149. fl_line_style(0);
  150. if (pars->Pmode==2){
  151. int old=0;
  152. for (int i=1;i<lx;i++){
  153. if ((spectrum[i]>1e-10)||(i==(lx-1))){
  154. int delta=i-old;
  155. float val1=spectrum[old];
  156. float val2=spectrum[i];
  157. float idelta=1.0/delta;
  158. for (int j=0;j<delta;j++){
  159. float x=idelta*j;
  160. spectrum[old+j]=val1*(1.0-x)+val2*x;
  161. };
  162. old=i;
  163. };
  164. };
  165. };
  166. for (int i=0;i<lx;i++){
  167. float x=spectrum[i];
  168. if (x>dB2rap(-maxdb)) x=rap2dB(x)/maxdb+1;
  169. else continue;
  170. int yy=(int)(x*ly);
  171. fl_line(ox+i,oy+ly-1-yy,ox+i,oy+ly-1);
  172. };} {}
  173. }
  174. decl {Master *master;} {}
  175. decl {PADnoteParameters *pars;} {public
  176. }
  177. }
  178. class PADnoteUI {open : {public PresetsUI_}
  179. } {
  180. Function {PADnoteUI(PADnoteParameters *parameters,Master *master_)} {open
  181. } {
  182. code {pars=parameters;
  183. master=master_;
  184. oscui=NULL;
  185. resui=new ResonanceUI(pars->resonance);
  186. make_window();} {}
  187. }
  188. Function {make_window()} {open
  189. } {
  190. Fl_Window padnotewindow {
  191. label {PAD synth Parameters} open
  192. xywh {288 386 535 435} type Double visible
  193. } {
  194. Fl_Tabs {} {
  195. callback {if (o->value()!=harmonicstructuregroup) applybutton->hide();
  196. else applybutton->show();} open
  197. xywh {0 0 535 395} box UP_FRAME
  198. } {
  199. Fl_Group harmonicstructuregroup {
  200. label {Harmonic Structure} open selected
  201. xywh {0 20 535 375} box UP_FRAME
  202. } {
  203. Fl_Group bwprofilegroup {
  204. xywh {5 30 90 260} box UP_FRAME
  205. code0 {if (pars->Pmode!=0) o->deactivate();}
  206. } {
  207. Fl_Dial hpbasepar1 {
  208. label Width
  209. callback {pars->Php.base.par1=(int) o->value();
  210. hprofile->redraw();
  211. cbwidget->do_callback();}
  212. xywh {20 75 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  213. code0 {o->value(pars->Php.base.par1);}
  214. class WidgetPDial
  215. }
  216. Fl_Choice hpbasetype {
  217. label {Base Type}
  218. callback {pars->Php.base.type=o->value();
  219. hprofile->redraw();
  220. cbwidget->do_callback();}
  221. xywh {15 45 75 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
  222. code0 {o->value(pars->Php.base.type);}
  223. } {
  224. MenuItem {} {
  225. label Gauss
  226. xywh {15 15 100 20} labelfont 1 labelsize 10
  227. }
  228. MenuItem {} {
  229. label Square
  230. xywh {25 25 100 20} labelfont 1 labelsize 10
  231. }
  232. MenuItem {} {
  233. label DoubleExp
  234. xywh {35 35 100 20} labelfont 1 labelsize 10
  235. }
  236. }
  237. Fl_Dial hpfreqmult {
  238. label FreqMlt
  239. callback {pars->Php.freqmult=(int) o->value();
  240. hprofile->redraw();
  241. cbwidget->do_callback();}
  242. xywh {55 75 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  243. code0 {o->value(pars->Php.freqmult);}
  244. class WidgetPDial
  245. }
  246. Fl_Dial hpmpar1 {
  247. label Str
  248. callback {pars->Php.modulator.par1=(int) o->value();
  249. hprofile->redraw();
  250. cbwidget->do_callback();}
  251. xywh {15 115 20 20} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  252. code0 {o->value(pars->Php.modulator.par1);}
  253. class WidgetPDial
  254. }
  255. Fl_Dial hpmfreq {
  256. label SFreq
  257. callback {pars->Php.modulator.freq=(int) o->value();
  258. hprofile->redraw();
  259. cbwidget->do_callback();}
  260. xywh {40 115 20 20} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  261. code0 {o->value(pars->Php.modulator.freq);}
  262. class WidgetPDial
  263. }
  264. Fl_Group {} {
  265. xywh {10 160 80 105} box BORDER_BOX
  266. } {
  267. Fl_Choice hpamptype {
  268. label AmpMultiplier
  269. callback {pars->Php.amp.type=o->value();
  270. hprofile->redraw();
  271. cbwidget->do_callback();}
  272. xywh {15 175 70 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
  273. code0 {o->value(pars->Php.amp.type);}
  274. } {
  275. MenuItem {} {
  276. label OFF
  277. xywh {45 45 100 20} labelfont 1 labelsize 10
  278. }
  279. MenuItem {} {
  280. label Gauss
  281. xywh {55 55 100 20} labelfont 1 labelsize 10
  282. }
  283. MenuItem {} {
  284. label Sine
  285. xywh {65 65 100 20} labelfont 1 labelsize 10
  286. }
  287. MenuItem {} {
  288. label Flat
  289. xywh {75 75 100 20} labelfont 1 labelsize 10
  290. }
  291. }
  292. Fl_Choice hpampmode {
  293. label AmpMode
  294. callback {pars->Php.amp.mode=o->value();
  295. hprofile->redraw();
  296. cbwidget->do_callback();}
  297. xywh {15 205 70 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
  298. code0 {o->value(pars->Php.amp.mode);}
  299. } {
  300. MenuItem {} {
  301. label Sum
  302. xywh {60 60 100 20} labelfont 1 labelsize 10
  303. }
  304. MenuItem {} {
  305. label Mult
  306. xywh {70 70 100 20} labelfont 1 labelsize 10
  307. }
  308. MenuItem {} {
  309. label Div1
  310. xywh {80 80 100 20} labelfont 1 labelsize 10
  311. }
  312. MenuItem {} {
  313. label Div2
  314. xywh {90 90 100 20} labelfont 1 labelsize 10
  315. }
  316. }
  317. Fl_Dial hpamppar1 {
  318. label Par1
  319. callback {pars->Php.amp.par1=(int) o->value();
  320. hprofile->redraw();
  321. cbwidget->do_callback();}
  322. xywh {15 235 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  323. code0 {o->value(pars->Php.amp.par1);}
  324. class WidgetPDial
  325. }
  326. Fl_Dial hpamppar2 {
  327. label Par2
  328. callback {pars->Php.amp.par2=(int) o->value();
  329. hprofile->redraw();
  330. cbwidget->do_callback();}
  331. xywh {55 235 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  332. code0 {o->value(pars->Php.amp.par2);}
  333. class WidgetPDial
  334. }
  335. }
  336. Fl_Check_Button hpautoscale {
  337. label autoscale
  338. callback {pars->Php.autoscale=(int) o->value();
  339. hprofile->redraw();
  340. cbwidget->do_callback();}
  341. xywh {10 270 60 15} down_box DOWN_BOX labelsize 10
  342. code0 {o->value(pars->Php.autoscale);}
  343. }
  344. Fl_Choice hponehalf {
  345. callback {pars->Php.onehalf=o->value();
  346. hprofile->redraw();
  347. cbwidget->do_callback();}
  348. xywh {10 143 80 15} down_box BORDER_BOX labelsize 10 align 5 textsize 10
  349. code0 {o->value(pars->Php.onehalf);}
  350. } {
  351. MenuItem {} {
  352. label Full
  353. xywh {25 25 100 20} labelfont 1 labelsize 10
  354. }
  355. MenuItem {} {
  356. label {Upper Half}
  357. xywh {45 45 100 20} labelfont 1 labelsize 10
  358. }
  359. MenuItem {} {
  360. label {Lower Half}
  361. xywh {35 35 100 20} labelfont 1 labelsize 10
  362. }
  363. }
  364. Fl_Dial hpwidth {
  365. label Size
  366. callback {pars->Php.width=(int) o->value();
  367. hprofile->redraw();
  368. cbwidget->do_callback();}
  369. xywh {65 115 20 20} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  370. code0 {o->value(pars->Php.width);}
  371. class WidgetPDial
  372. }
  373. }
  374. Fl_Group {} {
  375. xywh {100 155 270 135} box THIN_DOWN_BOX color 32 selection_color 71 labelcolor 179 align 6
  376. code0 {osc=new Oscilloscope(o->x(),o->y(),o->w(),o->h(),"");}
  377. code1 {osc->init(pars->oscilgen,master);}
  378. } {}
  379. Fl_Button {} {
  380. label Change
  381. callback {if (oscui!=NULL) delete (oscui);
  382. oscui=new OscilEditor(pars->oscilgen,osc,cbwidget,applybutton,master);}
  383. xywh {375 270 60 20} box THIN_UP_BOX labelfont 1 labelsize 11
  384. }
  385. Fl_Box cbwidget {
  386. label {Harmonic Content}
  387. callback {overtonepos->redraw();
  388. applybutton->color(FL_RED);
  389. applybutton->redraw();}
  390. xywh {125 135 205 20} align 16
  391. }
  392. Fl_Button {} {
  393. label Resonance
  394. callback {resui->resonancewindow->redraw();
  395. resui->resonancewindow->show();
  396. resui->setcbwidget(cbwidget,applybutton);}
  397. xywh {375 225 80 20} box THIN_UP_BOX
  398. }
  399. Fl_Dial bwdial {
  400. label BandWidth
  401. callback {bwcents->value(pars->setPbandwidth((int) o->value()));
  402. cbwidget->do_callback();}
  403. xywh {15 295 35 35} box ROUND_UP_BOX labelsize 10 maximum 1000 step 1
  404. code0 {o->value(pars->Pbandwidth);}
  405. code1 {if (pars->Pmode!=0) o->deactivate();}
  406. class WidgetPDial
  407. }
  408. Fl_Value_Output bwcents {
  409. label cents
  410. xywh {55 305 55 15} labelsize 10 align 6 maximum 10000 step 0.1
  411. code0 {o->value(pars->setPbandwidth(pars->Pbandwidth));}
  412. code1 {if (pars->Pmode!=0) o->deactivate();}
  413. }
  414. Fl_Group {} {
  415. xywh {315 295 215 45} box UP_FRAME
  416. } {
  417. Fl_Choice hrpostype {
  418. label OvertonesPosition
  419. callback {pars->Phrpos.type=o->value();
  420. overtonepos->redraw();
  421. cbwidget->do_callback();}
  422. xywh {325 310 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11
  423. code0 {o->value(pars->Phrpos.type);}
  424. } {
  425. MenuItem {} {
  426. label Harmonic
  427. xywh {70 70 100 20} labelfont 1 labelsize 11
  428. }
  429. MenuItem {} {
  430. label ShiftU
  431. xywh {80 80 100 20} labelfont 1 labelsize 11
  432. }
  433. MenuItem {} {
  434. label ShiftL
  435. xywh {90 90 100 20} labelfont 1 labelsize 11
  436. }
  437. MenuItem {} {
  438. label PowerU
  439. xywh {90 90 100 20} labelfont 1 labelsize 11
  440. }
  441. MenuItem {} {
  442. label PowerL
  443. xywh {100 100 100 20} labelfont 1 labelsize 11
  444. }
  445. MenuItem {} {
  446. label Sine
  447. xywh {110 110 100 20} labelfont 1 labelsize 11
  448. }
  449. MenuItem {} {
  450. label Power
  451. xywh {120 120 100 20} labelfont 1 labelsize 11
  452. }
  453. MenuItem {} {
  454. label Shift selected
  455. xywh {130 130 100 20} labelfont 1 labelsize 11
  456. }
  457. }
  458. Fl_Dial hrpospar1 {
  459. label Par1
  460. callback {pars->Phrpos.par1=(int) o->value();
  461. overtonepos->redraw();
  462. cbwidget->do_callback();}
  463. xywh {425 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1
  464. code0 {o->value(pars->Phrpos.par1);}
  465. class WidgetPDial
  466. }
  467. Fl_Dial hrpospar2 {
  468. label Par2
  469. callback {pars->Phrpos.par2=(int) o->value();
  470. overtonepos->redraw();
  471. cbwidget->do_callback();}
  472. xywh {460 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1
  473. code0 {o->value(pars->Phrpos.par2);}
  474. class WidgetPDial
  475. }
  476. Fl_Dial hrpospar3 {
  477. label ForceH
  478. callback {pars->Phrpos.par3=(int) o->value();
  479. overtonepos->redraw();
  480. cbwidget->do_callback();}
  481. xywh {495 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1
  482. code0 {o->value(pars->Phrpos.par3);}
  483. class WidgetPDial
  484. }
  485. }
  486. Fl_Choice bwscale {
  487. label {Bandwidth Scale}
  488. callback {pars->Pbwscale=(int) o->value();
  489. cbwidget->do_callback();}
  490. xywh {120 305 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11
  491. code0 {o->value(pars->Pbwscale);}
  492. code1 {if (pars->Pmode!=0) o->deactivate();}
  493. } {
  494. MenuItem {} {
  495. label Normal
  496. xywh {95 95 100 20} labelfont 1 labelsize 11
  497. }
  498. MenuItem {} {
  499. label EqualHz
  500. xywh {105 105 100 20} labelfont 1 labelsize 11
  501. }
  502. MenuItem {} {
  503. label Quater
  504. xywh {115 115 100 20} labelfont 1 labelsize 11
  505. }
  506. MenuItem {} {
  507. label Half
  508. xywh {125 125 100 20} labelfont 1 labelsize 11
  509. }
  510. MenuItem {} {
  511. label {75%}
  512. xywh {135 135 100 20} labelfont 1 labelsize 11
  513. }
  514. MenuItem {} {
  515. label {150%}
  516. xywh {145 145 100 20} labelfont 1 labelsize 11
  517. }
  518. MenuItem {} {
  519. label Double
  520. xywh {145 145 100 20} labelfont 1 labelsize 11
  521. }
  522. MenuItem {} {
  523. label {Inv.Half}
  524. xywh {155 155 100 20} labelfont 1 labelsize 11
  525. }
  526. }
  527. Fl_Group overtonepos {
  528. xywh {5 345 525 45} box FLAT_BOX color 51 selection_color 218 labelcolor 63
  529. code0 {PADnoteOvertonePosition *opui=new PADnoteOvertonePosition(o->x(),o->y(),o->w(),o->h(),"");}
  530. code1 {opui->init(pars,master);}
  531. } {}
  532. Fl_Choice qsamplesize {
  533. label {Sample Size}
  534. callback {pars->Pquality.samplesize=(int) o->value();
  535. cbwidget->do_callback();}
  536. xywh {375 190 115 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11
  537. code0 {o->value(pars->Pquality.samplesize);}
  538. } {
  539. MenuItem {} {
  540. label {16k (Tiny)}
  541. xywh {155 155 100 20} labelfont 1 labelsize 11
  542. }
  543. MenuItem {} {
  544. label 32k
  545. xywh {165 165 100 20} labelfont 1 labelsize 11
  546. }
  547. MenuItem {} {
  548. label {64k (Small)}
  549. xywh {175 175 100 20} labelfont 1 labelsize 11
  550. }
  551. MenuItem {} {
  552. label 128k
  553. xywh {185 185 100 20} labelfont 1 labelsize 11
  554. }
  555. MenuItem {} {
  556. label {256k (Normal)}
  557. xywh {205 205 100 20} labelfont 1 labelsize 11
  558. }
  559. MenuItem {} {
  560. label 512k
  561. xywh {200 200 100 20} labelfont 1 labelsize 11
  562. }
  563. MenuItem {} {
  564. label {1M (Big)}
  565. xywh {205 205 100 20} labelfont 1 labelsize 11
  566. }
  567. }
  568. Fl_Choice qsmpoct {
  569. label {smp/oct}
  570. callback {pars->Pquality.smpoct=(int) o->value();
  571. cbwidget->do_callback();}
  572. xywh {430 155 45 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11
  573. code0 {o->value(pars->Pquality.smpoct);}
  574. } {
  575. MenuItem {} {
  576. label {0.5}
  577. xywh {10 10 100 20} labelfont 1 labelsize 11
  578. }
  579. MenuItem {} {
  580. label 1
  581. xywh {0 0 100 20} labelfont 1 labelsize 11
  582. }
  583. MenuItem {} {
  584. label 2
  585. xywh {10 10 100 20} labelfont 1 labelsize 11
  586. }
  587. MenuItem {} {
  588. label 3
  589. xywh {20 20 100 20} labelfont 1 labelsize 11
  590. }
  591. MenuItem {} {
  592. label 4
  593. xywh {30 30 100 20} labelfont 1 labelsize 11
  594. }
  595. MenuItem {} {
  596. label 6
  597. xywh {40 40 100 20} labelfont 1 labelsize 11
  598. }
  599. MenuItem {} {
  600. label 12
  601. xywh {50 50 100 20} labelfont 1 labelsize 11
  602. }
  603. }
  604. Fl_Choice qoct {
  605. label {no.oct}
  606. callback {pars->Pquality.oct=(int) o->value();
  607. cbwidget->do_callback();}
  608. xywh {480 155 45 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11
  609. code0 {o->value(pars->Pquality.oct);}
  610. } {
  611. MenuItem {} {
  612. label 1
  613. xywh {10 10 100 20} labelfont 1 labelsize 11
  614. }
  615. MenuItem {} {
  616. label 2
  617. xywh {20 20 100 20} labelfont 1 labelsize 11
  618. }
  619. MenuItem {} {
  620. label 3
  621. xywh {30 30 100 20} labelfont 1 labelsize 11
  622. }
  623. MenuItem {} {
  624. label 4
  625. xywh {40 40 100 20} labelfont 1 labelsize 11
  626. }
  627. MenuItem {} {
  628. label 5
  629. xywh {50 50 100 20} labelfont 1 labelsize 11
  630. }
  631. MenuItem {} {
  632. label 6
  633. xywh {60 60 100 20} labelfont 1 labelsize 11
  634. }
  635. MenuItem {} {
  636. label 7
  637. xywh {70 70 100 20} labelfont 1 labelsize 11
  638. }
  639. MenuItem {} {
  640. label 8
  641. xywh {80 80 100 20} labelfont 1 labelsize 11
  642. }
  643. }
  644. Fl_Choice qbasenote {
  645. label base
  646. callback {pars->Pquality.basenote=(int) o->value();
  647. cbwidget->do_callback();}
  648. xywh {375 155 50 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11
  649. code0 {o->value(pars->Pquality.basenote);}
  650. } {
  651. MenuItem {} {
  652. label {C-2}
  653. xywh {10 10 100 20} labelfont 1
  654. }
  655. MenuItem {} {
  656. label {G-2}
  657. xywh {20 20 100 20} labelfont 1
  658. }
  659. MenuItem {} {
  660. label {C-3}
  661. xywh {20 20 100 20} labelfont 1
  662. }
  663. MenuItem {} {
  664. label {G-3}
  665. xywh {30 30 100 20} labelfont 1
  666. }
  667. MenuItem {} {
  668. label {C-4}
  669. xywh {30 30 100 20} labelfont 1
  670. }
  671. MenuItem {} {
  672. label {G-4}
  673. xywh {40 40 100 20} labelfont 1
  674. }
  675. MenuItem {} {
  676. label {C-5}
  677. xywh {40 40 100 20} labelfont 1
  678. }
  679. MenuItem {} {
  680. label {G-5}
  681. xywh {50 50 100 20} labelfont 1
  682. }
  683. MenuItem {} {
  684. label {G-6}
  685. xywh {60 60 100 20} labelfont 1
  686. }
  687. }
  688. Fl_Group hprofile {
  689. xywh {100 45 430 90} box FLAT_BOX color 51 selection_color 218 labelcolor 63
  690. code0 {PADnoteHarmonicProfile *hpui=new PADnoteHarmonicProfile(o->x(),o->y(),o->w(),o->h(),"");}
  691. code1 {hpui->init(pars,master);}
  692. code2 {if (pars->Pmode!=0) { o->deactivate(); o->color(48);};}
  693. } {}
  694. Fl_Box {} {
  695. label {Profile of One Harmonic (Frequency Distribution)}
  696. xywh {160 25 315 20}
  697. }
  698. Fl_Choice spectrummode {
  699. label {Spectrum Mode}
  700. callback {pars->Pmode=(int) o->value();
  701. if (pars->Pmode==0){
  702. bwprofilegroup->activate();
  703. bwdial->activate();
  704. bwcents->activate();
  705. hprofile->activate();
  706. hprofile->color(51);
  707. bwscale->activate();
  708. } else {
  709. bwprofilegroup->deactivate();
  710. bwdial->deactivate();
  711. bwcents->deactivate();
  712. hprofile->deactivate();
  713. hprofile->color(48);
  714. bwscale->deactivate();
  715. };
  716. cbwidget->do_callback();}
  717. xywh {220 305 90 20} down_box BORDER_BOX labelfont 1 labelsize 10 align 5 textsize 11
  718. code0 {o->value(pars->Pmode);}
  719. } {
  720. MenuItem {} {
  721. label Bandwidth
  722. xywh {105 105 100 20} labelfont 1 labelsize 11
  723. }
  724. MenuItem {} {
  725. label Discrete
  726. xywh {125 125 100 20} labelfont 1 labelsize 11
  727. }
  728. MenuItem {} {
  729. label Continous
  730. xywh {115 115 100 20} labelfont 1 labelsize 11
  731. }
  732. }
  733. }
  734. Fl_Group {} {
  735. label {Envelopes&LFOs} open
  736. xywh {0 20 535 375} box UP_FRAME hide
  737. } {
  738. Fl_Group {} {
  739. label FREQUENCY
  740. xywh {5 275 525 115} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
  741. } {
  742. Fl_Group freqenv {
  743. label {PADSynth - Frequency Envelope} open
  744. xywh {10 315 205 70} box FLAT_BOX color 51 align 144
  745. code0 {o->init(pars->FreqEnvelope);}
  746. class EnvelopeUI
  747. } {}
  748. Fl_Counter octave {
  749. label Octave
  750. callback {int k=(int) o->value();
  751. if (k<0) k+=16;
  752. pars->PCoarseDetune = k*1024+
  753. pars->PCoarseDetune%1024;}
  754. tooltip Octave xywh {470 295 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11
  755. code0 {int k=pars->PCoarseDetune/1024;}
  756. code1 {if (k>=8) k-=16;}
  757. code2 {o->value(k);}
  758. }
  759. Fl_Counter coarsedet {
  760. label {Coarse det.}
  761. callback {int k=(int) o->value();
  762. if (k<0) k+=1024;
  763. pars->PCoarseDetune = k+
  764. (pars->PCoarseDetune/1024)*1024;}
  765. tooltip {Coarse Detune} xywh {455 365 70 20} type Simple labelsize 10 align 5 minimum -64 maximum 63 step 1 textfont 1 textsize 11
  766. code0 {int k=pars->PCoarseDetune%1024;}
  767. code1 {if (k>=512) k-=1024;}
  768. code2 {o->value(k);}
  769. code3 {o->lstep(10);}
  770. }
  771. Fl_Group freqlfo {
  772. label {Frequency LFO } open
  773. xywh {215 315 230 70} box FLAT_BOX color 47 align 144
  774. code0 {o->init(pars->FreqLfo);}
  775. class LFOUI
  776. } {}
  777. Fl_Slider detune {
  778. callback {pars->PDetune=(int)o->value()+8192;
  779. detunevalueoutput->do_callback();}
  780. tooltip {Fine Detune (cents)} xywh {60 295 295 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1
  781. code0 {o->value(pars->PDetune-8192);}
  782. }
  783. Fl_Value_Output detunevalueoutput {
  784. label Detune
  785. callback {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));}
  786. xywh {12 295 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10
  787. code0 {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));}
  788. }
  789. Fl_Choice detunetype {
  790. label {Detune Type}
  791. callback {pars->PDetuneType=(int) o->value()+1;
  792. detunevalueoutput->do_callback();} open
  793. xywh {450 330 75 20} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
  794. code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");}
  795. code1 {o->value(pars->PDetuneType-1);}
  796. } {}
  797. Fl_Check_Button hz440 {
  798. label 440Hz
  799. callback {int x=(int) o->value();
  800. pars->Pfixedfreq=x;
  801. if (x==0) fixedfreqetdial->deactivate();
  802. else fixedfreqetdial->activate();}
  803. tooltip {set the base frequency to 440Hz} xywh {365 295 50 15} down_box DOWN_BOX labelfont 1 labelsize 10
  804. code0 {o->value(pars->Pfixedfreq);}
  805. }
  806. Fl_Dial fixedfreqetdial {
  807. label {Eq.T.}
  808. callback {pars->PfixedfreqET=(int) o->value();}
  809. tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {420 295 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1
  810. code0 {o->value(pars->PfixedfreqET);}
  811. code1 {if (pars->Pfixedfreq==0) o->deactivate();}
  812. class WidgetPDial
  813. }
  814. }
  815. Fl_Group {} {
  816. label AMPLITUDE
  817. xywh {5 25 240 250} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
  818. } {
  819. Fl_Value_Slider volume {
  820. label Vol
  821. callback {pars->PVolume=(int)o->value();}
  822. tooltip Volume xywh {10 50 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
  823. code0 {o->value(pars->PVolume);}
  824. }
  825. Fl_Value_Slider vsns {
  826. label {V.Sns}
  827. callback {pars->PAmpVelocityScaleFunction=(int) o->value();}
  828. tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 70 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
  829. code0 {o->value(pars->PAmpVelocityScaleFunction);}
  830. }
  831. Fl_Dial pan {
  832. label Pan
  833. callback {pars->PPanning=(int) o->value();}
  834. tooltip {Panning (leftmost is Random)} xywh {210 45 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  835. code0 {o->value(pars->PPanning);}
  836. class WidgetPDial
  837. }
  838. Fl_Dial pstr {
  839. label {P.Str.}
  840. callback {pars->PPunchStrength=(int) o->value();}
  841. tooltip {Punch Strength} xywh {125 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  842. code0 {o->value(pars->PPunchStrength);}
  843. class WidgetPDial
  844. }
  845. Fl_Dial pt {
  846. label {P.t.}
  847. callback {pars->PPunchTime=(int) o->value();}
  848. tooltip {Punch Time (duration)} xywh {155 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  849. code0 {o->value(pars->PPunchTime);}
  850. class WidgetPDial
  851. }
  852. Fl_Dial pstc {
  853. label {P.Stc.}
  854. callback {pars->PPunchStretch=(int) o->value();}
  855. tooltip {Punch Stretch} xywh {185 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  856. code0 {o->value(pars->PPunchStretch);}
  857. class WidgetPDial
  858. }
  859. Fl_Dial pvel {
  860. label {P.Vel.}
  861. callback {pars->PPunchVelocitySensing=(int) o->value();}
  862. tooltip {Punch Velocity Sensing} xywh {215 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  863. code0 {o->value(pars->PPunchVelocitySensing);}
  864. class WidgetPDial
  865. }
  866. Fl_Group ampenv {
  867. label {PADSynth - Amplitude Envelope} open
  868. xywh {10 95 205 70} box FLAT_BOX color 51 align 144
  869. code0 {o->init(pars->AmpEnvelope);}
  870. class EnvelopeUI
  871. } {}
  872. Fl_Group amplfo {
  873. label {Amplitude LFO } open
  874. xywh {10 165 230 70} box FLAT_BOX color 47 align 144
  875. code0 {o->init(pars->AmpLfo);}
  876. class LFOUI
  877. } {}
  878. Fl_Check_Button stereo {
  879. label Stereo
  880. callback {pars->PStereo=(int) o->value();
  881. hprofile->redraw();}
  882. xywh {15 245 70 25} down_box DOWN_BOX
  883. code0 {o->value(pars->PStereo);}
  884. }
  885. }
  886. Fl_Group {} {
  887. label FILTER
  888. xywh {245 25 285 250} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
  889. } {
  890. Fl_Group filterenv {
  891. label {PADSynth - Filter Envelope} open
  892. xywh {250 130 275 70} box FLAT_BOX color 51 align 144
  893. code0 {o->init(pars->FilterEnvelope);}
  894. class EnvelopeUI
  895. } {}
  896. Fl_Group filterlfo {
  897. label {Filter LFO } open
  898. xywh {250 200 230 70} box FLAT_BOX color 47 align 144
  899. code0 {o->init(pars->FilterLfo);}
  900. class LFOUI
  901. } {}
  902. Fl_Group filterui {
  903. label {PADsynth - Filter} open
  904. xywh {250 55 275 75} box FLAT_BOX color 50 align 144
  905. code0 {o->init(pars->GlobalFilter,&pars->PFilterVelocityScale,&pars->PFilterVelocityScaleFunction);}
  906. class FilterUI
  907. } {}
  908. }
  909. }
  910. }
  911. Fl_Button applybutton {
  912. label {Apply Changes}
  913. callback {pars->applyparameters(true);
  914. o->color(FL_GRAY);
  915. if (oscui!=NULL) {
  916. oscui->applybutton->color(FL_GRAY);
  917. oscui->applybutton->redraw();
  918. };
  919. if (resui!=NULL) {
  920. resui->applybutton->color(FL_GRAY);
  921. resui->applybutton->redraw();
  922. };}
  923. xywh {300 400 135 30} box THIN_UP_BOX
  924. code0 {o->color(FL_RED);}
  925. }
  926. Fl_Button {} {
  927. label Close
  928. callback {padnotewindow->hide();}
  929. xywh {440 400 90 30} box THIN_UP_BOX
  930. }
  931. Fl_Button {} {
  932. label C
  933. callback {presetsui->copy(pars);}
  934. xywh {65 400 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
  935. }
  936. Fl_Button {} {
  937. label P
  938. callback {presetsui->paste(pars,this);}
  939. xywh {95 400 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 55
  940. }
  941. Fl_Button {} {
  942. label export
  943. callback {char *filename;
  944. filename=fl_file_chooser("Export samples:","(*.wav)",NULL,0);
  945. if (filename==NULL) return;
  946. fl_filename_setext(filename,"");
  947. pars->export2wav(filename);}
  948. tooltip {export samples as wav file} xywh {5 400 55 30} box THIN_UP_BOX color 51 labelsize 11 align 128
  949. }
  950. }
  951. }
  952. Function {refresh()} {} {
  953. code {volume->value(pars->PVolume);
  954. vsns->value(pars->PAmpVelocityScaleFunction);
  955. pan->value(pars->PPanning);
  956. stereo->value(pars->PStereo);
  957. pstr->value(pars->PPunchStrength);
  958. pt->value(pars->PPunchTime);
  959. pstc->value(pars->PPunchStretch);
  960. pvel->value(pars->PPunchVelocitySensing);
  961. detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune));
  962. detune->value(pars->PDetune-8192);
  963. int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;
  964. octave->value(k);
  965. detunetype->value(pars->PDetuneType-1);
  966. k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;
  967. coarsedet->value(k);
  968. hz440->value(pars->Pfixedfreq);
  969. fixedfreqetdial->value(pars->PfixedfreqET);
  970. amplfo->refresh();
  971. freqlfo->refresh();
  972. filterlfo->refresh();
  973. ampenv->refresh();
  974. freqenv->refresh();
  975. filterenv->refresh();
  976. filterui->refresh();
  977. /* harmonic structure parametrs */
  978. resui->refresh();
  979. if (oscui!=NULL) oscui->refresh();
  980. hpbasetype->value(pars->Php.base.type);
  981. hpbasepar1->value(pars->Php.base.par1);
  982. hpfreqmult->value(pars->Php.freqmult);
  983. hpmpar1->value(pars->Php.modulator.par1);
  984. hpmfreq->value(pars->Php.modulator.freq);
  985. hpwidth->value(pars->Php.width);
  986. hponehalf->value(pars->Php.onehalf);
  987. hpamptype->value(pars->Php.amp.type);
  988. hpampmode->value(pars->Php.amp.mode);
  989. hpamppar1->value(pars->Php.amp.par1);
  990. hpamppar2->value(pars->Php.amp.par2);
  991. hpautoscale->value(pars->Php.autoscale);
  992. bwdial->value(pars->Pbandwidth);
  993. if (pars->Pmode==0){
  994. bwprofilegroup->activate();
  995. bwdial->activate();
  996. bwcents->activate();
  997. hprofile->activate();
  998. hprofile->color(51);
  999. bwscale->activate();
  1000. } else {
  1001. bwprofilegroup->deactivate();
  1002. bwdial->deactivate();
  1003. bwcents->deactivate();
  1004. hprofile->deactivate();
  1005. hprofile->color(48);
  1006. bwscale->activate();
  1007. };
  1008. spectrummode->value(pars->Pmode);
  1009. qbasenote->value(pars->Pquality.basenote);
  1010. qsmpoct->value(pars->Pquality.smpoct);
  1011. qoct->value(pars->Pquality.oct);
  1012. qsamplesize->value(pars->Pquality.samplesize);
  1013. hrpostype->value(pars->Phrpos.type);
  1014. hrpospar1->value(pars->Phrpos.par1);
  1015. hrpospar2->value(pars->Phrpos.par2);
  1016. hrpospar3->value(pars->Phrpos.par3);
  1017. hprofile->redraw();
  1018. overtonepos->redraw();
  1019. osc->redraw();
  1020. pars->applyparameters(true);
  1021. applybutton->color(FL_GRAY);
  1022. applybutton->parent()->redraw();} {}
  1023. }
  1024. Function {~PADnoteUI()} {} {
  1025. code {delete(oscui);
  1026. delete(resui);
  1027. padnotewindow->hide();
  1028. delete(padnotewindow);} {}
  1029. }
  1030. decl {PADnoteParameters *pars;} {public
  1031. }
  1032. decl {Master *master;} {public
  1033. }
  1034. decl {OscilEditor *oscui;} {public
  1035. }
  1036. decl {Oscilloscope *osc;} {public
  1037. }
  1038. decl {ResonanceUI *resui;} {public
  1039. }
  1040. }