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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116
  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 {294 392 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. }
  454. Fl_Dial hrpospar1 {
  455. label Par1
  456. callback {pars->Phrpos.par1=(int) o->value();
  457. overtonepos->redraw();
  458. cbwidget->do_callback();}
  459. xywh {425 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1
  460. code0 {o->value(pars->Phrpos.par1);}
  461. class WidgetPDial
  462. }
  463. Fl_Dial hrpospar2 {
  464. label Par2
  465. callback {pars->Phrpos.par2=(int) o->value();
  466. overtonepos->redraw();
  467. cbwidget->do_callback();}
  468. xywh {460 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1
  469. code0 {o->value(pars->Phrpos.par2);}
  470. class WidgetPDial
  471. }
  472. Fl_Dial hrpospar3 {
  473. label ForceH
  474. callback {pars->Phrpos.par3=(int) o->value();
  475. overtonepos->redraw();
  476. cbwidget->do_callback();}
  477. xywh {495 310 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 255 step 1
  478. code0 {o->value(pars->Phrpos.par3);}
  479. class WidgetPDial
  480. }
  481. }
  482. Fl_Choice bwscale {
  483. label {Bandwidth Scale}
  484. callback {pars->Pbwscale=(int) o->value();
  485. cbwidget->do_callback();}
  486. xywh {120 305 80 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11
  487. code0 {o->value(pars->Pbwscale);}
  488. code1 {if (pars->Pmode!=0) o->deactivate();}
  489. } {
  490. MenuItem {} {
  491. label Normal
  492. xywh {95 95 100 20} labelfont 1 labelsize 11
  493. }
  494. MenuItem {} {
  495. label EqualHz
  496. xywh {105 105 100 20} labelfont 1 labelsize 11
  497. }
  498. MenuItem {} {
  499. label Quater
  500. xywh {115 115 100 20} labelfont 1 labelsize 11
  501. }
  502. MenuItem {} {
  503. label Half
  504. xywh {125 125 100 20} labelfont 1 labelsize 11
  505. }
  506. MenuItem {} {
  507. label {75%}
  508. xywh {135 135 100 20} labelfont 1 labelsize 11
  509. }
  510. MenuItem {} {
  511. label {150%}
  512. xywh {145 145 100 20} labelfont 1 labelsize 11
  513. }
  514. MenuItem {} {
  515. label Double
  516. xywh {145 145 100 20} labelfont 1 labelsize 11
  517. }
  518. MenuItem {} {
  519. label {Inv.Half}
  520. xywh {155 155 100 20} labelfont 1 labelsize 11
  521. }
  522. }
  523. Fl_Group overtonepos {
  524. xywh {5 345 525 45} box FLAT_BOX color 51 selection_color 218 labelcolor 63
  525. code0 {PADnoteOvertonePosition *opui=new PADnoteOvertonePosition(o->x(),o->y(),o->w(),o->h(),"");}
  526. code1 {opui->init(pars,master);}
  527. } {}
  528. Fl_Choice qsamplesize {
  529. label {Sample Size}
  530. callback {pars->Pquality.samplesize=(int) o->value();
  531. cbwidget->do_callback();}
  532. xywh {375 190 115 20} down_box BORDER_BOX labelsize 10 align 5 textsize 11
  533. code0 {o->value(pars->Pquality.samplesize);}
  534. } {
  535. MenuItem {} {
  536. label {16k (Tiny)}
  537. xywh {155 155 100 20} labelfont 1 labelsize 11
  538. }
  539. MenuItem {} {
  540. label 32k
  541. xywh {165 165 100 20} labelfont 1 labelsize 11
  542. }
  543. MenuItem {} {
  544. label {64k (Small)}
  545. xywh {175 175 100 20} labelfont 1 labelsize 11
  546. }
  547. MenuItem {} {
  548. label 128k
  549. xywh {185 185 100 20} labelfont 1 labelsize 11
  550. }
  551. MenuItem {} {
  552. label {256k (Normal)}
  553. xywh {205 205 100 20} labelfont 1 labelsize 11
  554. }
  555. MenuItem {} {
  556. label 512k
  557. xywh {200 200 100 20} labelfont 1 labelsize 11
  558. }
  559. MenuItem {} {
  560. label {1M (Big)}
  561. xywh {205 205 100 20} labelfont 1 labelsize 11
  562. }
  563. }
  564. Fl_Choice qsmpoct {
  565. label {smp/oct}
  566. callback {pars->Pquality.smpoct=(int) o->value();
  567. cbwidget->do_callback();}
  568. xywh {430 155 45 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11
  569. code0 {o->value(pars->Pquality.smpoct);}
  570. } {
  571. MenuItem {} {
  572. label {0.5}
  573. xywh {10 10 100 20} labelfont 1 labelsize 11
  574. }
  575. MenuItem {} {
  576. label 1
  577. xywh {0 0 100 20} labelfont 1 labelsize 11
  578. }
  579. MenuItem {} {
  580. label 2
  581. xywh {10 10 100 20} labelfont 1 labelsize 11
  582. }
  583. MenuItem {} {
  584. label 3
  585. xywh {20 20 100 20} labelfont 1 labelsize 11
  586. }
  587. MenuItem {} {
  588. label 4
  589. xywh {30 30 100 20} labelfont 1 labelsize 11
  590. }
  591. MenuItem {} {
  592. label 6
  593. xywh {40 40 100 20} labelfont 1 labelsize 11
  594. }
  595. MenuItem {} {
  596. label 12
  597. xywh {50 50 100 20} labelfont 1 labelsize 11
  598. }
  599. }
  600. Fl_Choice qoct {
  601. label {no.oct}
  602. callback {pars->Pquality.oct=(int) o->value();
  603. cbwidget->do_callback();}
  604. xywh {480 155 45 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11
  605. code0 {o->value(pars->Pquality.oct);}
  606. } {
  607. MenuItem {} {
  608. label 1
  609. xywh {10 10 100 20} labelfont 1 labelsize 11
  610. }
  611. MenuItem {} {
  612. label 2
  613. xywh {20 20 100 20} labelfont 1 labelsize 11
  614. }
  615. MenuItem {} {
  616. label 3
  617. xywh {30 30 100 20} labelfont 1 labelsize 11
  618. }
  619. MenuItem {} {
  620. label 4
  621. xywh {40 40 100 20} labelfont 1 labelsize 11
  622. }
  623. MenuItem {} {
  624. label 5
  625. xywh {50 50 100 20} labelfont 1 labelsize 11
  626. }
  627. MenuItem {} {
  628. label 6
  629. xywh {60 60 100 20} labelfont 1 labelsize 11
  630. }
  631. MenuItem {} {
  632. label 7
  633. xywh {70 70 100 20} labelfont 1 labelsize 11
  634. }
  635. MenuItem {} {
  636. label 8
  637. xywh {80 80 100 20} labelfont 1 labelsize 11
  638. }
  639. }
  640. Fl_Choice qbasenote {
  641. label base
  642. callback {pars->Pquality.basenote=(int) o->value();
  643. cbwidget->do_callback();}
  644. xywh {375 155 50 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11
  645. code0 {o->value(pars->Pquality.basenote);}
  646. } {
  647. MenuItem {} {
  648. label {C-2}
  649. xywh {10 10 100 20} labelfont 1
  650. }
  651. MenuItem {} {
  652. label {G-2}
  653. xywh {20 20 100 20} labelfont 1
  654. }
  655. MenuItem {} {
  656. label {C-3}
  657. xywh {20 20 100 20} labelfont 1
  658. }
  659. MenuItem {} {
  660. label {G-3}
  661. xywh {30 30 100 20} labelfont 1
  662. }
  663. MenuItem {} {
  664. label {C-4}
  665. xywh {30 30 100 20} labelfont 1
  666. }
  667. MenuItem {} {
  668. label {G-4}
  669. xywh {40 40 100 20} labelfont 1
  670. }
  671. MenuItem {} {
  672. label {C-5}
  673. xywh {40 40 100 20} labelfont 1
  674. }
  675. MenuItem {} {
  676. label {G-5}
  677. xywh {50 50 100 20} labelfont 1
  678. }
  679. MenuItem {} {
  680. label {G-6}
  681. xywh {60 60 100 20} labelfont 1
  682. }
  683. }
  684. Fl_Group hprofile {
  685. xywh {100 45 430 90} box FLAT_BOX color 51 selection_color 218 labelcolor 63
  686. code0 {PADnoteHarmonicProfile *hpui=new PADnoteHarmonicProfile(o->x(),o->y(),o->w(),o->h(),"");}
  687. code1 {hpui->init(pars,master);}
  688. code2 {if (pars->Pmode!=0) { o->deactivate(); o->color(48);};}
  689. } {}
  690. Fl_Box {} {
  691. label {Profile of One Harmonic (Frequency Distribution)}
  692. xywh {160 25 315 20}
  693. }
  694. Fl_Choice spectrummode {
  695. label {Spectrum Mode}
  696. callback {pars->Pmode=(int) o->value();
  697. if (pars->Pmode==0){
  698. bwprofilegroup->activate();
  699. bwdial->activate();
  700. bwcents->activate();
  701. hprofile->activate();
  702. hprofile->color(54);
  703. bwscale->activate();
  704. } else {
  705. bwprofilegroup->deactivate();
  706. bwdial->deactivate();
  707. bwcents->deactivate();
  708. hprofile->deactivate();
  709. hprofile->color(48);
  710. bwscale->deactivate();
  711. };
  712. cbwidget->do_callback();}
  713. xywh {220 305 90 20} down_box BORDER_BOX labelfont 1 labelsize 10 align 5 textsize 11
  714. code0 {o->value(pars->Pmode);}
  715. } {
  716. MenuItem {} {
  717. label Bandwidth
  718. xywh {105 105 100 20} labelfont 1 labelsize 11
  719. }
  720. MenuItem {} {
  721. label Discrete
  722. xywh {125 125 100 20} labelfont 1 labelsize 11
  723. }
  724. MenuItem {} {
  725. label Continous
  726. xywh {115 115 100 20} labelfont 1 labelsize 11
  727. }
  728. }
  729. }
  730. Fl_Group {} {
  731. label {Envelopes&LFOs} open
  732. xywh {0 20 535 375} box UP_FRAME hide
  733. } {
  734. Fl_Group {} {
  735. label FREQUENCY
  736. xywh {5 275 525 115} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
  737. } {
  738. Fl_Group freqenv {
  739. label {PADSynth - Frequency Envelope} open
  740. xywh {10 315 205 70} box FLAT_BOX color 51 align 144
  741. code0 {o->init(pars->FreqEnvelope);}
  742. class EnvelopeUI
  743. } {}
  744. Fl_Counter octave {
  745. label Octave
  746. callback {int k=(int) o->value();
  747. if (k<0) k+=16;
  748. pars->PCoarseDetune = k*1024+
  749. pars->PCoarseDetune%1024;}
  750. tooltip Octave xywh {470 295 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11
  751. code0 {int k=pars->PCoarseDetune/1024;}
  752. code1 {if (k>=8) k-=16;}
  753. code2 {o->value(k);}
  754. }
  755. Fl_Counter coarsedet {
  756. label {Coarse det.}
  757. callback {int k=(int) o->value();
  758. if (k<0) k+=1024;
  759. pars->PCoarseDetune = k+
  760. (pars->PCoarseDetune/1024)*1024;}
  761. tooltip {Coarse Detune} xywh {455 365 70 20} type Simple labelsize 10 align 5 minimum -64 maximum 63 step 1 textfont 1 textsize 11
  762. code0 {int k=pars->PCoarseDetune%1024;}
  763. code1 {if (k>=512) k-=1024;}
  764. code2 {o->value(k);}
  765. code3 {o->lstep(10);}
  766. }
  767. Fl_Group freqlfo {
  768. label {Frequency LFO } open
  769. xywh {215 315 230 70} box FLAT_BOX color 47 align 144
  770. code0 {o->init(pars->FreqLfo);}
  771. class LFOUI
  772. } {}
  773. Fl_Slider detune {
  774. callback {pars->PDetune=(int)o->value()+8192;
  775. detunevalueoutput->do_callback();}
  776. tooltip {Fine Detune (cents)} xywh {60 295 295 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1
  777. code0 {o->value(pars->PDetune-8192);}
  778. }
  779. Fl_Value_Output detunevalueoutput {
  780. label Detune
  781. callback {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));}
  782. xywh {12 295 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10
  783. code0 {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));}
  784. }
  785. Fl_Choice detunetype {
  786. label {Detune Type}
  787. callback {pars->PDetuneType=(int) o->value()+1;
  788. detunevalueoutput->do_callback();} open
  789. xywh {450 330 75 20} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
  790. code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");}
  791. code1 {o->value(pars->PDetuneType-1);}
  792. } {}
  793. Fl_Check_Button hz440 {
  794. label 440Hz
  795. callback {int x=(int) o->value();
  796. pars->Pfixedfreq=x;
  797. if (x==0) fixedfreqetdial->deactivate();
  798. else fixedfreqetdial->activate();}
  799. tooltip {set the base frequency to 440Hz} xywh {365 295 50 15} down_box DOWN_BOX labelfont 1 labelsize 10
  800. code0 {o->value(pars->Pfixedfreq);}
  801. }
  802. Fl_Dial fixedfreqetdial {
  803. label {Eq.T.}
  804. callback {pars->PfixedfreqET=(int) o->value();}
  805. 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
  806. code0 {o->value(pars->PfixedfreqET);}
  807. code1 {if (pars->Pfixedfreq==0) o->deactivate();}
  808. class WidgetPDial
  809. }
  810. }
  811. Fl_Group {} {
  812. label AMPLITUDE
  813. xywh {5 25 240 250} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
  814. } {
  815. Fl_Value_Slider volume {
  816. label Vol
  817. callback {pars->PVolume=(int)o->value();}
  818. tooltip Volume xywh {10 50 160 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
  819. code0 {o->value(pars->PVolume);}
  820. }
  821. Fl_Value_Slider vsns {
  822. label {V.Sns}
  823. callback {pars->PAmpVelocityScaleFunction=(int) o->value();}
  824. 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
  825. code0 {o->value(pars->PAmpVelocityScaleFunction);}
  826. }
  827. Fl_Dial pan {
  828. label Pan
  829. callback {pars->PPanning=(int) o->value();}
  830. tooltip {Panning (leftmost is Random)} xywh {210 45 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  831. code0 {o->value(pars->PPanning);}
  832. class WidgetPDial
  833. }
  834. Fl_Dial pstr {
  835. label {P.Str.}
  836. callback {pars->PPunchStrength=(int) o->value();}
  837. tooltip {Punch Strength} xywh {125 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  838. code0 {o->value(pars->PPunchStrength);}
  839. class WidgetPDial
  840. }
  841. Fl_Dial pt {
  842. label {P.t.}
  843. callback {pars->PPunchTime=(int) o->value();}
  844. tooltip {Punch Time (duration)} xywh {155 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  845. code0 {o->value(pars->PPunchTime);}
  846. class WidgetPDial
  847. }
  848. Fl_Dial pstc {
  849. label {P.Stc.}
  850. callback {pars->PPunchStretch=(int) o->value();}
  851. tooltip {Punch Stretch} xywh {185 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  852. code0 {o->value(pars->PPunchStretch);}
  853. class WidgetPDial
  854. }
  855. Fl_Dial pvel {
  856. label {P.Vel.}
  857. callback {pars->PPunchVelocitySensing=(int) o->value();}
  858. tooltip {Punch Velocity Sensing} xywh {215 247 25 25} box ROUND_UP_BOX labelsize 10 align 1 maximum 127 step 1
  859. code0 {o->value(pars->PPunchVelocitySensing);}
  860. class WidgetPDial
  861. }
  862. Fl_Group ampenv {
  863. label {PADSynth - Amplitude Envelope} open
  864. xywh {10 95 205 70} box FLAT_BOX color 51 align 144
  865. code0 {o->init(pars->AmpEnvelope);}
  866. class EnvelopeUI
  867. } {}
  868. Fl_Group amplfo {
  869. label {Amplitude LFO } open
  870. xywh {10 165 230 70} box FLAT_BOX color 47 align 144
  871. code0 {o->init(pars->AmpLfo);}
  872. class LFOUI
  873. } {}
  874. Fl_Check_Button stereo {
  875. label Stereo
  876. callback {pars->PStereo=(int) o->value();
  877. hprofile->redraw();}
  878. xywh {15 245 70 25} down_box DOWN_BOX
  879. code0 {o->value(pars->PStereo);}
  880. }
  881. }
  882. Fl_Group {} {
  883. label FILTER
  884. xywh {245 25 285 250} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
  885. } {
  886. Fl_Group filterenv {
  887. label {PADSynth - Filter Envelope} open
  888. xywh {250 130 275 70} box FLAT_BOX color 51 align 144
  889. code0 {o->init(pars->FilterEnvelope);}
  890. class EnvelopeUI
  891. } {}
  892. Fl_Group filterlfo {
  893. label {Filter LFO } open
  894. xywh {250 200 230 70} box FLAT_BOX color 47 align 144
  895. code0 {o->init(pars->FilterLfo);}
  896. class LFOUI
  897. } {}
  898. Fl_Group filterui {
  899. label {PADsynth - Filter} open
  900. xywh {250 55 275 75} box FLAT_BOX color 50 align 144
  901. code0 {o->init(pars->GlobalFilter,&pars->PFilterVelocityScale,&pars->PFilterVelocityScaleFunction);}
  902. class FilterUI
  903. } {}
  904. }
  905. }
  906. }
  907. Fl_Button applybutton {
  908. label {Apply Changes}
  909. callback {pars->applyparameters(true);
  910. o->color(FL_GRAY);
  911. if (oscui!=NULL) {
  912. oscui->applybutton->color(FL_GRAY);
  913. oscui->applybutton->redraw();
  914. };
  915. if (resui!=NULL) {
  916. resui->applybutton->color(FL_GRAY);
  917. resui->applybutton->redraw();
  918. };}
  919. xywh {300 400 135 30} box THIN_UP_BOX
  920. code0 {o->color(FL_RED);}
  921. }
  922. Fl_Button {} {
  923. label Close
  924. callback {padnotewindow->hide();}
  925. xywh {440 400 90 30} box THIN_UP_BOX
  926. }
  927. Fl_Button {} {
  928. label C
  929. callback {presetsui->copy(pars);}
  930. xywh {65 400 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
  931. }
  932. Fl_Button {} {
  933. label P
  934. callback {presetsui->paste(pars,this);}
  935. xywh {95 400 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
  936. }
  937. Fl_Button {} {
  938. label export
  939. callback {char *filename;
  940. filename=fl_file_chooser("Export samples:","(*.wav)",NULL,0);
  941. if (filename==NULL) return;
  942. fl_filename_setext(filename,"");
  943. pars->export2wav(filename);}
  944. tooltip {export samples as wav file} xywh {5 400 55 30} box THIN_UP_BOX color 51 labelsize 11 align 128
  945. }
  946. }
  947. }
  948. Function {refresh()} {} {
  949. code {volume->value(pars->PVolume);
  950. vsns->value(pars->PAmpVelocityScaleFunction);
  951. pan->value(pars->PPanning);
  952. stereo->value(pars->PStereo);
  953. pstr->value(pars->PPunchStrength);
  954. pt->value(pars->PPunchTime);
  955. pstc->value(pars->PPunchStretch);
  956. pvel->value(pars->PPunchVelocitySensing);
  957. detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune));
  958. detune->value(pars->PDetune-8192);
  959. int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;
  960. octave->value(k);
  961. detunetype->value(pars->PDetuneType-1);
  962. k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;
  963. coarsedet->value(k);
  964. hz440->value(pars->Pfixedfreq);
  965. fixedfreqetdial->value(pars->PfixedfreqET);
  966. amplfo->refresh();
  967. freqlfo->refresh();
  968. filterlfo->refresh();
  969. ampenv->refresh();
  970. freqenv->refresh();
  971. filterenv->refresh();
  972. filterui->refresh();
  973. /* harmonic structure parametrs */
  974. resui->refresh();
  975. if (oscui!=NULL) oscui->refresh();
  976. hpbasetype->value(pars->Php.base.type);
  977. hpbasepar1->value(pars->Php.base.par1);
  978. hpfreqmult->value(pars->Php.freqmult);
  979. hpmpar1->value(pars->Php.modulator.par1);
  980. hpmfreq->value(pars->Php.modulator.freq);
  981. hpwidth->value(pars->Php.width);
  982. hponehalf->value(pars->Php.onehalf);
  983. hpamptype->value(pars->Php.amp.type);
  984. hpampmode->value(pars->Php.amp.mode);
  985. hpamppar1->value(pars->Php.amp.par1);
  986. hpamppar2->value(pars->Php.amp.par2);
  987. hpautoscale->value(pars->Php.autoscale);
  988. bwdial->value(pars->Pbandwidth);
  989. if (pars->Pmode==0){
  990. bwprofilegroup->activate();
  991. bwdial->activate();
  992. bwcents->activate();
  993. hprofile->activate();
  994. hprofile->color(54);
  995. bwscale->activate();
  996. } else {
  997. bwprofilegroup->deactivate();
  998. bwdial->deactivate();
  999. bwcents->deactivate();
  1000. hprofile->deactivate();
  1001. hprofile->color(48);
  1002. bwscale->activate();
  1003. };
  1004. spectrummode->value(pars->Pmode);
  1005. qbasenote->value(pars->Pquality.basenote);
  1006. qsmpoct->value(pars->Pquality.smpoct);
  1007. qoct->value(pars->Pquality.oct);
  1008. qsamplesize->value(pars->Pquality.samplesize);
  1009. hrpostype->value(pars->Phrpos.type);
  1010. hrpospar1->value(pars->Phrpos.par1);
  1011. hrpospar2->value(pars->Phrpos.par2);
  1012. hrpospar3->value(pars->Phrpos.par3);
  1013. hprofile->redraw();
  1014. overtonepos->redraw();
  1015. osc->redraw();
  1016. pars->applyparameters(true);
  1017. applybutton->color(FL_GRAY);
  1018. applybutton->parent()->redraw();} {}
  1019. }
  1020. Function {~PADnoteUI()} {} {
  1021. code {delete(oscui);
  1022. delete(resui);
  1023. padnotewindow->hide();
  1024. delete(padnotewindow);} {}
  1025. }
  1026. decl {PADnoteParameters *pars;} {public
  1027. }
  1028. decl {Master *master;} {public
  1029. }
  1030. decl {OscilEditor *oscui;} {public
  1031. }
  1032. decl {Oscilloscope *osc;} {public
  1033. }
  1034. decl {ResonanceUI *resui;} {public
  1035. }
  1036. }