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

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