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 21KB

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