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.

EnvelopeUI.fl 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0302
  3. header_name {.h}
  4. code_name {.cc}
  5. decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {private local
  6. }
  7. decl {//License: GNU GPL version 2 or later} {private local
  8. }
  9. decl {\#include "Fl_Osc_Dial.H"} {public local
  10. }
  11. decl {\#include "Fl_Osc_Check.H"} {public local
  12. }
  13. decl {\#include "Fl_Osc_Button.H"} {public local
  14. }
  15. decl {\#include "Fl_Osc_Counter.H"} {public local
  16. }
  17. decl {\#include <stdio.h>} {public local
  18. }
  19. decl {\#include <stdlib.h>} {public local
  20. }
  21. decl {\#include "../globals.h"} {public local
  22. }
  23. decl {\#include <FL/Fl_Group.H>} {public local
  24. }
  25. decl {\#include "../Params/EnvelopeParams.h"} {public local
  26. }
  27. decl {\#include <FL/Fl_Box.H>} {public local
  28. }
  29. decl {\#include <FL/fl_draw.H>} {public local
  30. }
  31. decl {\#include <FL/fl_ask.H>} {public local
  32. }
  33. decl {\#include "PresetsUI.h"} {public local
  34. }
  35. decl {\#include "common.H"} {public local
  36. }
  37. decl {\#include "EnvelopeFreeEdit.h"} {public local
  38. }
  39. class EnvelopeUI {open : {public Fl_Osc_Group,PresetsUI_}
  40. } {
  41. Function {EnvelopeUI(int x,int y, int w, int h, const char *label=0):Fl_Osc_Group(x,y,w,h,label)} {} {
  42. code {freemodeeditwindow=NULL;
  43. envADSR=NULL;
  44. envASR=NULL;
  45. envADSRfilter=NULL;
  46. envASRbw=NULL;
  47. envfree=NULL;} {}
  48. }
  49. Function {~EnvelopeUI()} {} {
  50. code {envwindow->hide();
  51. hide();
  52. freemodeeditwindow->hide();
  53. delete (freemodeeditwindow);} {}
  54. }
  55. Function {make_freemode_edit_window()} {open
  56. } {
  57. Fl_Window freemodeeditwindow {
  58. label Envelope open
  59. xywh {702 801 575 180} type Double
  60. class Fl_Osc_Window visible
  61. } {
  62. Fl_Button {} {
  63. label C
  64. callback {presetsui->copy(freemodeeditwindow->loc());}
  65. xywh {465 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  66. code0 {freemodeeditwindow->osc = osc; freemodeeditwindow->base = loc();}
  67. }
  68. Fl_Button {} {
  69. label P
  70. callback {presetsui->paste(freemodeeditwindow->loc(),this);}
  71. xywh {482 160 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  72. }
  73. Fl_Button addpoint {
  74. label {Add point}
  75. callback {
  76. if(freeedit->lastpoint >= MAX_ENVELOPE_POINTS - 1)
  77. return;
  78. o->oscWrite("addPoint", "i", freeedit->lastpoint);
  79. freeedit->lastpoint+=1;
  80. freeedit->update();
  81. envfree->redraw();
  82. sustaincounter->update();
  83. //sustaincounter->value(Penvsustain);
  84. //sustaincounter->maximum(Penvpoints-2);}
  85. xywh {115 155 80 20} box THIN_UP_BOX labelsize 11
  86. code0 {(void)o;//if (Pfreemode==0) o->hide();}
  87. class Fl_Osc_Button
  88. }
  89. Fl_Box freeedit {
  90. label Envelope
  91. callback {sustaincounter->maximum(o->Penvpoints-2);}
  92. xywh {5 5 565 145} box FLAT_BOX color 0
  93. code0 {o->init();}
  94. class EnvelopeFreeEdit
  95. }
  96. Fl_Button deletepoint {
  97. label {Delete point}
  98. callback {o->oscWrite("delPoint", "i", freeedit->lastpoint);
  99. freeedit->lastpoint-=1;
  100. freeedit->update();
  101. envfree->redraw();
  102. sustaincounter->update();
  103. //sustaincounter->value(Penvsustain);
  104. //sustaincounter->maximum(Penvpoints-2);}
  105. xywh {200 155 80 20} box THIN_UP_BOX labelsize 11
  106. code0 {(void)o;//if (Pfreemode==0) o->hide();}
  107. class Fl_Osc_Button
  108. }
  109. Fl_Check_Button freemodebutton {
  110. label FreeMode
  111. callback {reinit();
  112. freeedit->lastpoint=-1;
  113. freeedit->redraw();}
  114. tooltip {Enable or disable the freemode} xywh {10 155 95 20} labelsize 11
  115. }
  116. Fl_Check_Button forcedreleasecheck {
  117. label frcR
  118. tooltip {Forced Release} xywh {410 165 40 15} down_box DOWN_BOX labelsize 10
  119. code0 {o->init("Pforcedrelease");}
  120. code1 {//TODO if (Pfreemode==0) o->hide();}
  121. class Fl_Osc_Check
  122. }
  123. Fl_Dial envstretchdial {
  124. label {Str.}
  125. 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
  126. code0 {o->init("Penvstretch");}
  127. code1 {//TODO if (Pfreemode==0) o->hide();}
  128. class Fl_Osc_Dial
  129. }
  130. Fl_Button {} {
  131. label Close
  132. callback {freemodeeditwindow->hide();}
  133. xywh {510 155 60 20} box THIN_UP_BOX
  134. }
  135. Fl_Check_Button linearenvelopecheck {
  136. label L
  137. tooltip {Linear Envelope} xywh {410 151 30 15} down_box DOWN_BOX labelsize 10
  138. code0 {o->init("Plinearenvelope");}
  139. code1 {//TODO if ((Pfreemode==0)||(Envmode>2)) o->hide();}
  140. class Fl_Osc_Check
  141. }
  142. Fl_Counter sustaincounter {
  143. label Sust
  144. callback {freeedit->redraw();
  145. envfree->redraw();}
  146. tooltip {Sustain (0 is disabled)} xywh {315 155 40 15} type Simple labelsize 11 align 4 minimum 0 maximum 127 step 1
  147. code3 {o->init("Penvsustain");}
  148. class Fl_Osc_Counter
  149. }
  150. }
  151. }
  152. Function {make_ADSR_window()} {} {
  153. Fl_Window envADSR {open
  154. xywh {353 911 205 70} type Double color 50 labelfont 1
  155. class Fl_Osc_Group visible
  156. } {
  157. Fl_Group {} {
  158. label {Amplitude Envelope}
  159. xywh {0 0 205 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17
  160. code0 {set_module_parameters(o);}
  161. } {
  162. Fl_Button {} {
  163. label C
  164. callback {presetsui->copy(envADSR->loc());}
  165. xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  166. }
  167. Fl_Button {} {
  168. label P
  169. callback {presetsui->paste(envADSR->loc(),this);}
  170. xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  171. }
  172. Fl_Dial e1adt {
  173. label {A.dt}
  174. callback {freeedit->redraw();}
  175. tooltip {Attack time} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  176. code0 {o->init("PA_dt");}
  177. class Fl_Osc_Dial
  178. }
  179. Fl_Dial e1ddt {
  180. label {D.dt}
  181. callback {freeedit->redraw();}
  182. tooltip {Decay time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  183. code0 {o->init("PD_dt");}
  184. class Fl_Osc_Dial
  185. }
  186. Fl_Dial e1rdt {
  187. label {R.dt}
  188. callback {freeedit->redraw();}
  189. tooltip {Release time} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  190. code0 {o->init("PR_dt");}
  191. class Fl_Osc_Dial
  192. }
  193. Fl_Dial e1sval {
  194. label {S.val}
  195. callback {freeedit->redraw();}
  196. tooltip {Sustain value} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  197. code0 {o->init("PS_val");}
  198. class Fl_Osc_Dial
  199. }
  200. Fl_Check_Button e1forcedrelease {
  201. label frcR
  202. tooltip {Forced Release} xywh {180 35 20 15} down_box DOWN_BOX labelsize 10 align 6
  203. code0 {o->init("Pforcedrelease");}
  204. class Fl_Osc_Check
  205. }
  206. Fl_Dial e1envstretch {
  207. label Stretch
  208. 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
  209. code0 {o->init("Penvstretch");}
  210. class Fl_Osc_Dial
  211. }
  212. Fl_Button {} {
  213. label E
  214. callback {freemodeeditwindow->show();}
  215. tooltip {Envelope window} xywh {185 5 15 15} labelfont 1 labelsize 10
  216. }
  217. Fl_Check_Button e1linearenvelope {
  218. label L
  219. tooltip {The evelope is linear} xywh {180 20 15 15} down_box DOWN_BOX labelsize 10 align 4
  220. code0 {o->init("Plinearenvelope");}
  221. class Fl_Osc_Check
  222. }
  223. }
  224. }
  225. }
  226. Function {make_ASR_window()} {} {
  227. Fl_Window envASR {open
  228. xywh {1067 911 210 70} type Double
  229. class Fl_Osc_Group visible
  230. } {
  231. Fl_Group {} {
  232. label {Frequency Envelope}
  233. xywh {0 0 210 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17
  234. code0 {set_module_parameters(o);}
  235. } {
  236. Fl_Button {} {
  237. label C
  238. callback {presetsui->copy(envASR->loc());}
  239. xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  240. }
  241. Fl_Button {} {
  242. label P
  243. callback {presetsui->paste(envASR->loc(),this);}
  244. xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  245. }
  246. Fl_Dial e2aval {
  247. label {A.val}
  248. callback {freeedit->redraw();}
  249. tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  250. code0 {o->init("PA_val");}
  251. class Fl_Osc_Dial
  252. }
  253. Fl_Dial e2adt {
  254. label {A.dt}
  255. callback {freeedit->redraw();}
  256. tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  257. code0 {o->init("PA_dt");}
  258. class Fl_Osc_Dial
  259. }
  260. Fl_Dial e2rval {
  261. label {R.val}
  262. callback {freeedit->redraw();}
  263. tooltip {Release value} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  264. code0 {o->init("PR_val");}
  265. class Fl_Osc_Dial
  266. }
  267. Fl_Dial e2rdt {
  268. label {R.dt}
  269. callback {freeedit->redraw();}
  270. tooltip {Release time} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  271. code0 {o->init("PR_dt");}
  272. class Fl_Osc_Dial
  273. }
  274. Fl_Dial e2envstretch {
  275. label Stretch
  276. 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
  277. code0 {o->init("Penvstretch");}
  278. class Fl_Osc_Dial
  279. }
  280. Fl_Check_Button e2forcedrelease {
  281. label frcR
  282. tooltip {Forced release} xywh {180 25 15 25} down_box DOWN_BOX labelsize 10 align 6
  283. code0 {o->init("Pforcedrelease");}
  284. class Fl_Osc_Check
  285. }
  286. }
  287. Fl_Button {} {
  288. label E
  289. callback {freemodeeditwindow->show();}
  290. tooltip {Envelope window} xywh {190 5 15 15} labelfont 1 labelsize 10
  291. }
  292. }
  293. }
  294. Function {make_ADSRfilter_window()} {} {
  295. Fl_Window envADSRfilter {open
  296. xywh {1002 911 275 70} type Double color 50 labelfont 1
  297. class Fl_Osc_Group visible
  298. } {
  299. Fl_Group {} {
  300. label {Filter Envelope}
  301. xywh {0 0 275 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17
  302. code0 {set_module_parameters(o);}
  303. } {
  304. Fl_Button {} {
  305. label C
  306. callback {presetsui->copy(envADSRfilter->loc());}
  307. xywh {220 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  308. }
  309. Fl_Button {} {
  310. label P
  311. callback {presetsui->paste(envADSRfilter->loc(),this);}
  312. xywh {237 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  313. }
  314. Fl_Dial e3aval {
  315. label {A.val}
  316. callback {freeedit->redraw();}
  317. tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  318. code0 {o->init("PA_val");}
  319. class Fl_Osc_Dial
  320. }
  321. Fl_Dial e3adt {
  322. label {A.dt}
  323. callback {freeedit->redraw();}
  324. tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  325. code0 {o->init("PA_dt");}
  326. class Fl_Osc_Dial
  327. }
  328. Fl_Dial e3dval {
  329. label {D.val}
  330. callback {freeedit->redraw();}
  331. tooltip {decay value} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  332. code0 {o->init("PD_val");}
  333. class Fl_Osc_Dial
  334. }
  335. Fl_Dial e3ddt {
  336. label {D.dt}
  337. callback {freeedit->redraw();}
  338. tooltip {decay time} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  339. code0 {o->init("PD_dt");}
  340. class Fl_Osc_Dial
  341. }
  342. Fl_Dial e3rdt {
  343. label {R.dt}
  344. callback {freeedit->redraw();}
  345. tooltip {Release time} xywh {145 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  346. code0 {o->init("PR_dt");}
  347. class Fl_Osc_Dial
  348. }
  349. Fl_Dial e3rval {
  350. label {R.val}
  351. callback {freeedit->redraw();}
  352. tooltip {Release value} xywh {180 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  353. code0 {o->init("PR_val");}
  354. class Fl_Osc_Dial
  355. }
  356. Fl_Dial e3envstretch {
  357. label Stretch
  358. 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
  359. code0 {o->init("Penvstretch");}
  360. class Fl_Osc_Dial
  361. }
  362. Fl_Check_Button e3forcedrelease {
  363. label frcR
  364. tooltip {Forced Release} xywh {250 30 15 20} down_box DOWN_BOX labelsize 10 align 6
  365. code0 {o->init("Pforcedrelease");}
  366. class Fl_Osc_Check
  367. }
  368. Fl_Button {} {
  369. label E
  370. callback {freemodeeditwindow->show();}
  371. xywh {255 5 15 15} labelfont 1 labelsize 10
  372. }
  373. }
  374. }
  375. }
  376. Function {make_ASRbw_window()} {} {
  377. Fl_Window envASRbw {open
  378. xywh {371 911 210 70} type Double
  379. code0 {set_module_parameters(o);}
  380. class Fl_Osc_Group visible
  381. } {
  382. Fl_Group {} {
  383. label {BandWidth Envelope}
  384. xywh {0 0 210 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17
  385. code0 {set_module_parameters(o);}
  386. } {
  387. Fl_Button {} {
  388. label C
  389. callback {presetsui->copy(envASRbw->loc());}
  390. xywh {155 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  391. }
  392. Fl_Button {} {
  393. label P
  394. callback {presetsui->paste(envASRbw->loc(),this);}
  395. xywh {172 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 7
  396. }
  397. Fl_Dial e4aval {
  398. label {A.val}
  399. callback {freeedit->redraw();}
  400. tooltip {Starting value} xywh {5 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  401. code0 {o->init("PA_val");}
  402. class Fl_Osc_Dial
  403. }
  404. Fl_Dial e4adt {
  405. label {A.dt}
  406. callback {freeedit->redraw();}
  407. tooltip {Attack time} xywh {40 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  408. code0 {o->init("PA_dt");}
  409. class Fl_Osc_Dial
  410. }
  411. Fl_Dial e4rval {
  412. label {R.val}
  413. callback {freeedit->redraw();}
  414. tooltip {Release value} xywh {110 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  415. code0 {o->init("PR_val");}
  416. class Fl_Osc_Dial
  417. }
  418. Fl_Dial e4rdt {
  419. label {R.dt}
  420. callback {freeedit->redraw();}
  421. tooltip {Release time} xywh {75 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  422. code0 {o->init("PR_dt");}
  423. class Fl_Osc_Dial
  424. }
  425. Fl_Dial e4envstretch {
  426. label Stretch
  427. 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
  428. code0 {o->init("Penvstretch");}
  429. class Fl_Osc_Dial
  430. }
  431. Fl_Check_Button e4forcedrelease {
  432. label frcR
  433. tooltip {Forced release} xywh {180 25 15 25} down_box DOWN_BOX labelsize 10 align 6
  434. code0 {o->init("Pforcedrelease");}
  435. class Fl_Osc_Check
  436. }
  437. }
  438. Fl_Button {} {
  439. label E
  440. callback {freemodeeditwindow->show();}
  441. xywh {190 5 15 15} labelfont 1 labelsize 10
  442. }
  443. }
  444. }
  445. Function {make_free_window()} {} {
  446. Fl_Window envfree {open
  447. xywh {385 911 205 70} type Double color 50 labelfont 1 resizable
  448. code0 {set_module_parameters(o);}
  449. class Fl_Osc_Group visible
  450. } {
  451. Fl_Group envfreegroup {
  452. label {Amplitude Envelope}
  453. xywh {0 0 205 70} box UP_BOX color 223 labeltype ENGRAVED_LABEL labelsize 10 align 17 resizable
  454. code0 {set_module_parameters(o);}
  455. } {
  456. Fl_Button {} {
  457. label E
  458. callback {freemodeeditwindow->show();}
  459. xywh {185 5 15 15} labelfont 1 labelsize 10
  460. }
  461. Fl_Box freeeditsmall {
  462. label Envelope
  463. callback {envfree->redraw();}
  464. xywh {5 20 195 45} box FLAT_BOX color 0 resizable
  465. code0 {o->init();}
  466. class EnvelopeFreeEdit
  467. }
  468. Fl_Button {} {
  469. label C
  470. callback {presetsui->copy(envfree->loc());}
  471. xywh {150 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55
  472. }
  473. Fl_Button {} {
  474. label P
  475. callback {presetsui->paste(envfree->loc(),this);}
  476. xywh {167 5 15 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 10 labelcolor 55
  477. }
  478. }
  479. }
  480. }
  481. Function {init(int env_type, Fl_Osc_Interface *osc_, std::string base_, std::string ext_)} {open
  482. } {
  483. code {osc = osc_;
  484. base = base_;
  485. ext = ext_;
  486. Envmode = env_type;
  487. Pfreemode = false;
  488. Penvsustain = false;
  489. Penvpoints = 3;
  490. Penvstretch = 0;
  491. Pforcedrelease = 0;
  492. Plinearenvelope = 0;
  493. assert(osc);
  494. make_ADSR_window();
  495. make_ASR_window();
  496. make_ADSRfilter_window();
  497. make_ASRbw_window();
  498. make_free_window();
  499. make_freemode_edit_window();
  500. envwindow=NULL;
  501. if(Envmode==3) envfreegroup->label("Frequency Envelope");
  502. if(Envmode==4) envfreegroup->label("Filter Envelope");
  503. if(Envmode==5) envfreegroup->label("Bandwidth Envelope");
  504. freemodeeditwindow->label(this->label());
  505. freeeditsmall->setpair(freeedit);
  506. freeedit->setpair(freeeditsmall);
  507. refresh();} {}
  508. }
  509. Function {rebase(std::string new_base)} {open
  510. } {
  511. code {Fl_Osc_Group::rebase(new_base);
  512. freemodeeditwindow->rebase(new_base+ext);} {}
  513. }
  514. Function {reinit()} {open
  515. } {
  516. code {if(Pfreemode){
  517. int answer=fl_choice("Disable the free mode of the Envelope?","No","Yes",NULL);
  518. freemodebutton->value(Pfreemode);
  519. if (answer==0)
  520. return;
  521. };
  522. Pfreemode = !Pfreemode;
  523. hide();
  524. const int winx=freemodeeditwindow->x();
  525. const int winy=freemodeeditwindow->y();
  526. freemodeeditwindow->hide();
  527. envwindow->hide();
  528. Fl_Group *par=envwindow->parent();
  529. par->hide();
  530. refresh();
  531. envwindow->show();
  532. par->redraw();
  533. par->show();
  534. show();
  535. freemodeeditwindow->position(winx,winy);
  536. freemodeeditwindow->show();
  537. if (Pfreemode) {
  538. freemodebutton->value(1);
  539. addpoint->show();
  540. deletepoint->show();
  541. forcedreleasecheck->show();
  542. sustaincounter->show();
  543. envstretchdial->show();
  544. } else{
  545. freemodebutton->value(0);
  546. addpoint->hide();
  547. deletepoint->hide();
  548. forcedreleasecheck->hide();
  549. sustaincounter->hide();
  550. envstretchdial->hide();
  551. };
  552. } {selected
  553. }
  554. }
  555. Function {refresh()} {open
  556. } {
  557. code {freemodebutton->value(Pfreemode);
  558. sustaincounter->value(Penvsustain);
  559. sustaincounter->maximum(Penvpoints-2);
  560. envstretchdial->value(Penvstretch);
  561. linearenvelopecheck->value(Plinearenvelope);
  562. //Conditionally display widgets
  563. if(Pfreemode) {
  564. freemodebutton->value(1);
  565. addpoint->show();
  566. deletepoint->show();
  567. forcedreleasecheck->show();
  568. sustaincounter->show();
  569. envstretchdial->show();
  570. } else {
  571. freemodebutton->value(0);
  572. addpoint->hide();
  573. deletepoint->hide();
  574. forcedreleasecheck->hide();
  575. sustaincounter->hide();
  576. envstretchdial->hide();
  577. }
  578. if(Pfreemode || Envmode>2)
  579. linearenvelopecheck->hide();
  580. else
  581. linearenvelopecheck->show();
  582. forcedreleasecheck->value(Pforcedrelease);
  583. if (Pfreemode==0){
  584. addpoint->hide();
  585. deletepoint->hide();
  586. } else {
  587. addpoint->show();
  588. deletepoint->show();
  589. }
  590. envADSR->hide();
  591. envASR->hide();
  592. envADSRfilter->hide();
  593. envASRbw->hide();
  594. envfree->hide();
  595. if (Pfreemode==0){
  596. switch(Envmode){
  597. case 1:
  598. case 2:
  599. envwindow=envADSR;
  600. break;
  601. case 3:
  602. envwindow=envASR;
  603. break;
  604. case 4:
  605. envwindow=envADSRfilter;
  606. break;
  607. case 5:
  608. envwindow=envASRbw;
  609. break;
  610. default:
  611. break;
  612. };
  613. }else{
  614. envwindow=envfree;
  615. };
  616. assert(envwindow);
  617. envwindow->resize(this->x(),this->y(),this->w(),this->h());
  618. envwindow->show();} {}
  619. }
  620. decl {int Envmode;} {private local
  621. }
  622. decl {int Pfreemode;} {private local
  623. }
  624. decl {int Penvsustain;} {private local
  625. }
  626. decl {int Penvpoints;} {private local
  627. }
  628. decl {int Penvstretch;} {private local
  629. }
  630. decl {int Pforcedrelease;} {private local
  631. }
  632. decl {int Plinearenvelope;} {private local
  633. }
  634. decl {Fl_Group *envwindow;} {private local
  635. }
  636. }