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.

869 lines
25KB

  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0110
  3. header_name {.h}
  4. code_name {.cc}
  5. decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {}
  6. decl {//License: GNU GPL version 2 or later} {}
  7. decl {\#include "WidgetPDial.h"} {public
  8. }
  9. decl {\#include <stdio.h>} {public
  10. }
  11. decl {\#include <stdlib.h>} {public
  12. }
  13. decl {\#include "../globals.h"} {public
  14. }
  15. decl {\#include <FL/Fl_Group.H>} {public
  16. }
  17. decl {\#include "../Params/EnvelopeParams.h"} {public
  18. }
  19. decl {\#include <FL/Fl_Box.H>} {public
  20. }
  21. decl {\#include <FL/fl_draw.H>} {public
  22. }
  23. decl {\#include <FL/fl_ask.H>} {public
  24. }
  25. decl {\#include "PresetsUI.h"} {public
  26. }
  27. decl {\#include "common.H"} {public
  28. }
  29. class EnvelopeFreeEdit {: {public Fl_Box}
  30. } {
  31. Function {EnvelopeFreeEdit(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} {
  32. code {env=NULL;
  33. pair=NULL;} {}
  34. }
  35. Function {init(EnvelopeParams *env_)} {} {
  36. code {env=env_;
  37. oldx=-1;
  38. currentpoint=-1;
  39. cpx=0;
  40. lastpoint=-1;} {}
  41. }
  42. Function {setpair(Fl_Box *pair_)} {} {
  43. code {pair=pair_;} {}
  44. }
  45. Function {getpointx(int n)} {return_type int
  46. } {
  47. code {int lx=w()-10;
  48. int npoints=env->Penvpoints;
  49. float sum=0;
  50. for (int i=1;i<npoints;i++) sum+=env->getdt(i)+1;
  51. float sumbefore=0;//the sum of all points before the computed point
  52. for (int i=1;i<=n;i++) sumbefore+=env->getdt(i)+1;
  53. return((int) (sumbefore/(float) sum*lx));} {}
  54. }
  55. Function {getpointy(int n)} {return_type int
  56. } {
  57. code {int ly=h()-10;
  58. return((int) ((1.0-env->Penvval[n]/127.0)*ly));} {}
  59. }
  60. Function {getnearest(int x,int y)} {return_type int
  61. } {
  62. code {x-=5;y-=5;
  63. int nearestpoint=0;
  64. int nearestval=1000000;//a big value
  65. for (int i=0;i<env->Penvpoints;i++){
  66. int distance=abs(x-getpointx(i))+abs(y-getpointy(i));
  67. if (distance<nearestval) {
  68. nearestpoint=i;
  69. nearestval=distance;
  70. };
  71. };
  72. return(nearestpoint);} {}
  73. }
  74. Function {draw()} {private
  75. } {
  76. code {int ox=x(),oy=y(),lx=w(),ly=h();
  77. if (env->Pfreemode==0) env->converttofree();
  78. int npoints=env->Penvpoints;
  79. if (active_r()) fl_color(FL_BLACK);
  80. else fl_color(90,90,90);
  81. if (!active_r()) currentpoint=-1;
  82. fl_rectf(ox,oy,lx,ly);
  83. ox+=5;oy+=5;lx-=10;ly-=10;
  84. //draw the lines
  85. fl_color(FL_GRAY);
  86. fl_line_style(FL_SOLID);
  87. fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2);
  88. //draws the evelope points and lines
  89. Fl_Color alb=FL_WHITE;
  90. if (!active_r()) alb=fl_rgb_color(180,180,180);
  91. fl_color(alb);
  92. int oldxx=0,xx=0,oldyy=0,yy=getpointy(0);
  93. fl_rectf(ox-3,oy+yy-3,6,6);
  94. for (int i=1;i<npoints;i++){
  95. oldxx=xx;oldyy=yy;
  96. xx=getpointx(i);yy=getpointy(i);
  97. if (i==currentpoint) fl_color(FL_RED);
  98. else fl_color(alb);
  99. fl_line(ox+oldxx,oy+oldyy,ox+xx,oy+yy);
  100. fl_rectf(ox+xx-3,oy+yy-3,6,6);
  101. };
  102. //draw the last moved point point (if exists)
  103. if (lastpoint>=0){
  104. fl_color(FL_CYAN);
  105. fl_rectf(ox+getpointx(lastpoint)-5,oy+getpointy(lastpoint)-5,10,10);
  106. };
  107. //draw the sustain position
  108. if (env->Penvsustain>0){
  109. fl_color(FL_YELLOW);
  110. xx=getpointx(env->Penvsustain);
  111. fl_line(ox+xx,oy+0,ox+xx,oy+ly);
  112. };
  113. //Show the envelope duration and the current line duration
  114. fl_font(FL_HELVETICA|FL_BOLD,10);
  115. float time=0.0;
  116. if (currentpoint<=0){
  117. fl_color(alb);
  118. for (int i=1;i<npoints;i++) time+=env->getdt(i);
  119. } else {
  120. fl_color(255,0,0);
  121. time=env->getdt(currentpoint);
  122. };
  123. char tmpstr[20];
  124. if (time<1000.0) snprintf((char *)&tmpstr,20,"%.1fms",time);
  125. else snprintf((char *)&tmpstr,20,"%.2fs",time/1000.0);
  126. fl_draw(tmpstr,ox+lx-20,oy+ly-10,20,10,FL_ALIGN_RIGHT,NULL,0);} {}
  127. }
  128. Function {handle(int event)} {return_type int
  129. } {
  130. code {int x_=Fl::event_x()-x();
  131. int y_=Fl::event_y()-y();
  132. if (event==FL_PUSH) {
  133. currentpoint=getnearest(x_,y_);
  134. cpx=x_;
  135. cpdt=env->Penvdt[currentpoint];
  136. lastpoint=currentpoint;
  137. redraw();
  138. if (pair!=NULL) pair->redraw();
  139. };
  140. if (event==FL_RELEASE){
  141. currentpoint=-1;
  142. redraw();
  143. if (pair!=NULL) pair->redraw();
  144. };
  145. if ((event==FL_DRAG)&&(currentpoint>=0)){
  146. int ny=127-(int) (y_*127.0/h());
  147. if (ny<0) ny=0;if (ny>127) ny=127;
  148. env->Penvval[currentpoint]=ny;
  149. int dx=(int)((x_-cpx)*0.1);
  150. int newdt=cpdt+dx;
  151. if (newdt<0) newdt=0;if (newdt>127) newdt=127;
  152. if (currentpoint!=0) env->Penvdt[currentpoint]=newdt;
  153. else env->Penvdt[currentpoint]=0;
  154. redraw();
  155. if (pair!=NULL) pair->redraw();
  156. };
  157. return(1);} {}
  158. }
  159. decl {Fl_Box *pair;} {}
  160. decl {EnvelopeParams *env;} {}
  161. decl {int oldx,oldy;} {}
  162. decl {int currentpoint,cpx,cpdt;} {}
  163. decl {int lastpoint;} {public
  164. }
  165. }
  166. class EnvelopeUI {open : {public Fl_Group,PresetsUI_}
  167. } {
  168. Function {EnvelopeUI(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
  169. code {env=NULL;
  170. freemodeeditwindow=NULL;
  171. envADSR=NULL;
  172. envASR=NULL;
  173. envADSRfilter=NULL;
  174. envASRbw=NULL;
  175. envfree=NULL;} {}
  176. }
  177. Function {~EnvelopeUI()} {} {
  178. code {envwindow->hide();
  179. hide();
  180. freemodeeditwindow->hide();
  181. delete (freemodeeditwindow);} {}
  182. }
  183. Function {make_freemode_edit_window()} {open
  184. } {
  185. Fl_Window freemodeeditwindow {
  186. label Envelope
  187. xywh {702 269 575 180} type Double visible
  188. } {
  189. Fl_Box freeedit {
  190. label Envelope
  191. xywh {5 5 565 145} box FLAT_BOX color 0
  192. code0 {o->init(env);}
  193. class EnvelopeFreeEdit
  194. }
  195. Fl_Button addpoint {
  196. label {Add point}
  197. callback {int curpoint=freeedit->lastpoint;
  198. if (curpoint<0) return;
  199. //if (curpoint>=env->Penvpoints-1) return;
  200. if (env->Penvpoints>=MAX_ENVELOPE_POINTS) return;
  201. for (int i=env->Penvpoints;i>=curpoint+1;i--){
  202. env->Penvdt[i]=env->Penvdt[i-1];
  203. env->Penvval[i]=env->Penvval[i-1];
  204. };
  205. if (curpoint==0) {
  206. env->Penvdt[1]=64;
  207. };
  208. env->Penvpoints++;
  209. if (curpoint<=env->Penvsustain) env->Penvsustain++;
  210. freeedit->lastpoint+=1;
  211. freeedit->redraw();
  212. envfree->redraw();
  213. sustaincounter->value(env->Penvsustain);
  214. sustaincounter->maximum(env->Penvpoints-2);}
  215. xywh {115 155 80 20} box THIN_UP_BOX labelsize 11
  216. code0 {if (env->Pfreemode==0) o->hide();}
  217. }
  218. Fl_Button deletepoint {
  219. label {Delete point}
  220. callback {int curpoint=freeedit->lastpoint;
  221. if (curpoint<1) return;
  222. if (curpoint>=env->Penvpoints-1) return;
  223. if (env->Penvpoints<=3) return;
  224. for (int i=curpoint+1;i<env->Penvpoints;i++){
  225. env->Penvdt[i-1]=env->Penvdt[i];
  226. env->Penvval[i-1]=env->Penvval[i];
  227. };
  228. env->Penvpoints--;
  229. if (curpoint<=env->Penvsustain) env->Penvsustain--;
  230. freeedit->lastpoint-=1;
  231. freeedit->redraw();
  232. envfree->redraw();
  233. sustaincounter->value(env->Penvsustain);
  234. sustaincounter->maximum(env->Penvpoints-2);}
  235. xywh {200 155 80 20} box THIN_UP_BOX labelsize 11
  236. code0 {if (env->Pfreemode==0) o->hide();}
  237. }
  238. Fl_Light_Button freemodebutton {
  239. label FreeMode
  240. callback {reinit();
  241. freeedit->lastpoint=-1;
  242. freeedit->redraw();}
  243. tooltip {Enable or disable the freemode} xywh {10 155 95 20} labelsize 11
  244. }
  245. Fl_Check_Button forcedreleasecheck {
  246. label frcR
  247. callback {env->Pforcedrelease=(int)o->value();}
  248. tooltip {Forced Relase} xywh {410 165 40 15} down_box DOWN_BOX labelsize 10
  249. code0 {o->value(env->Pforcedrelease);}
  250. code1 {if (env->Pfreemode==0) o->hide();}
  251. }
  252. Fl_Dial envstretchdial {
  253. label {Str.}
  254. callback {env->Penvstretch=(int)o->value();}
  255. tooltip {Envelope stretch (on lower notes make the envelope longer)} xywh {380 155 25 25} box ROUND_UP_BOX labelsize 10 align 4 maximum 127 step 1
  256. code0 {o->value(env->Penvstretch);}
  257. code1 {if (env->Pfreemode==0) o->hide();}
  258. class WidgetPDial
  259. }
  260. Fl_Button {} {
  261. label Close
  262. callback {freemodeeditwindow->hide();}
  263. xywh {510 155 60 20} box THIN_UP_BOX
  264. }
  265. Fl_Check_Button linearenvelopecheck {
  266. label L
  267. callback {env->Plinearenvelope=(int)o->value();}
  268. tooltip {Linear Envelope} xywh {410 151 30 15} down_box DOWN_BOX labelsize 10
  269. code0 {o->value(env->Plinearenvelope);}
  270. code1 {if ((env->Pfreemode==0)||(env->Envmode>2)) o->hide();}
  271. }
  272. Fl_Counter sustaincounter {
  273. label Sust
  274. callback {env->Penvsustain=(int) o->value();
  275. freeedit->redraw();
  276. envfree->redraw();}
  277. tooltip {Sustain (0 is disabled)} xywh {315 155 40 15} type Simple labelsize 11 align 4 minimum 0 maximum 127 step 1
  278. code0 {o->value(env->Penvsustain);}
  279. code1 {if (env->Pfreemode==0) o->hide();}
  280. code2 {o->maximum(env->Penvpoints-2);}
  281. }
  282. Fl_Button {} {
  283. label C
  284. callback {presetsui->copy(env);}
  285. xywh {465 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  286. }
  287. Fl_Button {} {
  288. label P
  289. callback {presetsui->paste(env,this);}
  290. xywh {482 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  291. }
  292. }
  293. }
  294. Function {make_ADSR_window()} {open
  295. } {
  296. Fl_Window envADSR {open
  297. xywh {344 788 205 70} type Double color 50 labelfont 1
  298. class Fl_Group visible
  299. } {
  300. Fl_Group {} {
  301. label {Amplitude Envelope}
  302. xywh {0 0 205 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17
  303. code0 {set_module_parameters(o);}
  304. } {
  305. Fl_Dial e1adt {
  306. label {A.dt}
  307. callback {env->PA_dt=(int)o->value();
  308. freeedit->redraw();}
  309. tooltip {Attack time} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  310. code0 {o->value(env->PA_dt);}
  311. class WidgetPDial
  312. }
  313. Fl_Dial e1ddt {
  314. label {D.dt}
  315. callback {env->PD_dt=(int)o->value();
  316. freeedit->redraw();}
  317. tooltip {Decay time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  318. code0 {o->value(env->PD_dt);}
  319. class WidgetPDial
  320. }
  321. Fl_Dial e1rdt {
  322. label {R.dt}
  323. callback {env->PR_dt=(int)o->value();
  324. freeedit->redraw();}
  325. tooltip {Release time} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  326. code0 {o->value(env->PR_dt);}
  327. class WidgetPDial
  328. }
  329. Fl_Dial e1sval {
  330. label {S.val}
  331. callback {env->PS_val=(int)o->value();
  332. freeedit->redraw();}
  333. tooltip {Sustain value} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  334. code0 {o->value(env->PS_val);}
  335. class WidgetPDial
  336. }
  337. Fl_Check_Button e1forcedrelease {
  338. label frcR
  339. callback {env->Pforcedrelease=(int)o->value();}
  340. tooltip {Forced Relase} xywh {180 35 20 15} down_box DOWN_BOX labelsize 10 align 6
  341. code0 {o->value(env->Pforcedrelease);}
  342. }
  343. Fl_Dial e1envstretch {
  344. label Stretch
  345. callback {env->Penvstretch=(int)o->value();}
  346. tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  347. code0 {o->value(env->Penvstretch);}
  348. class WidgetPDial
  349. }
  350. Fl_Button {} {
  351. label E
  352. callback {freemodeeditwindow->show();}
  353. tooltip {Envelope window} xywh {185 5 15 15} labelfont 1 labelsize 10
  354. }
  355. Fl_Check_Button e1linearenvelope {
  356. label L
  357. callback {env->Plinearenvelope=(int)o->value();}
  358. tooltip {The evelope is linear} xywh {180 20 15 15} down_box DOWN_BOX labelsize 10 align 4
  359. code0 {o->value(env->Plinearenvelope);}
  360. }
  361. Fl_Button {} {
  362. label C
  363. callback {presetsui->copy(env);}
  364. xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  365. }
  366. Fl_Button {} {
  367. label P
  368. callback {presetsui->paste(env,this);}
  369. xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  370. }
  371. }
  372. }
  373. }
  374. Function {make_ASR_window()} {open
  375. } {
  376. Fl_Window envASR {open
  377. xywh {648 667 210 70} type Double
  378. class Fl_Group visible
  379. } {
  380. Fl_Group {} {
  381. label {Frequency Envelope}
  382. xywh {0 0 210 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17
  383. code0 {set_module_parameters(o);}
  384. } {
  385. Fl_Dial e2aval {
  386. label {A.val}
  387. callback {env->PA_val=(int)o->value();
  388. freeedit->redraw();}
  389. tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  390. code0 {o->value(env->PA_val);}
  391. class WidgetPDial
  392. }
  393. Fl_Dial e2adt {
  394. label {A.dt}
  395. callback {env->PA_dt=(int)o->value();
  396. freeedit->redraw();}
  397. tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  398. code0 {o->value(env->PA_dt);}
  399. class WidgetPDial
  400. }
  401. Fl_Dial e2rval {
  402. label {R.val}
  403. callback {env->PR_val=(int)o->value();
  404. freeedit->redraw();}
  405. tooltip {Release value} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  406. code0 {o->value(env->PR_val);}
  407. class WidgetPDial
  408. }
  409. Fl_Dial e2rdt {
  410. label {R.dt}
  411. callback {env->PR_dt=(int)o->value();
  412. freeedit->redraw();}
  413. tooltip {Release time} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  414. code0 {o->value(env->PR_dt);}
  415. class WidgetPDial
  416. }
  417. Fl_Dial e2envstretch {
  418. label Stretch
  419. callback {env->Penvstretch=(int)o->value();}
  420. tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  421. code0 {o->value(env->Penvstretch);}
  422. class WidgetPDial
  423. }
  424. Fl_Check_Button e2forcedrelease {
  425. label frcR
  426. callback {env->Pforcedrelease=(int)o->value();}
  427. tooltip {Forced release} xywh {180 25 15 25} down_box DOWN_BOX labelsize 10 align 6
  428. code0 {o->value(env->Pforcedrelease);}
  429. }
  430. Fl_Button {} {
  431. label C
  432. callback {presetsui->copy(env);}
  433. xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  434. }
  435. Fl_Button {} {
  436. label P
  437. callback {presetsui->paste(env,this);}
  438. xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  439. }
  440. }
  441. Fl_Button {} {
  442. label E
  443. callback {freemodeeditwindow->show();}
  444. tooltip {Envelope window} xywh {190 5 15 15} labelfont 1 labelsize 10
  445. }
  446. }
  447. }
  448. Function {make_ADSRfilter_window()} {open
  449. } {
  450. Fl_Window envADSRfilter {open selected
  451. xywh {627 569 275 70} type Double color 50 labelfont 1
  452. class Fl_Group visible
  453. } {
  454. Fl_Group {} {
  455. label {Filter Envelope}
  456. xywh {0 0 275 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17
  457. code0 {set_module_parameters(o);}
  458. } {
  459. Fl_Dial e3aval {
  460. label {A.val}
  461. callback {env->PA_val=(int)o->value();
  462. freeedit->redraw();}
  463. tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  464. code0 {o->value(env->PA_val);}
  465. class WidgetPDial
  466. }
  467. Fl_Dial e3adt {
  468. label {A.dt}
  469. callback {env->PA_dt=(int)o->value();
  470. freeedit->redraw();}
  471. tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  472. code0 {o->value(env->PA_dt);}
  473. class WidgetPDial
  474. }
  475. Fl_Dial e3dval {
  476. label {D.val}
  477. callback {env->PD_val=(int)o->value();
  478. freeedit->redraw();}
  479. tooltip {decay value} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  480. code0 {o->value(env->PD_val);}
  481. class WidgetPDial
  482. }
  483. Fl_Dial e3ddt {
  484. label {D.dt}
  485. callback {env->PD_dt=(int)o->value();
  486. freeedit->redraw();}
  487. tooltip {decay time} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  488. code0 {o->value(env->PD_dt);}
  489. class WidgetPDial
  490. }
  491. Fl_Dial e3rdt {
  492. label {R.dt}
  493. callback {env->PR_dt=(int)o->value();
  494. freeedit->redraw();}
  495. tooltip {Release time} xywh {145 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  496. code0 {o->value(env->PR_dt);}
  497. class WidgetPDial
  498. }
  499. Fl_Dial e3rval {
  500. label {R.val}
  501. callback {env->PR_val=(int)o->value();
  502. freeedit->redraw();}
  503. tooltip {Release value} xywh {180 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  504. code0 {o->value(env->PR_val);}
  505. class WidgetPDial
  506. }
  507. Fl_Dial e3envstretch {
  508. label Stretch
  509. callback {env->Penvstretch=(int)o->value();}
  510. tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {215 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  511. code0 {o->value(env->Penvstretch);}
  512. class WidgetPDial
  513. }
  514. Fl_Check_Button e3forcedrelease {
  515. label frcR
  516. callback {env->Pforcedrelease=(int)o->value();}
  517. tooltip {Forced Relase} xywh {250 30 15 20} down_box DOWN_BOX labelsize 10 align 6
  518. code0 {o->value(env->Pforcedrelease);}
  519. }
  520. Fl_Button {} {
  521. label E
  522. callback {freemodeeditwindow->show();}
  523. xywh {255 5 15 15} labelfont 1 labelsize 10
  524. }
  525. Fl_Button {} {
  526. label C
  527. callback {presetsui->copy(env);}
  528. xywh {220 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  529. }
  530. Fl_Button {} {
  531. label P
  532. callback {presetsui->paste(env,this);}
  533. xywh {237 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  534. }
  535. }
  536. }
  537. }
  538. Function {make_ASRbw_window()} {open
  539. } {
  540. Fl_Window envASRbw {open
  541. xywh {362 642 210 70} type Double
  542. code0 {set_module_parameters(o);}
  543. class Fl_Group visible
  544. } {
  545. Fl_Group {} {
  546. label {BandWidth Envelope}
  547. xywh {0 0 210 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17
  548. code0 {set_module_parameters(o);}
  549. } {
  550. Fl_Dial e4aval {
  551. label {A.val}
  552. callback {env->PA_val=(int)o->value();
  553. freeedit->redraw();}
  554. tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  555. code0 {o->value(env->PA_val);}
  556. class WidgetPDial
  557. }
  558. Fl_Dial e4adt {
  559. label {A.dt}
  560. callback {env->PA_dt=(int)o->value();
  561. freeedit->redraw();}
  562. tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  563. code0 {o->value(env->PA_dt);}
  564. class WidgetPDial
  565. }
  566. Fl_Dial e4rval {
  567. label {R.val}
  568. callback {env->PR_val=(int)o->value();
  569. freeedit->redraw();}
  570. tooltip {Release value} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  571. code0 {o->value(env->PR_val);}
  572. class WidgetPDial
  573. }
  574. Fl_Dial e4rdt {
  575. label {R.dt}
  576. callback {env->PR_dt=(int)o->value();
  577. freeedit->redraw();}
  578. tooltip {Release time} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  579. code0 {o->value(env->PR_dt);}
  580. class WidgetPDial
  581. }
  582. Fl_Dial e4envstretch {
  583. label Stretch
  584. callback {env->Penvstretch=(int)o->value();}
  585. tooltip {Envelope stretch (on lower notes makes the envelope longer)} xywh {145 25 25 25} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  586. code0 {o->value(env->Penvstretch);}
  587. class WidgetPDial
  588. }
  589. Fl_Check_Button e4forcedrelease {
  590. label frcR
  591. callback {env->Pforcedrelease=(int)o->value();}
  592. tooltip {Forced release} xywh {180 25 15 25} down_box DOWN_BOX labelsize 10 align 6
  593. code0 {o->value(env->Pforcedrelease);}
  594. }
  595. Fl_Button {} {
  596. label C
  597. callback {presetsui->copy(env);}
  598. xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  599. }
  600. Fl_Button {} {
  601. label P
  602. callback {presetsui->paste(env,this);}
  603. xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  604. }
  605. }
  606. Fl_Button {} {
  607. label E
  608. callback {freemodeeditwindow->show();}
  609. xywh {190 5 15 15} labelfont 1 labelsize 10
  610. }
  611. }
  612. }
  613. Function {make_free_window()} {open
  614. } {
  615. Fl_Window envfree {open
  616. xywh {376 436 205 70} type Double color 50 labelfont 1 resizable
  617. code0 {set_module_parameters(o);}
  618. class Fl_Group visible
  619. } {
  620. Fl_Group envfreegroup {
  621. label {Amplitude Envelope}
  622. xywh {0 0 205 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 resizable
  623. code0 {set_module_parameters(o);}
  624. } {
  625. Fl_Box freeeditsmall {
  626. label Envelope
  627. callback {envfree->redraw();}
  628. xywh {5 20 195 45} box FLAT_BOX color 0 resizable
  629. code0 {o->init(env);}
  630. class EnvelopeFreeEdit
  631. }
  632. Fl_Button {} {
  633. label E
  634. callback {freemodeeditwindow->show();}
  635. xywh {185 5 15 15} labelfont 1 labelsize 10
  636. }
  637. Fl_Button {} {
  638. label C
  639. callback {presetsui->copy(env);}
  640. xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  641. }
  642. Fl_Button {} {
  643. label P
  644. callback {presetsui->paste(env,this);}
  645. xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  646. }
  647. }
  648. }
  649. }
  650. Function {init(EnvelopeParams *env_)} {open
  651. } {
  652. code {env=env_;
  653. make_ADSR_window();
  654. make_ASR_window();
  655. make_ADSRfilter_window();
  656. make_ASRbw_window();
  657. make_free_window();
  658. make_freemode_edit_window();
  659. envwindow=NULL;
  660. if (env->Envmode==3) envfreegroup->label("Frequency Envelope");
  661. if (env->Envmode==4) envfreegroup->label("Filter Envelope");
  662. if (env->Envmode==5) envfreegroup->label("Bandwidth Envelope");
  663. freemodeeditwindow->label(this->label());
  664. freeeditsmall->setpair(freeedit);
  665. freeedit->setpair(freeeditsmall);
  666. refresh();} {}
  667. }
  668. Function {reinit()} {} {
  669. code {if (env->Pfreemode!=0){
  670. int answer=fl_choice("Disable the free mode of the Envelope?","No","Yes",NULL);
  671. if (env->Pfreemode!=0) freemodebutton->value(1);
  672. else freemodebutton->value(0);
  673. if (answer==0) return;
  674. };
  675. if (env->Pfreemode==0) env->Pfreemode=1;
  676. else env->Pfreemode=0;
  677. hide();
  678. int winx=freemodeeditwindow->x();
  679. int winy=freemodeeditwindow->y();
  680. freemodeeditwindow->hide();
  681. envwindow->hide();
  682. Fl_Group *par=envwindow->parent();
  683. par->hide();
  684. refresh();
  685. envwindow->show();
  686. par->redraw();
  687. par->show();
  688. show();
  689. freemodeeditwindow->position(winx,winy);
  690. freemodeeditwindow->show();
  691. if (env->Pfreemode!=0) {
  692. freemodebutton->value(1);
  693. addpoint->show();
  694. deletepoint->show();
  695. forcedreleasecheck->show();
  696. }else{
  697. freemodebutton->value(0);
  698. addpoint->hide();
  699. deletepoint->hide();
  700. forcedreleasecheck->hide();
  701. };} {}
  702. }
  703. Function {refresh()} {open
  704. } {
  705. code {freemodebutton->value(env->Pfreemode);
  706. sustaincounter->value(env->Penvsustain);
  707. if (env->Pfreemode==0) sustaincounter->hide();
  708. else sustaincounter->show();
  709. sustaincounter->maximum(env->Penvpoints-2);
  710. envstretchdial->value(env->Penvstretch);
  711. if (env->Pfreemode==0) envstretchdial->hide();
  712. else envstretchdial->show();
  713. linearenvelopecheck->value(env->Plinearenvelope);
  714. if ((env->Pfreemode==0)||(env->Envmode>2)) linearenvelopecheck->hide();
  715. else linearenvelopecheck->show();
  716. forcedreleasecheck->value(env->Pforcedrelease);
  717. if (env->Pfreemode==0) forcedreleasecheck->hide();
  718. freeedit->redraw();
  719. if (env->Pfreemode==0){
  720. switch(env->Envmode){
  721. case(1):
  722. case(2):
  723. e1adt->value(env->PA_dt);
  724. e1ddt->value(env->PD_dt);
  725. e1sval->value(env->PS_val);
  726. e1rdt->value(env->PR_dt);
  727. e1envstretch->value(env->Penvstretch);
  728. e1linearenvelope->value(env->Plinearenvelope);
  729. e1forcedrelease->value(env->Pforcedrelease);
  730. break;
  731. case(3):
  732. e2aval->value(env->PA_val);
  733. e2adt->value(env->PA_dt);
  734. e2rdt->value(env->PR_dt);
  735. e2rval->value(env->PR_val);
  736. e2envstretch->value(env->Penvstretch);
  737. e2forcedrelease->value(env->Pforcedrelease);
  738. break;
  739. case(4):
  740. e3aval->value(env->PA_val);
  741. e3adt->value(env->PA_dt);
  742. e3dval->value(env->PD_val);
  743. e3ddt->value(env->PD_dt);
  744. e3rdt->value(env->PR_dt);
  745. e3rval->value(env->PR_val);
  746. e3envstretch->value(env->Penvstretch);
  747. e3forcedrelease->value(env->Pforcedrelease);
  748. break;
  749. case(5):
  750. e4aval->value(env->PA_val);
  751. e4adt->value(env->PA_dt);
  752. e4rdt->value(env->PR_dt);
  753. e4rval->value(env->PR_val);
  754. e4envstretch->value(env->Penvstretch);
  755. e4forcedrelease->value(env->Pforcedrelease);
  756. break;
  757. default:
  758. break;
  759. };
  760. }else{
  761. envfree->redraw();
  762. };
  763. envADSR->hide();
  764. envASR->hide();
  765. envADSRfilter->hide();
  766. envASRbw->hide();
  767. envfree->hide();
  768. if (env->Pfreemode==0){
  769. switch(env->Envmode){
  770. case(1):
  771. case(2):
  772. envwindow=envADSR;
  773. break;
  774. case(3):
  775. envwindow=envASR;
  776. break;
  777. case(4):
  778. envwindow=envADSRfilter;
  779. break;
  780. case(5):
  781. envwindow=envASRbw;
  782. break;
  783. default:
  784. break;
  785. };
  786. }else{
  787. envwindow=envfree;
  788. };
  789. envwindow->resize(this->x(),this->y(),this->w(),this->h());
  790. envwindow->show();} {}
  791. }
  792. decl {EnvelopeParams *env;} {}
  793. decl {Fl_Group *envwindow;} {}
  794. }