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.

736 lines
27KB

  1. // generated by Fast Light User Interface Designer (fluid) version 1.0300
  2. #include "zynaddsubfx/UI/SUBnoteUI.h"
  3. //Copyright (c) 2002-2005 Nasca Octavian Paul
  4. //License: GNU GPL version 2 or later
  5. void SUBnoteharmonic::cb_mag_i(Fl_Slider* o, void*) {
  6. int x=0;
  7. if (Fl::event_button1()) x=127-(int)o->value();
  8. else o->value(127-x);
  9. pars->Phmag[n]=x;
  10. if (pars->Phmag[n]==0) o->selection_color(0);
  11. else o->selection_color(222);
  12. }
  13. void SUBnoteharmonic::cb_mag(Fl_Slider* o, void* v) {
  14. ((SUBnoteharmonic*)(o->parent()->user_data()))->cb_mag_i(o,v);
  15. }
  16. void SUBnoteharmonic::cb_bw_i(Fl_Slider* o, void*) {
  17. int x=64;
  18. if (Fl::event_button1()) x=127-(int)o->value();
  19. else o->value(x);
  20. pars->Phrelbw[n]=x;
  21. }
  22. void SUBnoteharmonic::cb_bw(Fl_Slider* o, void* v) {
  23. ((SUBnoteharmonic*)(o->parent()->user_data()))->cb_bw_i(o,v);
  24. }
  25. Fl_Group* SUBnoteharmonic::make_window() {
  26. { harmonic = new Fl_Group(0, 0, 90, 225);
  27. harmonic->box(FL_FLAT_BOX);
  28. harmonic->color(FL_BACKGROUND_COLOR);
  29. harmonic->selection_color(FL_BACKGROUND_COLOR);
  30. harmonic->labeltype(FL_NO_LABEL);
  31. harmonic->labelfont(0);
  32. harmonic->labelsize(14);
  33. harmonic->labelcolor(FL_FOREGROUND_COLOR);
  34. harmonic->user_data((void*)(this));
  35. harmonic->align(Fl_Align(FL_ALIGN_TOP));
  36. harmonic->when(FL_WHEN_RELEASE);
  37. { Fl_Slider* o = mag = new Fl_Slider(0, 15, 10, 115);
  38. mag->tooltip("harmonic\'s magnitude");
  39. mag->type(4);
  40. mag->box(FL_FLAT_BOX);
  41. mag->selection_color((Fl_Color)222);
  42. mag->maximum(127);
  43. mag->step(1);
  44. mag->value(127);
  45. mag->callback((Fl_Callback*)cb_mag);
  46. o->value(127-pars->Phmag[n]);
  47. if (pars->Phmag[n]==0) o->selection_color(0);
  48. } // Fl_Slider* mag
  49. { Fl_Slider* o = bw = new Fl_Slider(0, 135, 10, 75);
  50. bw->tooltip("harmonic\'s bandwidth");
  51. bw->type(4);
  52. bw->box(FL_FLAT_BOX);
  53. bw->selection_color((Fl_Color)222);
  54. bw->maximum(127);
  55. bw->step(1);
  56. bw->value(64);
  57. bw->callback((Fl_Callback*)cb_bw);
  58. o->value(127-pars->Phrelbw[n]);
  59. } // Fl_Slider* bw
  60. { Fl_Box* o = new Fl_Box(10, 170, 5, 5);
  61. o->box(FL_FLAT_BOX);
  62. o->color(FL_DARK2);
  63. if (n+1==MAX_SUB_HARMONICS) o->hide();
  64. } // Fl_Box* o
  65. { Fl_Box* o = new Fl_Box(0, 210, 10, 15, "01");
  66. o->labelfont(1);
  67. o->labelsize(9);
  68. o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
  69. char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));
  70. } // Fl_Box* o
  71. { Fl_Box* o = new Fl_Box(0, 0, 10, 15, "01");
  72. o->labelfont(1);
  73. o->labelsize(9);
  74. o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
  75. char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp));
  76. } // Fl_Box* o
  77. harmonic->end();
  78. } // Fl_Group* harmonic
  79. return harmonic;
  80. }
  81. SUBnoteharmonic::SUBnoteharmonic(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) {
  82. n=0;
  83. }
  84. void SUBnoteharmonic::init(SUBnoteParameters *pars_,int n_) {
  85. pars=pars_;
  86. n=n_;
  87. make_window();
  88. harmonic->show();
  89. end();
  90. }
  91. void SUBnoteharmonic::refresh() {
  92. mag->value(127-pars->Phmag[n]);
  93. if (pars->Phmag[n]==0) mag->selection_color(0);
  94. bw->value(127-pars->Phrelbw[n]);
  95. }
  96. SUBnoteharmonic::~SUBnoteharmonic() {
  97. harmonic->hide();
  98. hide();
  99. //delete(harmonic);
  100. }
  101. void SUBnoteUI::cb_Close_i(Fl_Button*, void*) {
  102. SUBparameters->hide();
  103. }
  104. void SUBnoteUI::cb_Close(Fl_Button* o, void* v) {
  105. ((SUBnoteUI*)(o->parent()->user_data()))->cb_Close_i(o,v);
  106. }
  107. void SUBnoteUI::cb_vol_i(Fl_Value_Slider* o, void*) {
  108. pars->PVolume=(int)o->value();
  109. }
  110. void SUBnoteUI::cb_vol(Fl_Value_Slider* o, void* v) {
  111. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_vol_i(o,v);
  112. }
  113. void SUBnoteUI::cb_vsns_i(Fl_Value_Slider* o, void*) {
  114. pars->PAmpVelocityScaleFunction=(int) o->value();
  115. }
  116. void SUBnoteUI::cb_vsns(Fl_Value_Slider* o, void* v) {
  117. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_vsns_i(o,v);
  118. }
  119. void SUBnoteUI::cb_pan_i(WidgetPDial* o, void*) {
  120. pars->PPanning=(int) o->value();
  121. }
  122. void SUBnoteUI::cb_pan(WidgetPDial* o, void* v) {
  123. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_pan_i(o,v);
  124. }
  125. void SUBnoteUI::cb_filterstages_i(Fl_Counter* o, void*) {
  126. pars->Pnumstages=(int) o->value();
  127. }
  128. void SUBnoteUI::cb_filterstages(Fl_Counter* o, void* v) {
  129. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_filterstages_i(o,v);
  130. }
  131. void SUBnoteUI::cb_magtype_i(Fl_Choice* o, void*) {
  132. pars->Phmagtype=(int) o->value();
  133. }
  134. void SUBnoteUI::cb_magtype(Fl_Choice* o, void* v) {
  135. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_magtype_i(o,v);
  136. }
  137. Fl_Menu_Item SUBnoteUI::menu_magtype[] = {
  138. {"Linear", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0},
  139. {"-40dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0},
  140. {"-60dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0},
  141. {"-80dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0},
  142. {"-100dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0},
  143. {0,0,0,0,0,0,0,0,0}
  144. };
  145. void SUBnoteUI::cb_start_i(Fl_Choice* o, void*) {
  146. pars->Pstart=(int) o->value();
  147. }
  148. void SUBnoteUI::cb_start(Fl_Choice* o, void* v) {
  149. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_start_i(o,v);
  150. }
  151. Fl_Menu_Item SUBnoteUI::menu_start[] = {
  152. {"Zero", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0},
  153. {"RND", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0},
  154. {"Max.", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0},
  155. {0,0,0,0,0,0,0,0,0}
  156. };
  157. void SUBnoteUI::cb_freqee_i(Fl_Check_Button* o, void*) {
  158. pars->PFreqEnvelopeEnabled=o->value();
  159. if (o->value()==0) freqenvelopegroup->deactivate();
  160. else freqenvelopegroup->activate();
  161. o->show();
  162. freqsettingsui->redraw();
  163. }
  164. void SUBnoteUI::cb_freqee(Fl_Check_Button* o, void* v) {
  165. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_freqee_i(o,v);
  166. }
  167. void SUBnoteUI::cb_octave_i(Fl_Counter* o, void*) {
  168. int k=(int) o->value();
  169. if (k<0) k+=16;
  170. pars->PCoarseDetune = k*1024+
  171. pars->PCoarseDetune%1024;
  172. }
  173. void SUBnoteUI::cb_octave(Fl_Counter* o, void* v) {
  174. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_octave_i(o,v);
  175. }
  176. void SUBnoteUI::cb_coarsedet_i(Fl_Counter* o, void*) {
  177. int k=(int) o->value();
  178. if (k<0) k+=1024;
  179. pars->PCoarseDetune = k+
  180. (pars->PCoarseDetune/1024)*1024;
  181. }
  182. void SUBnoteUI::cb_coarsedet(Fl_Counter* o, void* v) {
  183. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_coarsedet_i(o,v);
  184. }
  185. void SUBnoteUI::cb_detune_i(Fl_Slider* o, void*) {
  186. pars->PDetune=(int)o->value()+8192;
  187. detunevalueoutput->do_callback();
  188. }
  189. void SUBnoteUI::cb_detune(Fl_Slider* o, void* v) {
  190. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_detune_i(o,v);
  191. }
  192. void SUBnoteUI::cb_detunevalueoutput_i(Fl_Value_Output* o, void*) {
  193. o->value(getdetune(pars->PDetuneType,0,pars->PDetune));
  194. }
  195. void SUBnoteUI::cb_detunevalueoutput(Fl_Value_Output* o, void* v) {
  196. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_detunevalueoutput_i(o,v);
  197. }
  198. void SUBnoteUI::cb_hz440_i(Fl_Check_Button* o, void*) {
  199. int x=(int) o->value();
  200. pars->Pfixedfreq=x;
  201. if (x==0) fixedfreqetdial->deactivate();
  202. else fixedfreqetdial->activate();
  203. }
  204. void SUBnoteUI::cb_hz440(Fl_Check_Button* o, void* v) {
  205. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_hz440_i(o,v);
  206. }
  207. void SUBnoteUI::cb_fixedfreqetdial_i(WidgetPDial* o, void*) {
  208. pars->PfixedfreqET=(int) o->value();
  209. }
  210. void SUBnoteUI::cb_fixedfreqetdial(WidgetPDial* o, void* v) {
  211. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_fixedfreqetdial_i(o,v);
  212. }
  213. void SUBnoteUI::cb_detunetype_i(Fl_Choice* o, void*) {
  214. pars->PDetuneType=(int) o->value()+1;
  215. detunevalueoutput->do_callback();
  216. }
  217. void SUBnoteUI::cb_detunetype(Fl_Choice* o, void* v) {
  218. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_detunetype_i(o,v);
  219. }
  220. void SUBnoteUI::cb_stereo_i(Fl_Check_Button* o, void*) {
  221. pars->Pstereo=(int) o->value();
  222. }
  223. void SUBnoteUI::cb_stereo(Fl_Check_Button* o, void* v) {
  224. ((SUBnoteUI*)(o->parent()->user_data()))->cb_stereo_i(o,v);
  225. }
  226. void SUBnoteUI::cb_Clear_i(Fl_Button*, void*) {
  227. for (int i=0;i<MAX_SUB_HARMONICS;i++){
  228. h[i]->mag->value(127);
  229. pars->Phmag[i]=0;
  230. h[i]->bw->value(64);
  231. pars->Phrelbw[i]=64;
  232. };
  233. pars->Phmag[0]=127;
  234. h[0]->mag->value(0);
  235. SUBparameters->redraw();
  236. }
  237. void SUBnoteUI::cb_Clear(Fl_Button* o, void* v) {
  238. ((SUBnoteUI*)(o->parent()->user_data()))->cb_Clear_i(o,v);
  239. }
  240. void SUBnoteUI::cb_bwee_i(Fl_Check_Button* o, void*) {
  241. pars->PBandWidthEnvelopeEnabled=o->value();
  242. if (o->value()==0) bandwidthenvelopegroup->deactivate();
  243. else bandwidthenvelopegroup->activate();
  244. o->show();
  245. bandwidthsettingsui->redraw();
  246. }
  247. void SUBnoteUI::cb_bwee(Fl_Check_Button* o, void* v) {
  248. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_bwee_i(o,v);
  249. }
  250. void SUBnoteUI::cb_bandwidth_i(Fl_Value_Slider* o, void*) {
  251. pars->Pbandwidth=(int) o->value();
  252. }
  253. void SUBnoteUI::cb_bandwidth(Fl_Value_Slider* o, void* v) {
  254. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_bandwidth_i(o,v);
  255. }
  256. void SUBnoteUI::cb_bwidthscale_i(Fl_Value_Slider* o, void*) {
  257. pars->Pbwscale=(int) o->value()+64;
  258. }
  259. void SUBnoteUI::cb_bwidthscale(Fl_Value_Slider* o, void* v) {
  260. ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_bwidthscale_i(o,v);
  261. }
  262. void SUBnoteUI::cb_filtere_i(Fl_Check_Button* o, void*) {
  263. pars->PGlobalFilterEnabled=o->value();
  264. if (o->value()==0) globalfiltergroup->deactivate();
  265. else globalfiltergroup->activate();
  266. o->show();
  267. globalfiltergroup->redraw();
  268. }
  269. void SUBnoteUI::cb_filtere(Fl_Check_Button* o, void* v) {
  270. ((SUBnoteUI*)(o->parent()->user_data()))->cb_filtere_i(o,v);
  271. }
  272. void SUBnoteUI::cb_C_i(Fl_Button*, void*) {
  273. presetsui->copy(pars);
  274. }
  275. void SUBnoteUI::cb_C(Fl_Button* o, void* v) {
  276. ((SUBnoteUI*)(o->parent()->user_data()))->cb_C_i(o,v);
  277. }
  278. void SUBnoteUI::cb_P_i(Fl_Button*, void*) {
  279. presetsui->paste(pars,this);
  280. }
  281. void SUBnoteUI::cb_P(Fl_Button* o, void* v) {
  282. ((SUBnoteUI*)(o->parent()->user_data()))->cb_P_i(o,v);
  283. }
  284. Fl_Double_Window* SUBnoteUI::make_window() {
  285. { SUBparameters = new Fl_Double_Window(735, 390, "SUBsynth Parameters");
  286. SUBparameters->user_data((void*)(this));
  287. { Fl_Scroll* o = new Fl_Scroll(5, 140, 435, 245, "scroll");
  288. o->type(1);
  289. o->box(FL_FLAT_BOX);
  290. o->labeltype(FL_NO_LABEL);
  291. { Fl_Pack* o = harmonics = new Fl_Pack(10, 145, 425, 235);
  292. harmonics->type(1);
  293. for (int i=0;i<MAX_SUB_HARMONICS;i++){h[i]=new SUBnoteharmonic(0,0,15,o->h(),"");h[i]->init(pars,i);}
  294. harmonics->end();
  295. } // Fl_Pack* harmonics
  296. o->end();
  297. } // Fl_Scroll* o
  298. { Fl_Button* o = new Fl_Button(625, 365, 105, 20, "Close");
  299. o->box(FL_THIN_UP_BOX);
  300. o->labelfont(1);
  301. o->labelsize(11);
  302. o->callback((Fl_Callback*)cb_Close);
  303. } // Fl_Button* o
  304. { Fl_Group* o = new Fl_Group(5, 5, 215, 135, "AMPLITUDE");
  305. o->box(FL_UP_FRAME);
  306. o->labeltype(FL_EMBOSSED_LABEL);
  307. o->labelfont(1);
  308. o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE));
  309. { Fl_Value_Slider* o = vol = new Fl_Value_Slider(10, 25, 140, 15, "Vol");
  310. vol->tooltip("Volume");
  311. vol->type(5);
  312. vol->box(FL_NO_BOX);
  313. vol->labelsize(11);
  314. vol->maximum(127);
  315. vol->step(1);
  316. vol->callback((Fl_Callback*)cb_vol);
  317. vol->align(Fl_Align(FL_ALIGN_RIGHT));
  318. o->value(pars->PVolume);
  319. } // Fl_Value_Slider* vol
  320. { Fl_Value_Slider* o = vsns = new Fl_Value_Slider(10, 45, 140, 15, "V.Sns");
  321. vsns->tooltip("Velocity Sensing Function (rightmost to disable)");
  322. vsns->type(5);
  323. vsns->box(FL_NO_BOX);
  324. vsns->labelsize(11);
  325. vsns->maximum(127);
  326. vsns->step(1);
  327. vsns->callback((Fl_Callback*)cb_vsns);
  328. vsns->align(Fl_Align(FL_ALIGN_RIGHT));
  329. o->value(pars->PAmpVelocityScaleFunction);
  330. } // Fl_Value_Slider* vsns
  331. { WidgetPDial* o = pan = new WidgetPDial(185, 20, 30, 30, "Pan");
  332. pan->tooltip("Panning (leftmost is Random)");
  333. pan->box(FL_ROUND_UP_BOX);
  334. pan->color(FL_BACKGROUND_COLOR);
  335. pan->selection_color(FL_INACTIVE_COLOR);
  336. pan->labeltype(FL_NORMAL_LABEL);
  337. pan->labelfont(0);
  338. pan->labelsize(10);
  339. pan->labelcolor(FL_FOREGROUND_COLOR);
  340. pan->maximum(127);
  341. pan->step(1);
  342. pan->callback((Fl_Callback*)cb_pan);
  343. pan->align(Fl_Align(FL_ALIGN_BOTTOM));
  344. pan->when(FL_WHEN_CHANGED);
  345. o->value(pars->PPanning);
  346. } // WidgetPDial* pan
  347. { EnvelopeUI* o = ampenv = new EnvelopeUI(10, 65, 205, 70, "SUBsynth - Amplitude Envelope");
  348. ampenv->box(FL_FLAT_BOX);
  349. ampenv->color((Fl_Color)51);
  350. ampenv->selection_color(FL_BACKGROUND_COLOR);
  351. ampenv->labeltype(FL_NORMAL_LABEL);
  352. ampenv->labelfont(0);
  353. ampenv->labelsize(14);
  354. ampenv->labelcolor(FL_FOREGROUND_COLOR);
  355. ampenv->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE));
  356. ampenv->when(FL_WHEN_RELEASE);
  357. o->init(pars->AmpEnvelope);
  358. ampenv->end();
  359. } // EnvelopeUI* ampenv
  360. o->end();
  361. } // Fl_Group* o
  362. { Fl_Group* o = new Fl_Group(495, 325, 235, 35);
  363. o->box(FL_UP_FRAME);
  364. { Fl_Counter* o = filterstages = new Fl_Counter(515, 340, 45, 15, "Filter Stages");
  365. filterstages->tooltip("How many times the noise is filtered");
  366. filterstages->type(1);
  367. filterstages->labelfont(1);
  368. filterstages->labelsize(10);
  369. filterstages->minimum(1);
  370. filterstages->maximum(5);
  371. filterstages->step(1);
  372. filterstages->textsize(10);
  373. filterstages->callback((Fl_Callback*)cb_filterstages);
  374. filterstages->align(Fl_Align(FL_ALIGN_TOP));
  375. o->value(pars->Pnumstages);
  376. } // Fl_Counter* filterstages
  377. { Fl_Choice* o = magtype = new Fl_Choice(585, 340, 65, 15, "Mag.Type");
  378. magtype->down_box(FL_BORDER_BOX);
  379. magtype->labelfont(1);
  380. magtype->labelsize(10);
  381. magtype->textsize(11);
  382. magtype->callback((Fl_Callback*)cb_magtype);
  383. magtype->align(Fl_Align(FL_ALIGN_TOP));
  384. magtype->menu(menu_magtype);
  385. o->value(pars->Phmagtype);
  386. } // Fl_Choice* magtype
  387. { Fl_Choice* o = start = new Fl_Choice(670, 340, 50, 15, "Start");
  388. start->down_box(FL_BORDER_BOX);
  389. start->labelfont(1);
  390. start->labelsize(10);
  391. start->textsize(11);
  392. start->callback((Fl_Callback*)cb_start);
  393. start->align(Fl_Align(FL_ALIGN_TOP));
  394. start->menu(menu_start);
  395. o->value(pars->Pstart);
  396. } // Fl_Choice* start
  397. o->end();
  398. } // Fl_Group* o
  399. { freqsettingsui = new Fl_Group(440, 5, 290, 135, "FREQUENCY");
  400. freqsettingsui->box(FL_UP_FRAME);
  401. freqsettingsui->labeltype(FL_EMBOSSED_LABEL);
  402. freqsettingsui->labelfont(1);
  403. freqsettingsui->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE));
  404. { EnvelopeUI* o = freqenvelopegroup = new EnvelopeUI(445, 65, 205, 70, "SUBsynth - Frequency Envelope");
  405. freqenvelopegroup->box(FL_FLAT_BOX);
  406. freqenvelopegroup->color((Fl_Color)51);
  407. freqenvelopegroup->selection_color(FL_BACKGROUND_COLOR);
  408. freqenvelopegroup->labeltype(FL_NORMAL_LABEL);
  409. freqenvelopegroup->labelfont(0);
  410. freqenvelopegroup->labelsize(14);
  411. freqenvelopegroup->labelcolor(FL_FOREGROUND_COLOR);
  412. freqenvelopegroup->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE));
  413. freqenvelopegroup->when(FL_WHEN_RELEASE);
  414. o->init(pars->FreqEnvelope);
  415. if (pars->PFreqEnvelopeEnabled==0) o->deactivate();
  416. freqenvelopegroup->end();
  417. } // EnvelopeUI* freqenvelopegroup
  418. { Fl_Check_Button* o = freqee = new Fl_Check_Button(445, 68, 55, 15, "Enabled");
  419. freqee->down_box(FL_DOWN_BOX);
  420. freqee->labelfont(1);
  421. freqee->labelsize(10);
  422. freqee->callback((Fl_Callback*)cb_freqee);
  423. o->value(pars->PFreqEnvelopeEnabled);
  424. } // Fl_Check_Button* freqee
  425. { Fl_Counter* o = octave = new Fl_Counter(670, 50, 45, 15, "Octave");
  426. octave->tooltip("Octave");
  427. octave->type(1);
  428. octave->labelsize(10);
  429. octave->minimum(-8);
  430. octave->maximum(7);
  431. octave->step(1);
  432. octave->textfont(1);
  433. octave->textsize(11);
  434. octave->callback((Fl_Callback*)cb_octave);
  435. octave->align(Fl_Align(FL_ALIGN_TOP));
  436. int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;
  437. o->value(k);
  438. } // Fl_Counter* octave
  439. { Fl_Counter* o = coarsedet = new Fl_Counter(655, 115, 60, 20, "Coarse Det.");
  440. coarsedet->tooltip("Coarse Detune");
  441. coarsedet->labelsize(10);
  442. coarsedet->minimum(-64);
  443. coarsedet->maximum(63);
  444. coarsedet->step(1);
  445. coarsedet->textfont(1);
  446. coarsedet->textsize(11);
  447. coarsedet->callback((Fl_Callback*)cb_coarsedet);
  448. coarsedet->align(Fl_Align(FL_ALIGN_TOP));
  449. int k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;
  450. o->value(k);
  451. o->lstep(10);
  452. } // Fl_Counter* coarsedet
  453. { Fl_Slider* o = detune = new Fl_Slider(495, 25, 230, 15);
  454. detune->tooltip("Fine Detune (cents)");
  455. detune->type(5);
  456. detune->box(FL_NO_BOX);
  457. detune->minimum(-8192);
  458. detune->maximum(8191);
  459. detune->step(1);
  460. detune->callback((Fl_Callback*)cb_detune);
  461. o->value(pars->PDetune-8192);
  462. } // Fl_Slider* detune
  463. { Fl_Value_Output* o = detunevalueoutput = new Fl_Value_Output(448, 25, 45, 15, "Detune");
  464. detunevalueoutput->labelsize(10);
  465. detunevalueoutput->minimum(-5000);
  466. detunevalueoutput->maximum(5000);
  467. detunevalueoutput->step(0.01);
  468. detunevalueoutput->textfont(1);
  469. detunevalueoutput->textsize(10);
  470. detunevalueoutput->callback((Fl_Callback*)cb_detunevalueoutput);
  471. detunevalueoutput->align(Fl_Align(FL_ALIGN_TOP_LEFT));
  472. o->value(getdetune(pars->PDetuneType,0,pars->PDetune));
  473. } // Fl_Value_Output* detunevalueoutput
  474. { Fl_Check_Button* o = hz440 = new Fl_Check_Button(555, 45, 50, 15, "440Hz");
  475. hz440->tooltip("set the base frequency to 440Hz");
  476. hz440->down_box(FL_DOWN_BOX);
  477. hz440->labelfont(1);
  478. hz440->labelsize(10);
  479. hz440->callback((Fl_Callback*)cb_hz440);
  480. o->value(pars->Pfixedfreq);
  481. } // Fl_Check_Button* hz440
  482. { WidgetPDial* o = fixedfreqetdial = new WidgetPDial(610, 45, 15, 15, "Eq.T.");
  483. fixedfreqetdial->tooltip("How the frequency varies acording to the keyboard (leftmost for fixed frequen\
  484. cy)");
  485. fixedfreqetdial->box(FL_ROUND_UP_BOX);
  486. fixedfreqetdial->color(FL_BACKGROUND_COLOR);
  487. fixedfreqetdial->selection_color(FL_INACTIVE_COLOR);
  488. fixedfreqetdial->labeltype(FL_NORMAL_LABEL);
  489. fixedfreqetdial->labelfont(0);
  490. fixedfreqetdial->labelsize(10);
  491. fixedfreqetdial->labelcolor(FL_FOREGROUND_COLOR);
  492. fixedfreqetdial->maximum(127);
  493. fixedfreqetdial->step(1);
  494. fixedfreqetdial->callback((Fl_Callback*)cb_fixedfreqetdial);
  495. fixedfreqetdial->align(Fl_Align(FL_ALIGN_RIGHT));
  496. fixedfreqetdial->when(FL_WHEN_CHANGED);
  497. o->value(pars->PfixedfreqET);
  498. if (pars->Pfixedfreq==0) o->deactivate();
  499. } // WidgetPDial* fixedfreqetdial
  500. { Fl_Choice* o = detunetype = new Fl_Choice(655, 85, 70, 15, "Detune Type");
  501. detunetype->down_box(FL_BORDER_BOX);
  502. detunetype->labelsize(10);
  503. detunetype->textfont(1);
  504. detunetype->textsize(10);
  505. detunetype->callback((Fl_Callback*)cb_detunetype);
  506. detunetype->align(Fl_Align(FL_ALIGN_TOP_LEFT));
  507. o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents");
  508. o->value(pars->PDetuneType-1);
  509. } // Fl_Choice* detunetype
  510. freqsettingsui->end();
  511. } // Fl_Group* freqsettingsui
  512. { Fl_Check_Button* o = stereo = new Fl_Check_Button(440, 325, 55, 35, "Stereo");
  513. stereo->box(FL_THIN_UP_BOX);
  514. stereo->down_box(FL_DOWN_BOX);
  515. stereo->labelsize(10);
  516. stereo->callback((Fl_Callback*)cb_stereo);
  517. o->value(pars->Pstereo);
  518. } // Fl_Check_Button* stereo
  519. { Fl_Button* o = new Fl_Button(445, 365, 70, 20, "Clear");
  520. o->tooltip("Clear the harmonics");
  521. o->box(FL_THIN_UP_BOX);
  522. o->labelfont(1);
  523. o->labelsize(11);
  524. o->callback((Fl_Callback*)cb_Clear);
  525. } // Fl_Button* o
  526. { bandwidthsettingsui = new Fl_Group(220, 5, 220, 135, "BANDWIDTH");
  527. bandwidthsettingsui->box(FL_UP_FRAME);
  528. bandwidthsettingsui->labeltype(FL_EMBOSSED_LABEL);
  529. bandwidthsettingsui->labelfont(1);
  530. bandwidthsettingsui->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE));
  531. { EnvelopeUI* o = bandwidthenvelopegroup = new EnvelopeUI(225, 65, 205, 70, "SUBsynth - BandWidth Envelope");
  532. bandwidthenvelopegroup->box(FL_FLAT_BOX);
  533. bandwidthenvelopegroup->color((Fl_Color)51);
  534. bandwidthenvelopegroup->selection_color(FL_BACKGROUND_COLOR);
  535. bandwidthenvelopegroup->labeltype(FL_NORMAL_LABEL);
  536. bandwidthenvelopegroup->labelfont(0);
  537. bandwidthenvelopegroup->labelsize(14);
  538. bandwidthenvelopegroup->labelcolor(FL_FOREGROUND_COLOR);
  539. bandwidthenvelopegroup->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE));
  540. bandwidthenvelopegroup->when(FL_WHEN_RELEASE);
  541. o->init(pars->BandWidthEnvelope);
  542. if (pars->PBandWidthEnvelopeEnabled==0) o->deactivate();
  543. bandwidthenvelopegroup->end();
  544. } // EnvelopeUI* bandwidthenvelopegroup
  545. { Fl_Check_Button* o = bwee = new Fl_Check_Button(225, 67, 55, 15, "Enabled");
  546. bwee->down_box(FL_DOWN_BOX);
  547. bwee->labelfont(1);
  548. bwee->labelsize(10);
  549. bwee->callback((Fl_Callback*)cb_bwee);
  550. o->value(pars->PBandWidthEnvelopeEnabled);
  551. } // Fl_Check_Button* bwee
  552. { Fl_Value_Slider* o = bandwidth = new Fl_Value_Slider(225, 40, 115, 15, "Band Width");
  553. bandwidth->type(5);
  554. bandwidth->box(FL_NO_BOX);
  555. bandwidth->labelsize(10);
  556. bandwidth->maximum(127);
  557. bandwidth->step(1);
  558. bandwidth->callback((Fl_Callback*)cb_bandwidth);
  559. bandwidth->align(Fl_Align(FL_ALIGN_TOP));
  560. o->value(pars->Pbandwidth);
  561. } // Fl_Value_Slider* bandwidth
  562. { Fl_Value_Slider* o = bwidthscale = new Fl_Value_Slider(345, 40, 90, 15, "B.Width Scale");
  563. bwidthscale->tooltip("How much I increase the BandWidth according to lower/higher harmonics");
  564. bwidthscale->type(5);
  565. bwidthscale->box(FL_NO_BOX);
  566. bwidthscale->labelsize(10);
  567. bwidthscale->minimum(-64);
  568. bwidthscale->maximum(63);
  569. bwidthscale->step(1);
  570. bwidthscale->callback((Fl_Callback*)cb_bwidthscale);
  571. bwidthscale->align(Fl_Align(FL_ALIGN_TOP));
  572. o->value(pars->Pbwscale-64);
  573. } // Fl_Value_Slider* bwidthscale
  574. bandwidthsettingsui->end();
  575. } // Fl_Group* bandwidthsettingsui
  576. { Fl_Group* o = globalfiltergroup = new Fl_Group(440, 140, 290, 185, "FILTER");
  577. globalfiltergroup->box(FL_UP_FRAME);
  578. globalfiltergroup->labeltype(FL_EMBOSSED_LABEL);
  579. globalfiltergroup->labelfont(1);
  580. globalfiltergroup->labelsize(13);
  581. globalfiltergroup->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE));
  582. { EnvelopeUI* o = filterenv = new EnvelopeUI(445, 250, 275, 70, "SUBsynth - Filter Envelope");
  583. filterenv->box(FL_FLAT_BOX);
  584. filterenv->color((Fl_Color)51);
  585. filterenv->selection_color(FL_BACKGROUND_COLOR);
  586. filterenv->labeltype(FL_NORMAL_LABEL);
  587. filterenv->labelfont(0);
  588. filterenv->labelsize(14);
  589. filterenv->labelcolor(FL_FOREGROUND_COLOR);
  590. filterenv->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE));
  591. filterenv->when(FL_WHEN_RELEASE);
  592. o->init(pars->GlobalFilterEnvelope);
  593. filterenv->end();
  594. } // EnvelopeUI* filterenv
  595. { FilterUI* o = filterui = new FilterUI(445, 165, 275, 75, "SUBsynthl - Filter");
  596. filterui->box(FL_FLAT_BOX);
  597. filterui->color(FL_LIGHT1);
  598. filterui->selection_color(FL_BACKGROUND_COLOR);
  599. filterui->labeltype(FL_NORMAL_LABEL);
  600. filterui->labelfont(0);
  601. filterui->labelsize(14);
  602. filterui->labelcolor(FL_FOREGROUND_COLOR);
  603. filterui->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE));
  604. filterui->when(FL_WHEN_RELEASE);
  605. o->init(pars->GlobalFilter,&pars->PGlobalFilterVelocityScale,&pars->PGlobalFilterVelocityScaleFunction);
  606. filterui->end();
  607. } // FilterUI* filterui
  608. if (pars->PGlobalFilterEnabled==0) o->deactivate();
  609. globalfiltergroup->end();
  610. } // Fl_Group* globalfiltergroup
  611. { Fl_Check_Button* o = filtere = new Fl_Check_Button(445, 145, 85, 20, "Enabled");
  612. filtere->down_box(FL_DOWN_BOX);
  613. filtere->labelfont(1);
  614. filtere->labelsize(11);
  615. filtere->callback((Fl_Callback*)cb_filtere);
  616. o->value(pars->PGlobalFilterEnabled);
  617. } // Fl_Check_Button* filtere
  618. { Fl_Button* o = new Fl_Button(540, 370, 25, 15, "C");
  619. o->box(FL_THIN_UP_BOX);
  620. o->color((Fl_Color)179);
  621. o->labelfont(1);
  622. o->labelsize(11);
  623. o->labelcolor(FL_BACKGROUND2_COLOR);
  624. o->callback((Fl_Callback*)cb_C);
  625. } // Fl_Button* o
  626. { Fl_Button* o = new Fl_Button(570, 370, 25, 15, "P");
  627. o->box(FL_THIN_UP_BOX);
  628. o->color((Fl_Color)179);
  629. o->labelfont(1);
  630. o->labelsize(11);
  631. o->labelcolor(FL_BACKGROUND2_COLOR);
  632. o->callback((Fl_Callback*)cb_P);
  633. } // Fl_Button* o
  634. SUBparameters->end();
  635. } // Fl_Double_Window* SUBparameters
  636. return SUBparameters;
  637. }
  638. void SUBnoteUI::refresh() {
  639. for (int i=0;i<MAX_SUB_HARMONICS;i++) h[i]->refresh();
  640. vol->value(pars->PVolume);
  641. vsns->value(pars->PAmpVelocityScaleFunction);
  642. pan->value(pars->PPanning);
  643. bandwidth->value(pars->Pbandwidth);
  644. bwidthscale->value(pars->Pbwscale-64);
  645. bwee->value(pars->PBandWidthEnvelopeEnabled);
  646. if (pars->PBandWidthEnvelopeEnabled==0) bandwidthenvelopegroup->deactivate();
  647. else bandwidthenvelopegroup->activate();
  648. bwee->show();
  649. bandwidthsettingsui->redraw();
  650. detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune));
  651. freqee->value(pars->PFreqEnvelopeEnabled);
  652. if (pars->PFreqEnvelopeEnabled==0) freqenvelopegroup->deactivate();
  653. else freqenvelopegroup->activate();
  654. freqee->show();
  655. freqsettingsui->redraw();
  656. detune->value(pars->PDetune-8192);
  657. hz440->value(pars->Pfixedfreq);
  658. fixedfreqetdial->value(pars->PfixedfreqET);
  659. int k=pars->PCoarseDetune/1024;if (k>=8) k-=16;
  660. octave->value(k);
  661. detunetype->value(pars->PDetuneType-1);
  662. k=pars->PCoarseDetune%1024;if (k>=512) k-=1024;
  663. coarsedet->value(k);
  664. filtere->value(pars->PGlobalFilterEnabled);
  665. if (pars->PGlobalFilterEnabled==0) globalfiltergroup->deactivate();
  666. else globalfiltergroup->activate();
  667. filtere->show();
  668. globalfiltergroup->redraw();
  669. stereo->value(pars->Pstereo);
  670. filterstages->value(pars->Pnumstages);
  671. magtype->value(pars->Phmagtype);
  672. start->value(pars->Pstart);
  673. ampenv->refresh();
  674. bandwidthenvelopegroup->refresh();
  675. freqenvelopegroup->refresh();
  676. filterui->refresh();
  677. filterenv->refresh();
  678. }
  679. SUBnoteUI::SUBnoteUI(SUBnoteParameters *parameters) {
  680. pars=parameters;
  681. make_window();
  682. }
  683. SUBnoteUI::~SUBnoteUI() {
  684. //for (int i=0;i<MAX_SUB_HARMONICS;i++) delete (h[i]);
  685. SUBparameters->hide();
  686. delete(SUBparameters);
  687. }