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.

SUBnoteUI.fl 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  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 <stdlib.h>} {public
  8. }
  9. decl {\#include <stdio.h>} {public
  10. }
  11. decl {\#include <string.h>} {public
  12. }
  13. decl {\#include "../globals.h"} {public
  14. }
  15. decl {\#include "WidgetPDial.h"} {public
  16. }
  17. decl {\#include "EnvelopeUI.h"} {public
  18. }
  19. decl {\#include "FilterUI.h"} {public
  20. }
  21. decl {\#include "../Misc/Util.h"} {public
  22. }
  23. decl {\#include "../Params/SUBnoteParameters.h"} {public
  24. }
  25. decl {\#include "PresetsUI.h"} {public
  26. }
  27. class SUBnoteharmonic {: {public Fl_Group}
  28. } {
  29. Function {make_window()} {private
  30. } {
  31. Fl_Window harmonic {
  32. xywh {329 403 90 225} type Double hide
  33. class Fl_Group
  34. } {
  35. Fl_Slider mag {
  36. callback {int x=0;
  37. if (Fl::event_button1()) x=127-(int)o->value();
  38. else o->value(127-x);
  39. pars->Phmag[n]=x;
  40. if (pars->Phmag[n]==0) o->selection_color(0);
  41. else o->selection_color(222);}
  42. tooltip {harmonic's magnitude} xywh {0 15 10 115} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 127
  43. code0 {o->value(127-pars->Phmag[n]);}
  44. code1 {if (pars->Phmag[n]==0) o->selection_color(0);}
  45. }
  46. Fl_Slider bw {
  47. callback {int x=64;
  48. if (Fl::event_button1()) x=127-(int)o->value();
  49. else o->value(x);
  50. pars->Phrelbw[n]=x;}
  51. tooltip {harmonic's bandwidth} xywh {0 135 10 75} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64
  52. code0 {o->value(127-pars->Phrelbw[n]);}
  53. }
  54. Fl_Box {} {
  55. xywh {10 170 5 5} box FLAT_BOX color 45
  56. code0 {if (n+1==MAX_SUB_HARMONICS) o->hide();}
  57. }
  58. Fl_Box {} {
  59. label 01
  60. xywh {0 210 10 15} labelfont 1 labelsize 9 align 20
  61. code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));}
  62. }
  63. Fl_Box {} {
  64. label 01
  65. xywh {0 0 10 15} labelfont 1 labelsize 9 align 20
  66. code0 {char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));}
  67. }
  68. }
  69. }
  70. Function {SUBnoteharmonic(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
  71. code {n=0;} {}
  72. }
  73. Function {init(SUBnoteParameters *pars_,int n_)} {} {
  74. code {pars=pars_;
  75. n=n_;
  76. make_window();
  77. harmonic->show();
  78. end();} {}
  79. }
  80. Function {refresh()} {} {
  81. code {mag->value(127-pars->Phmag[n]);
  82. if (pars->Phmag[n]==0) mag->selection_color(0);
  83. bw->value(127-pars->Phrelbw[n]);} {}
  84. }
  85. Function {~SUBnoteharmonic()} {} {
  86. code {harmonic->hide();
  87. hide();
  88. //delete(harmonic);} {}
  89. }
  90. decl {SUBnoteParameters *pars;} {}
  91. decl {int n;} {}
  92. }
  93. class SUBnoteUI {open : {public PresetsUI_}
  94. } {
  95. Function {make_window()} {open
  96. } {
  97. Fl_Window SUBparameters {
  98. label {SUBsynth Parameters} open
  99. xywh {542 489 735 390} type Double visible
  100. } {
  101. Fl_Scroll {} {
  102. label scroll open
  103. xywh {5 140 435 245} type HORIZONTAL box FLAT_BOX labeltype NO_LABEL
  104. } {
  105. Fl_Pack harmonics {open
  106. xywh {10 145 425 235} type HORIZONTAL
  107. code0 {for (int i=0;i<MAX_SUB_HARMONICS;i++){h[i]=new SUBnoteharmonic(0,0,15,o->h(),"");h[i]->init(pars,i);}}
  108. } {}
  109. }
  110. Fl_Button {} {
  111. label Close
  112. callback {SUBparameters->hide();}
  113. xywh {625 365 105 20} box THIN_UP_BOX labelfont 1 labelsize 11
  114. }
  115. Fl_Group {} {
  116. label AMPLITUDE
  117. xywh {5 5 215 135} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17
  118. } {
  119. Fl_Value_Slider vol {
  120. label Vol
  121. callback {pars->PVolume=(int)o->value();}
  122. tooltip Volume xywh {10 25 140 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
  123. code0 {o->value(pars->PVolume);}
  124. }
  125. Fl_Value_Slider vsns {
  126. label {V.Sns}
  127. callback {pars->PAmpVelocityScaleFunction=(int) o->value();}
  128. tooltip {Velocity Sensing Function (rightmost to disable)} xywh {10 45 140 15} type {Horz Knob} box NO_BOX labelsize 11 align 8 maximum 127 step 1
  129. code0 {o->value(pars->PAmpVelocityScaleFunction);}
  130. }
  131. Fl_Dial pan {
  132. label Pan
  133. callback {pars->PPanning=(int) o->value();}
  134. tooltip {Panning (leftmost is Random)} xywh {185 20 30 30} box ROUND_UP_BOX labelsize 10 maximum 127 step 1
  135. code0 {o->value(pars->PPanning);}
  136. class WidgetPDial
  137. }
  138. Fl_Group ampenv {
  139. label {SUBsynth - Amplitude Envelope} open
  140. xywh {10 65 205 70} box FLAT_BOX color 51 align 144
  141. code0 {o->init(pars->AmpEnvelope);}
  142. class EnvelopeUI
  143. } {}
  144. }
  145. Fl_Group {} {
  146. xywh {495 325 235 35} box UP_FRAME
  147. } {
  148. Fl_Counter filterstages {
  149. label {Filter Stages}
  150. callback {pars->Pnumstages=(int) o->value();}
  151. tooltip {How many times the noise is filtered} xywh {515 340 45 15} type Simple labelfont 1 labelsize 10 align 1 minimum 1 maximum 5 step 1 textsize 10
  152. code0 {o->value(pars->Pnumstages);}
  153. }
  154. Fl_Choice magtype {
  155. label {Mag.Type}
  156. callback {pars->Phmagtype=(int) o->value();}
  157. xywh {585 340 65 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11
  158. code0 {o->value(pars->Phmagtype);}
  159. } {
  160. MenuItem {} {
  161. label Linear
  162. xywh {20 20 100 20} labelfont 1 labelsize 11
  163. }
  164. MenuItem {} {
  165. label {-40dB}
  166. xywh {30 30 100 20} labelfont 1 labelsize 11
  167. }
  168. MenuItem {} {
  169. label {-60dB}
  170. xywh {40 40 100 20} labelfont 1 labelsize 11
  171. }
  172. MenuItem {} {
  173. label {-80dB}
  174. xywh {50 50 100 20} labelfont 1 labelsize 11
  175. }
  176. MenuItem {} {
  177. label {-100dB}
  178. xywh {60 60 100 20} labelfont 1 labelsize 11
  179. }
  180. }
  181. Fl_Choice start {
  182. label Start
  183. callback {pars->Pstart=(int) o->value();} open
  184. xywh {670 340 50 15} down_box BORDER_BOX labelfont 1 labelsize 10 align 1 textsize 11
  185. code0 {o->value(pars->Pstart);}
  186. } {
  187. MenuItem {} {
  188. label Zero
  189. xywh {30 30 100 20} labelfont 1 labelsize 11
  190. }
  191. MenuItem {} {
  192. label RND
  193. xywh {40 40 100 20} labelfont 1 labelsize 11
  194. }
  195. MenuItem {} {
  196. label {Max.}
  197. xywh {50 50 100 20} labelfont 1 labelsize 11
  198. }
  199. }
  200. }
  201. Fl_Group freqsettingsui {
  202. label FREQUENCY
  203. xywh {440 5 290 135} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17
  204. } {
  205. Fl_Group freqenvelopegroup {
  206. label {SUBsynth - Frequency Envelope} open
  207. xywh {445 65 205 70} box FLAT_BOX color 51 align 144
  208. code0 {o->init(pars->FreqEnvelope);}
  209. code1 {if (pars->PFreqEnvelopeEnabled==0) o->deactivate();}
  210. class EnvelopeUI
  211. } {}
  212. Fl_Check_Button freqee {
  213. label Enabled
  214. callback {pars->PFreqEnvelopeEnabled=o->value();
  215. if (o->value()==0) freqenvelopegroup->deactivate();
  216. else freqenvelopegroup->activate();
  217. o->show();
  218. freqsettingsui->redraw();}
  219. xywh {445 68 55 15} down_box DOWN_BOX labelfont 1 labelsize 10
  220. code0 {o->value(pars->PFreqEnvelopeEnabled);}
  221. }
  222. Fl_Counter octave {
  223. label Octave
  224. callback {int k=(int) o->value();
  225. if (k<0) k+=16;
  226. pars->PCoarseDetune = k*1024+
  227. pars->PCoarseDetune%1024;}
  228. tooltip Octave xywh {670 50 45 15} type Simple labelsize 10 align 1 minimum -8 maximum 7 step 1 textfont 1 textsize 11
  229. code0 {int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;}
  230. code2 {o->value(k);}
  231. }
  232. Fl_Counter coarsedet {
  233. label {Coarse Det.}
  234. callback {int k=(int) o->value();
  235. if (k<0) k+=1024;
  236. pars->PCoarseDetune = k+
  237. (pars->PCoarseDetune/1024)*1024;}
  238. tooltip {Coarse Detune} xywh {655 115 60 20} labelsize 10 align 1 minimum -64 maximum 63 step 1 textfont 1 textsize 11
  239. code0 {int k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;}
  240. code2 {o->value(k);}
  241. code3 {o->lstep(10);}
  242. }
  243. Fl_Slider detune {
  244. callback {pars->PDetune=(int)o->value()+8192;
  245. detunevalueoutput->do_callback();}
  246. tooltip {Fine Detune (cents)} xywh {495 25 230 15} type {Horz Knob} box NO_BOX minimum -8192 maximum 8191 step 1
  247. code0 {o->value(pars->PDetune-8192);}
  248. }
  249. Fl_Value_Output detunevalueoutput {
  250. label Detune
  251. callback {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));}
  252. xywh {448 25 45 15} labelsize 10 align 5 minimum -5000 maximum 5000 step 0.01 textfont 1 textsize 10
  253. code0 {o->value(getdetune(pars->PDetuneType,0,pars->PDetune));}
  254. }
  255. Fl_Check_Button hz440 {
  256. label 440Hz
  257. callback {int x=(int) o->value();
  258. pars->Pfixedfreq=x;
  259. if (x==0) fixedfreqetdial->deactivate();
  260. else fixedfreqetdial->activate();}
  261. tooltip {set the base frequency to 440Hz} xywh {555 45 50 15} down_box DOWN_BOX labelfont 1 labelsize 10
  262. code0 {o->value(pars->Pfixedfreq);}
  263. }
  264. Fl_Dial fixedfreqetdial {
  265. label {Eq.T.}
  266. callback {pars->PfixedfreqET=(int) o->value();}
  267. tooltip {How the frequency varies acording to the keyboard (leftmost for fixed frequency)} xywh {610 45 15 15} box ROUND_UP_BOX labelsize 10 align 8 maximum 127 step 1
  268. code0 {o->value(pars->PfixedfreqET);}
  269. code1 {if (pars->Pfixedfreq==0) o->deactivate();}
  270. class WidgetPDial
  271. }
  272. Fl_Choice detunetype {
  273. label {Detune Type}
  274. callback {pars->PDetuneType=(int) o->value()+1;
  275. detunevalueoutput->do_callback();} open
  276. xywh {655 85 70 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
  277. code0 {o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");}
  278. code1 {o->value(pars->PDetuneType-1);}
  279. } {}
  280. }
  281. Fl_Check_Button stereo {
  282. label Stereo
  283. callback {pars->Pstereo=(int) o->value();} selected
  284. xywh {440 325 55 35} box THIN_UP_BOX down_box DOWN_BOX labelsize 10
  285. code0 {o->value(pars->Pstereo);}
  286. }
  287. Fl_Button {} {
  288. label Clear
  289. callback {for (int i=0;i<MAX_SUB_HARMONICS;i++){
  290. h[i]->mag->value(127);
  291. pars->Phmag[i]=0;
  292. h[i]->bw->value(64);
  293. pars->Phrelbw[i]=64;
  294. };
  295. pars->Phmag[0]=127;
  296. h[0]->mag->value(0);
  297. SUBparameters->redraw();}
  298. tooltip {Clear the harmonics} xywh {445 365 70 20} box THIN_UP_BOX labelfont 1 labelsize 11
  299. }
  300. Fl_Group bandwidthsettingsui {
  301. label BANDWIDTH
  302. xywh {220 5 220 135} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 align 17
  303. } {
  304. Fl_Group bandwidthenvelopegroup {
  305. label {SUBsynth - BandWidth Envelope} open
  306. xywh {225 65 205 70} box FLAT_BOX color 51 align 144
  307. code0 {o->init(pars->BandWidthEnvelope);}
  308. code1 {if (pars->PBandWidthEnvelopeEnabled==0) o->deactivate();}
  309. class EnvelopeUI
  310. } {}
  311. Fl_Check_Button bwee {
  312. label Enabled
  313. callback {pars->PBandWidthEnvelopeEnabled=o->value();
  314. if (o->value()==0) bandwidthenvelopegroup->deactivate();
  315. else bandwidthenvelopegroup->activate();
  316. o->show();
  317. bandwidthsettingsui->redraw();}
  318. xywh {225 67 55 15} down_box DOWN_BOX labelfont 1 labelsize 10
  319. code0 {o->value(pars->PBandWidthEnvelopeEnabled);}
  320. }
  321. Fl_Value_Slider bandwidth {
  322. label {Band Width}
  323. callback {pars->Pbandwidth=(int) o->value();}
  324. xywh {225 40 115 15} type {Horz Knob} box NO_BOX labelsize 10 align 1 maximum 127 step 1
  325. code0 {o->value(pars->Pbandwidth);}
  326. }
  327. Fl_Value_Slider bwidthscale {
  328. label {B.Width Scale}
  329. callback {pars->Pbwscale=(int) o->value()+64;}
  330. tooltip {How much I increase the BandWidth according to lower/higher harmonics} xywh {345 40 90 15} type {Horz Knob} box NO_BOX labelsize 10 align 1 minimum -64 maximum 63 step 1
  331. code0 {o->value(pars->Pbwscale-64);}
  332. }
  333. }
  334. Fl_Group globalfiltergroup {
  335. label FILTER
  336. xywh {440 140 290 185} box UP_FRAME labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 17
  337. code0 {if (pars->PGlobalFilterEnabled==0) o->deactivate();}
  338. } {
  339. Fl_Group filterenv {
  340. label {SUBsynth - Filter Envelope} open
  341. xywh {445 250 275 70} box FLAT_BOX color 51 align 144
  342. code0 {o->init(pars->GlobalFilterEnvelope);}
  343. class EnvelopeUI
  344. } {}
  345. Fl_Group filterui {
  346. label {SUBsynthl - Filter} open
  347. xywh {445 165 275 75} box FLAT_BOX color 50 align 144
  348. code0 {o->init(pars->GlobalFilter,&pars->PGlobalFilterVelocityScale,&pars->PGlobalFilterVelocityScaleFunction);}
  349. class FilterUI
  350. } {}
  351. }
  352. Fl_Check_Button filtere {
  353. label Enabled
  354. callback {pars->PGlobalFilterEnabled=o->value();
  355. if (o->value()==0) globalfiltergroup->deactivate();
  356. else globalfiltergroup->activate();
  357. o->show();
  358. globalfiltergroup->redraw();}
  359. xywh {445 145 85 20} down_box DOWN_BOX labelfont 1 labelsize 11
  360. code0 {o->value(pars->PGlobalFilterEnabled);}
  361. }
  362. Fl_Button {} {
  363. label C
  364. callback {presetsui->copy(pars);}
  365. xywh {540 370 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
  366. }
  367. Fl_Button {} {
  368. label P
  369. callback {presetsui->paste(pars,this);}
  370. xywh {570 370 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
  371. }
  372. }
  373. }
  374. Function {refresh()} {} {
  375. code {for (int i=0;i<MAX_SUB_HARMONICS;i++) h[i]->refresh();
  376. vol->value(pars->PVolume);
  377. vsns->value(pars->PAmpVelocityScaleFunction);
  378. pan->value(pars->PPanning);
  379. bandwidth->value(pars->Pbandwidth);
  380. bwidthscale->value(pars->Pbwscale-64);
  381. bwee->value(pars->PBandWidthEnvelopeEnabled);
  382. if (pars->PBandWidthEnvelopeEnabled==0) bandwidthenvelopegroup->deactivate();
  383. else bandwidthenvelopegroup->activate();
  384. bwee->show();
  385. bandwidthsettingsui->redraw();
  386. detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune));
  387. freqee->value(pars->PFreqEnvelopeEnabled);
  388. if (pars->PFreqEnvelopeEnabled==0) freqenvelopegroup->deactivate();
  389. else freqenvelopegroup->activate();
  390. freqee->show();
  391. freqsettingsui->redraw();
  392. detune->value(pars->PDetune-8192);
  393. hz440->value(pars->Pfixedfreq);
  394. fixedfreqetdial->value(pars->PfixedfreqET);
  395. int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;
  396. octave->value(k);
  397. detunetype->value(pars->PDetuneType-1);
  398. k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;
  399. coarsedet->value(k);
  400. filtere->value(pars->PGlobalFilterEnabled);
  401. if (pars->PGlobalFilterEnabled==0) globalfiltergroup->deactivate();
  402. else globalfiltergroup->activate();
  403. filtere->show();
  404. globalfiltergroup->redraw();
  405. stereo->value(pars->Pstereo);
  406. filterstages->value(pars->Pnumstages);
  407. magtype->value(pars->Phmagtype);
  408. start->value(pars->Pstart);
  409. ampenv->refresh();
  410. bandwidthenvelopegroup->refresh();
  411. freqenvelopegroup->refresh();
  412. filterui->refresh();
  413. filterenv->refresh();} {}
  414. }
  415. Function {SUBnoteUI(SUBnoteParameters *parameters)} {} {
  416. code {pars=parameters;
  417. make_window();} {}
  418. }
  419. Function {~SUBnoteUI()} {} {
  420. code {//for (int i=0;i<MAX_SUB_HARMONICS;i++) delete (h[i]);
  421. SUBparameters->hide();
  422. delete(SUBparameters);} {}
  423. }
  424. decl {SUBnoteParameters *pars;} {}
  425. decl {SUBnoteharmonic *h[MAX_SUB_HARMONICS];} {}
  426. }