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.

934 lines
29KB

  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0110
  3. header_name {.h}
  4. code_name {.cxx}
  5. decl {//Copyright (c) Nasca Octavian Paul. Released under GNU General Public License version 2} {public
  6. }
  7. decl {\#include <FL/Fl_File_Chooser.H>} {}
  8. decl {\#include <FL/Fl_Box.H>} {public
  9. }
  10. decl {\#include <FL/Fl_Group.H>} {public
  11. }
  12. decl {\#include <FL/Fl_Box.H>} {public
  13. }
  14. decl {\#include <FL/fl_draw.H>} {public
  15. }
  16. decl {\#include <FL/Fl_Value_Input.H>} {public
  17. }
  18. decl {\#include <FL/fl_ask.H>} {public
  19. }
  20. decl {\#include<sys/stat.h>} {}
  21. decl {\#include <stdio.h>} {}
  22. decl {\#include <string>} {}
  23. decl {\#include <math.h>} {}
  24. decl {\#include "Control.h"} {public
  25. }
  26. decl {\#include "FreeEditUI.h"} {public
  27. }
  28. decl {\#include "version.h"} {public
  29. }
  30. Function {hex4n(char c)} {return_type int
  31. } {
  32. code {if (c>96) c-=32;
  33. if ((c>='0')||(c<='9')) return (c-'0');
  34. if ((c>='A')||(c<='F')) return (c-'A')+10;
  35. return 0;} {}
  36. }
  37. Function {unescape(std::string s)} {return_type {std::string}
  38. } {
  39. code {std::string result;
  40. int slen=s.size();
  41. s+=" ";
  42. int sk=0;
  43. while (sk<slen){
  44. char c=s[sk];
  45. if (c=='%'){
  46. char c1=s[++sk];
  47. char c2=s[++sk];
  48. result+=(char)(16*hex4n(c1)+hex4n(c2));
  49. sk++;
  50. }else{
  51. result+=c;
  52. sk++;
  53. };
  54. };
  55. //printf("%s\\n%s\\n",s.c_str(),result.c_str());
  56. return result;} {}
  57. }
  58. class DDBox {: {public Fl_Box}
  59. } {
  60. Function {DDBox(int x, int y, int w, int h, const char *label = 0):Fl_Box(x,y,w,h,label)} {open
  61. } {
  62. code {new_drag_file=false;} {}
  63. }
  64. Function {handle(int event)} {open return_type int
  65. } {
  66. code {if ((event==FL_DND_ENTER)||(event==FL_DND_DRAG)||(event==FL_DND_RELEASE)) return 1;
  67. if (event==FL_PASTE){
  68. const char *url=Fl::event_text();
  69. if (strstr(url,"file://")!=url) return 0;//is not a file
  70. std::string filename=url+7;
  71. for (int i=0;i<filename.size();i++) if (filename[i]<32) filename[i]=0;
  72. drag_file=unescape(filename);
  73. new_drag_file=true;
  74. return 1;
  75. };
  76. return Fl_Box::handle(event);} {}
  77. }
  78. decl {std::string drag_file;} {public
  79. }
  80. decl {bool new_drag_file;} {public
  81. }
  82. }
  83. class GUI {open
  84. } {
  85. decl {enum Mode {STOP,PLAY,PAUSE,FREEZE};} {}
  86. Function {GUI()} {} {
  87. code {playing_for_button=false;
  88. eof_for_button=false;
  89. rendering=false;
  90. make_window();
  91. tick(this);
  92. refresh();
  93. set_mode(STOP);} {}
  94. }
  95. Function {~GUI()} {} {
  96. code {Fl::remove_timeout(tick,this);} {}
  97. }
  98. Function {open_input_file(const char *filename)} {open
  99. } {
  100. code {const char *ext=fl_filename_ext(filename);
  101. FILE_TYPE intype=FILE_WAV;
  102. if ((strcmp(ext,".ogg")==0)||(strcmp(ext,".OGG")==0)||(strcmp(ext,".Ogg")==0)) intype=FILE_VORBIS;
  103. if ((strcmp(ext,".mp3")==0)||(strcmp(ext,".MP3")==0)||(strcmp(ext,".Mp3")==0)) intype=FILE_MP3;
  104. bool result=control.set_input_filename(filename,intype);
  105. if (result) {
  106. infilename_output->copy_label(control.get_input_filename_and_info().c_str());
  107. } else {
  108. infilename_output->copy_label("");
  109. fl_alert("Error: Could not open audio file:\\n%s",filename);
  110. };
  111. refresh();} {}
  112. }
  113. Function {render()} {open
  114. } {
  115. code {render_button->deactivate();
  116. rendering=true;
  117. render_percent_slider->value(0);
  118. render_percent_slider->activate();
  119. cancel_render_button->activate();
  120. //char defaultfile[FL_PATH_MAX];
  121. //fl_filename_absolute(defaultfile,control.get_recommanded_output_filename().c_str());
  122. Fl_File_Chooser *fc=new Fl_File_Chooser(NULL,"Wave files (*.wav)\\tOgg Vorbis (*.ogg)",Fl_File_Chooser::CREATE,"Render to audio file...");
  123. fc->preview(0);
  124. fc->filter_value(0);
  125. fc->ok_label("Render");
  126. fc->show();
  127. while (fc->visible()){
  128. Fl::wait();
  129. };
  130. const char *newfile = fc->value();
  131. if (newfile != NULL) {
  132. if (file_exists(newfile)){
  133. if (!fl_choice("The file exists. \\nOverwrite it?","No","Yes",NULL)) return;
  134. };
  135. FILE_TYPE type=FILE_WAV;
  136. if (fc->filter_value()==1) type=FILE_VORBIS;
  137. const char *ext=fl_filename_ext(newfile);
  138. std::string outfilename=newfile;
  139. if (strlen(ext)==0){
  140. if (type==FILE_VORBIS) outfilename+=".ogg";
  141. else outfilename+=".wav";
  142. };
  143. render_percent_slider->copy_label(outfilename.c_str());
  144. FILE_TYPE intype=FILE_WAV;
  145. {
  146. const char *ext=fl_filename_ext(control.get_input_filename().c_str());
  147. if ((strcmp(ext,".ogg")==0)||(strcmp(ext,".OGG")==0)||(strcmp(ext,".Ogg")==0)) intype=FILE_VORBIS;
  148. if ((strcmp(ext,".MP3")==0)||(strcmp(ext,".mp3")==0)||(strcmp(ext,".Mp3")==0)) intype=FILE_MP3;
  149. };
  150. const char *outstr=control.Render(control.get_input_filename(),outfilename,type,intype,
  151. selection_pos1->value()/100.0,selection_pos2->value()/100.0).c_str();
  152. if (strlen(outstr)!=0) fl_alert("%s",outstr);
  153. };
  154. delete fc;
  155. render_button->activate();
  156. render_percent_slider->value(0);
  157. render_percent_slider->deactivate();
  158. render_percent_slider->label("");
  159. cancel_render_button->deactivate();
  160. rendering=false;} {}
  161. }
  162. Function {make_window()} {open private
  163. } {
  164. Fl_Window window {
  165. label {Paul's Extreme Sound Stretch} open
  166. xywh {54 265 995 550} type Double resizable
  167. code0 {if(strlen(VERSION)<2) {o->color(FL_BLUE); o->label("VERSION NOT SET!!!!!!!!!!!!");};} visible
  168. } {
  169. Fl_Menu_Bar {} {open
  170. xywh {0 0 1015 20}
  171. } {
  172. Submenu {} {
  173. label File open
  174. xywh {0 0 63 20}
  175. } {
  176. MenuItem {} {
  177. label {Open audio file...}
  178. callback {char *newfile = fl_file_chooser("Open Audio(ogg,wav,mp3) File?", NULL, NULL);
  179. if (newfile != NULL) {
  180. open_input_file(newfile);
  181. };
  182. selection_pos1->value(0.0);
  183. selection_pos2->value(100.0);
  184. refresh();}
  185. xywh {0 0 30 20}
  186. }
  187. MenuItem render_menu {
  188. label {Render and save audio file...}
  189. callback {selection_pos1->value(0.0);
  190. selection_pos2->value(100.0);
  191. tabs_widget->value(write_to_file_group);
  192. render();}
  193. xywh {10 10 30 20} deactivate divider
  194. }
  195. MenuItem {} {
  196. label {Open Parameters...}
  197. callback {char *newfile = fl_file_chooser("Open Parameter File?", "PaulStretch XML (*.psx)\\tAll Files (*)", NULL);
  198. if (newfile != NULL) {
  199. set_mode(STOP);
  200. control.stopplay();
  201. if (!control.load_parameters(newfile)){
  202. fl_alert("Error: Could not load parameter file:\\n%s",newfile);
  203. };
  204. };
  205. refreshgui();
  206. refresh();}
  207. xywh {10 10 30 20}
  208. }
  209. MenuItem {} {
  210. label {Save Parameters...}
  211. callback {char *newfile = fl_file_chooser("Save Parameters(paulstretch) File?", "PaulStretch XML (*.psx)\\tAll Files (*)", NULL);
  212. if (newfile != NULL) {
  213. if (file_exists(newfile)){
  214. if (!fl_choice("The file exists. \\nOverwrite it?","No","Yes",NULL)) return;
  215. };
  216. control.save_parameters(newfile);
  217. };
  218. refresh();}
  219. xywh {20 20 30 20} divider
  220. }
  221. MenuItem {} {
  222. label Exit
  223. callback {window->hide();}
  224. xywh {0 0 30 20}
  225. }
  226. }
  227. Submenu {} {
  228. label About
  229. xywh {15 15 63 20}
  230. } {
  231. MenuItem {} {
  232. label {About...}
  233. callback {aboutwindow->show();}
  234. xywh {15 15 30 20}
  235. }
  236. }
  237. }
  238. Fl_Tabs tabs_widget {open
  239. xywh {5 50 985 420} box BORDER_BOX
  240. } {
  241. Fl_Group {} {
  242. label Parameters open selected
  243. xywh {5 70 985 400}
  244. } {
  245. Fl_Slider stretch_slider {
  246. label {Stretch:}
  247. callback {refresh();
  248. control.update_player_stretch();}
  249. xywh {10 89 975 15} type {Horz Knob} box FLAT_BOX align 6 value 0.29
  250. }
  251. Fl_Slider fftsize_slider {
  252. label {Window Size:}
  253. callback {refresh();
  254. o->labelcolor(FL_BLUE);}
  255. xywh {10 155 975 15} type {Horz Knob} box FLAT_BOX align 6 value 0.47
  256. }
  257. Fl_Choice mode_choice {
  258. label {Mode:}
  259. callback {refresh();}
  260. xywh {850 110 135 20} down_box BORDER_BOX
  261. } {
  262. MenuItem {} {
  263. label Stretch
  264. xywh {10 10 30 20}
  265. }
  266. MenuItem {} {
  267. label HyperStretch
  268. xywh {20 20 30 20}
  269. }
  270. MenuItem {} {
  271. label Shorten
  272. xywh {0 0 30 20}
  273. }
  274. }
  275. Fl_Choice window_choice {
  276. label {Type:}
  277. callback {FFTWindow w=W_RECTANGULAR;
  278. switch(o->value()){
  279. case 0:
  280. w=W_RECTANGULAR;
  281. break;
  282. case 1:
  283. w=W_HAMMING;
  284. break;
  285. case 2:
  286. w=W_HANN;
  287. break;
  288. case 3:
  289. w=W_BLACKMAN;
  290. break;
  291. case 4:
  292. w=W_BLACKMAN_HARRIS;
  293. break;
  294. };
  295. control.set_window_type(w);
  296. refresh();}
  297. xywh {850 185 135 20} down_box BORDER_BOX when 1
  298. code0 {o->value(2);}
  299. } {
  300. MenuItem {} {
  301. label Rectangular
  302. xywh {40 40 30 20}
  303. }
  304. MenuItem {} {
  305. label Hamming
  306. xywh {30 30 30 20}
  307. }
  308. MenuItem {} {
  309. label Hann
  310. xywh {10 10 30 20}
  311. }
  312. MenuItem {} {
  313. label Blackman
  314. xywh {20 20 30 20}
  315. }
  316. MenuItem {} {
  317. label BlackmanHarris
  318. xywh {30 30 30 20}
  319. }
  320. }
  321. Fl_Button {} {
  322. label S
  323. callback {char tmp[100];
  324. snprintf(tmp,100,"%g",control.get_stretch());
  325. const char *result=fl_input("Enter the stretch value",tmp);
  326. if (!result) return;
  327. double str=atof(result);
  328. if (str<1e-4) return;
  329. double stc=control.get_stretch_control(str,mode_choice->value());
  330. if ((stc<1e-4)||(stc>1.0)) return;
  331. stretch_slider->value(stc);
  332. stretch_slider->do_callback();}
  333. tooltip {set the stretch to a value} xywh {780 110 20 20}
  334. }
  335. Fl_Box resolution_box {
  336. xywh {10 187 790 18} box FLAT_BOX color 52 align 20
  337. }
  338. Fl_Group {} {
  339. label {Stretch Multiplier} open
  340. xywh {10 245 975 220} box THIN_UP_BOX labeltype ENGRAVED_LABEL
  341. } {
  342. Fl_Box stretch_free_edit {
  343. label Graph
  344. xywh {105 250 875 210} box FLAT_BOX color 17
  345. code0 {o->init(&control.ppar.stretch_multiplier,&control);}
  346. class FreeEditUI
  347. }
  348. Fl_Group stretch_multiplier_control {open
  349. xywh {15 250 85 210} box BORDER_FRAME color 0 align 208
  350. code0 {o->init(stretch_free_edit,FE_LINEAR,0,100.0,FE_LOG,0.1,50.0,1.0);}
  351. class FreeEditControls
  352. } {}
  353. }
  354. }
  355. Fl_Group {} {
  356. label Process
  357. xywh {5 70 985 400} hide
  358. } {
  359. Fl_Group {} {open
  360. xywh {165 75 105 65} box BORDER_BOX
  361. } {
  362. Fl_Check_Button pitch_shift_enabled {
  363. label {Pitch Shift}
  364. callback {control.ppar.pitch_shift.enabled=o->value();
  365. control.update_process_parameters();}
  366. xywh {170 80 90 15} down_box DOWN_BOX labelfont 1
  367. }
  368. Fl_Counter pitch_shift_cents {
  369. label cents
  370. callback {control.ppar.pitch_shift.cents=(int)o->value();
  371. control.update_process_parameters();}
  372. xywh {170 100 90 20} minimum -3600 maximum 3600 step 1
  373. code0 {o->lstep(100);}
  374. }
  375. }
  376. Fl_Group {} {open
  377. xywh {275 75 135 100} box BORDER_BOX
  378. } {
  379. Fl_Check_Button octave_enabled {
  380. label {Octave Mixer}
  381. callback {control.ppar.octave.enabled=o->value();
  382. control.update_process_parameters();}
  383. xywh {280 80 110 15} down_box DOWN_BOX labelfont 1
  384. }
  385. Fl_Slider octave_om2 {
  386. label {-2}
  387. callback {control.ppar.octave.om2=pow(o->value(),2.0);
  388. control.update_process_parameters();}
  389. tooltip {2 octaves below} xywh {280 100 15 55} type {Vert Knob} minimum 1 maximum 0
  390. }
  391. Fl_Slider octave_om1 {
  392. label {-1}
  393. callback {control.ppar.octave.om1=pow(o->value(),2.0);
  394. control.update_process_parameters();}
  395. tooltip {1 octave below} xywh {300 100 15 55} type {Vert Knob} minimum 1 maximum 0
  396. }
  397. Fl_Slider octave_o0 {
  398. label 0
  399. callback {control.ppar.octave.o0=pow(o->value(),2.0);
  400. control.update_process_parameters();}
  401. tooltip {original (dry)} xywh {320 100 15 55} type {Vert Knob} minimum 1 maximum 0 value 1
  402. }
  403. Fl_Slider octave_o1 {
  404. label 1
  405. callback {control.ppar.octave.o1=pow(o->value(),2.0);
  406. control.update_process_parameters();}
  407. tooltip {1 octave above} xywh {340 100 15 55} type {Vert Knob} minimum 1 maximum 0
  408. }
  409. Fl_Slider octave_o15 {
  410. label {1.5}
  411. callback {control.ppar.octave.o15=pow(o->value(),2.0);
  412. control.update_process_parameters();}
  413. tooltip {3rd harmonic} xywh {360 100 15 55} type {Vert Knob} minimum 1 maximum 0
  414. }
  415. Fl_Slider octave_o2 {
  416. label 2
  417. callback {control.ppar.octave.o2=pow(o->value(),2.0);
  418. control.update_process_parameters();}
  419. tooltip {2 octaves above} xywh {380 100 15 55} type {Vert Knob} minimum 1 maximum 0
  420. }
  421. }
  422. Fl_Group {} {open
  423. xywh {165 140 105 65} box BORDER_BOX
  424. } {
  425. Fl_Check_Button freq_shift_enabled {
  426. label {Freq Shift}
  427. callback {control.ppar.freq_shift.enabled=o->value();
  428. control.update_process_parameters();}
  429. xywh {170 145 90 15} down_box DOWN_BOX labelfont 1
  430. }
  431. Fl_Counter freq_shift_Hz {
  432. label Hz
  433. callback {control.ppar.freq_shift.Hz=(int)o->value();
  434. control.update_process_parameters();}
  435. xywh {170 165 90 20} minimum -10000 maximum 10000 step 1
  436. code0 {o->lstep(100);}
  437. }
  438. }
  439. Fl_Group {} {open
  440. xywh {605 75 120 65} box BORDER_BOX
  441. } {
  442. Fl_Check_Button compressor_enabled {
  443. label Compress
  444. callback {control.ppar.compressor.enabled=o->value();
  445. control.update_process_parameters();}
  446. xywh {610 80 90 15} down_box DOWN_BOX labelfont 1
  447. }
  448. Fl_Slider compressor_power {
  449. label Power
  450. callback {control.ppar.compressor.power=o->value();
  451. control.update_process_parameters();}
  452. xywh {610 100 110 15} type {Horz Knob}
  453. }
  454. }
  455. Fl_Slider {} {
  456. label Volume
  457. callback {REALTYPE x=o->value();
  458. x=pow(10.0,pow(x,1.5)-1.0)-0.1;
  459. control.set_volume(x);}
  460. xywh {605 155 120 40} type {Horz Knob} labelfont 1 minimum 0.3 maximum 1.6 value 1
  461. }
  462. Fl_Group {} {open
  463. xywh {415 75 185 100} box BORDER_BOX
  464. } {
  465. Fl_Check_Button filter_enabled {
  466. label Filter
  467. callback {control.ppar.filter.enabled=o->value();
  468. control.update_process_parameters();}
  469. xywh {420 80 70 15} down_box DOWN_BOX labelfont 1
  470. }
  471. Fl_Value_Input filter_low {
  472. label {Freq1(Hz)}
  473. callback {control.ppar.filter.low=o->value();
  474. control.update_process_parameters();}
  475. xywh {420 101 100 24} align 8 maximum 10000
  476. }
  477. Fl_Value_Input filter_high {
  478. label {Freq2(Hz)}
  479. callback {control.ppar.filter.high=o->value();
  480. control.update_process_parameters();}
  481. xywh {420 126 100 24} align 8 maximum 25000 value 22000
  482. }
  483. Fl_Check_Button filter_stop {
  484. label BandStop
  485. callback {control.ppar.filter.stop=o->value();
  486. control.update_process_parameters();}
  487. tooltip {band-stop filter} xywh {500 80 90 15} down_box DOWN_BOX
  488. }
  489. Fl_Slider filter_hdamp {
  490. label DHF
  491. callback {control.ppar.filter.hdamp=o->value();
  492. control.update_process_parameters();}
  493. tooltip {Damp High Frequency} xywh {420 155 140 15} type {Horz Knob} align 8
  494. }
  495. }
  496. Fl_Group {} {open
  497. xywh {10 75 150 120} box BORDER_BOX
  498. } {
  499. Fl_Check_Button harmonics_enabled {
  500. label Harmonics
  501. callback {control.ppar.harmonics.enabled=o->value();
  502. control.update_process_parameters();}
  503. xywh {15 80 95 15} down_box DOWN_BOX labelfont 1
  504. }
  505. Fl_Value_Input harmonics_freq {
  506. label {F.Freq(Hz)}
  507. callback {control.ppar.harmonics.freq=o->value();
  508. control.update_process_parameters();}
  509. tooltip {fundamental frequency} xywh {15 101 65 24} align 8 minimum 1 maximum 20000 value 440
  510. }
  511. Fl_Value_Input harmonics_bandwidth {
  512. label {BW(cents)}
  513. callback {control.ppar.harmonics.bandwidth=o->value();
  514. control.update_process_parameters();}
  515. tooltip {bandwidth (cents)} xywh {15 126 65 24} align 8 minimum 0.1 maximum 200 value 25
  516. }
  517. Fl_Check_Button harmonics_gauss {
  518. label Gauss
  519. callback {control.ppar.harmonics.gauss=o->value();
  520. control.update_process_parameters();}
  521. tooltip {smooth the harmonics} xywh {85 155 65 15} down_box DOWN_BOX
  522. }
  523. Fl_Counter harmonics_nharmonics {
  524. label {no.hrm.}
  525. callback {control.ppar.harmonics.nharmonics=(int)o->value();
  526. control.update_process_parameters();}
  527. tooltip {number of harmonics} xywh {15 155 56 20} type Simple minimum 1 maximum 100 step 1 value 10
  528. }
  529. }
  530. Fl_Group {} {open
  531. xywh {275 180 325 40} box BORDER_BOX
  532. } {
  533. Fl_Check_Button spread_enabled {
  534. label Spread
  535. callback {control.ppar.spread.enabled=o->value();
  536. control.update_process_parameters();}
  537. xywh {280 185 90 15} down_box DOWN_BOX labelfont 1
  538. }
  539. Fl_Slider spread_bandwidth {
  540. label Bandwidth
  541. callback {control.ppar.spread.bandwidth=o->value();
  542. control.update_process_parameters();}
  543. xywh {360 185 230 15} type {Horz Knob} value 0.3
  544. }
  545. }
  546. Fl_Group {} {
  547. label ArbitraryFilter
  548. xywh {10 245 975 220} box THIN_UP_BOX labeltype ENGRAVED_LABEL
  549. } {
  550. Fl_Box filter_free_edit {
  551. label Graph
  552. xywh {105 250 875 210} box FLAT_BOX color 206 selection_color 0
  553. code0 {o->init(&control.ppar.free_filter,&control);}
  554. class FreeEditUI
  555. }
  556. Fl_Group arbitrary_filter_control {open
  557. xywh {15 250 85 210} box BORDER_FRAME color 0 align 208
  558. code0 {o->init(filter_free_edit,FE_LOG,20.0,25000.0,FE_DB,-60,20,0.0);}
  559. class FreeEditControls
  560. } {}
  561. }
  562. }
  563. Fl_Group {} {
  564. label {Binaural beats}
  565. xywh {5 70 985 400} box THIN_UP_BOX hide
  566. } {
  567. Fl_Box binaural_free_edit {
  568. label Graph
  569. xywh {135 75 845 390} box FLAT_BOX color 135
  570. code0 {o->init(&control.bbpar.free_edit,&control);}
  571. class FreeEditUI
  572. }
  573. Fl_Slider bbpar_mono {
  574. label Pow
  575. callback {control.bbpar.mono=o->value();
  576. control.update_process_parameters();}
  577. xywh {105 75 20 190} type {Vert Knob} labelfont 1 minimum 1 maximum 0 value 0.5
  578. }
  579. Fl_Group binaural_beats_control {
  580. label {FreeEdit Controls}
  581. xywh {10 75 80 205} box BORDER_FRAME color 47 align 208
  582. code0 {o->init(binaural_free_edit,FE_LINEAR,0,100.0,FE_LOG,0.1,50.0,8.0);}
  583. class FreeEditControls
  584. } {}
  585. Fl_Choice bbpar_stereo_mode {
  586. label {Stereo Mode}
  587. callback {control.bbpar.stereo_mode=(BB_STEREO_MODE)o->value();
  588. control.update_process_parameters();}
  589. xywh {10 305 110 20} down_box BORDER_BOX align 5
  590. } {
  591. MenuItem {} {
  592. label LeftRight
  593. xywh {10 10 36 21} labelfont 1
  594. }
  595. MenuItem {} {
  596. label RightLeft
  597. xywh {20 20 36 21} labelfont 1
  598. }
  599. MenuItem {} {
  600. label Symmetric
  601. xywh {30 30 36 21} labelfont 1
  602. }
  603. }
  604. }
  605. Fl_Group write_to_file_group {
  606. label {Write to file} open
  607. xywh {5 70 985 400} hide
  608. } {
  609. Fl_Button render_button {
  610. label {Render selection...}
  611. callback {render();}
  612. xywh {250 95 320 30} labelfont 1 labelsize 22
  613. }
  614. Fl_Value_Slider render_percent_slider {
  615. label { }
  616. xywh {15 245 970 65} type {Horz Fill} selection_color 4 align 70 maximum 100 step 0.1 textsize 14
  617. }
  618. Fl_Button cancel_render_button {
  619. label Cancel
  620. callback {if (fl_choice("Cancel audio rendering?","No","Yes",NULL)) control.info.cancel_render=true;}
  621. xywh {400 365 145 25} deactivate
  622. }
  623. Fl_Button {} {
  624. label {selection pos1}
  625. callback {selection_pos1->value(seek_slider->value());}
  626. tooltip {set selection start from Player's position} xywh {20 85 110 20} align 20
  627. }
  628. Fl_Button {} {
  629. label {selection pos2}
  630. callback {selection_pos2->value(seek_slider->value());}
  631. tooltip {set selection end from Player's position} xywh {20 110 110 20} align 20
  632. }
  633. Fl_Button {} {
  634. label {select all}
  635. callback {selection_pos1->value(0.0);
  636. selection_pos2->value(100.0);}
  637. tooltip {select the whole sound} xywh {20 135 110 20}
  638. }
  639. Fl_Value_Output selection_pos1 {
  640. label {%}
  641. xywh {135 85 70 20} align 72 maximum 100 step 0.01 textfont 1
  642. }
  643. Fl_Value_Output selection_pos2 {
  644. label {%}
  645. xywh {135 111 70 18} align 72 maximum 100 step 0.01 value 100 textfont 1
  646. }
  647. Fl_Check_Button {} {
  648. label 32bit
  649. callback {control.wav32bit=o->value();}
  650. xywh {250 135 100 15} down_box DOWN_BOX
  651. }
  652. }
  653. }
  654. Fl_Box infilename_output {
  655. tooltip {drag audio file here to open it} xywh {5 24 1005 22} box FLAT_BOX color 17 align 84
  656. class DDBox
  657. }
  658. Fl_Group {} {
  659. xywh {5 475 985 70} box BORDER_BOX
  660. } {
  661. Fl_Group {} {open
  662. xywh {10 490 190 40} box THIN_UP_BOX color 16
  663. } {
  664. Fl_Button play_button {
  665. label {@>}
  666. callback {if (control.playing_eof()&&(seek_slider->value()>99.0)){
  667. seek_slider->value(0.0);
  668. seek_slider->do_callback();
  669. };
  670. set_mode(PLAY);
  671. playing_for_button=true;
  672. eof_for_button=true;
  673. bool bypass=false;
  674. if (Fl::event_button()==FL_RIGHT_MOUSE) bypass=true;
  675. control.startplay(bypass);}
  676. tooltip Play xywh {20 500 40 20} box PLASTIC_UP_BOX
  677. }
  678. Fl_Button freeze_button {
  679. label {@<-> F}
  680. callback {control.freezeplay();
  681. set_mode(FREEZE);}
  682. tooltip Freeze xywh {65 500 40 20} box PLASTIC_UP_BOX
  683. }
  684. Fl_Button {} {
  685. label {@||}
  686. callback {set_mode(PAUSE);
  687. control.pauseplay();}
  688. tooltip Pause xywh {110 500 40 20} box PLASTIC_UP_BOX
  689. }
  690. Fl_Button {} {
  691. label {@square}
  692. callback {set_mode(STOP);
  693. control.stopplay();}
  694. tooltip Stop xywh {155 500 40 20} box PLASTIC_UP_BOX
  695. }
  696. }
  697. Fl_Value_Slider seek_slider {
  698. label Percents
  699. callback {control.set_seek_pos(o->value()/o->maximum());}
  700. xywh {205 490 780 20} type {Horz Knob} box THIN_UP_BOX color 16 selection_color 4 align 6 maximum 100 textsize 14
  701. }
  702. }
  703. }
  704. Fl_Window aboutwindow {
  705. label {About...}
  706. xywh {274 354 300 170} type Double color 7 hide modal
  707. } {
  708. Fl_Button {} {
  709. label OK
  710. callback {aboutwindow->hide();}
  711. xywh {110 140 64 20}
  712. }
  713. Fl_Box {} {
  714. label {Copyright (c) 2006-2011 Nasca Octavian PAUL, Tg. Mures, Romania}
  715. xywh {10 93 280 37} align 128
  716. }
  717. Fl_Box {} {
  718. label {This is a software for extreme time stretching of the audio.}
  719. xywh {5 53 290 32} align 128
  720. }
  721. Fl_Box {} {
  722. label {Paul's Extreme Sound Stretch}
  723. xywh {20 6 255 21} labelfont 1 align 128
  724. }
  725. Fl_Box {} {
  726. label version
  727. xywh {20 26 255 19} labelfont 1 align 128
  728. code0 {o->label(VERSION);}
  729. }
  730. }
  731. }
  732. Function {set_mode(Mode mode)} {private
  733. } {
  734. code {switch (mode){
  735. case STOP:
  736. play_button->labelcolor(FL_BLACK);
  737. mode_choice->activate();
  738. freeze_button->deactivate();
  739. break;
  740. case PAUSE:
  741. play_button->labelcolor(FL_BLACK);
  742. mode_choice->activate();
  743. break;
  744. case PLAY:
  745. play_button->labelcolor(FL_RED);
  746. mode_choice->deactivate();
  747. fftsize_slider->labelcolor(FL_BLACK);
  748. freeze_button->activate();
  749. break;
  750. case FREEZE:
  751. if (control.is_freeze()) freeze_button->labelcolor(FL_GREEN);
  752. else freeze_button->labelcolor(FL_BLACK);
  753. break;
  754. };
  755. window->redraw();} {}
  756. }
  757. Function {refresh()} {open
  758. } {
  759. code {double stretch_s=stretch_slider->value()/stretch_slider->maximum();
  760. int mode=mode_choice->value();
  761. double resolution_s=fftsize_slider->value()/fftsize_slider->maximum();
  762. control.set_stretch_controls(stretch_s,mode,resolution_s);
  763. stretch_slider->copy_label(control.get_stretch_info().c_str());
  764. fftsize_slider->copy_label(control.get_fftsize_info().c_str());
  765. resolution_box->copy_label(control.get_fftresolution_info().c_str());
  766. bool may_render=false;
  767. if (infilename_output->label()!=NULL){
  768. if (strlen(infilename_output->label())!=0)
  769. may_render=true;
  770. };
  771. if (!rendering){//do not change the status of render button while rendering
  772. if (may_render) {
  773. render_button->activate();
  774. render_menu->activate();
  775. } else {
  776. render_button->deactivate();
  777. render_menu->deactivate();
  778. };
  779. };} {}
  780. }
  781. Function {refreshgui()} {open
  782. } {
  783. code {stretch_slider->value(control.gui_sliders.stretch_s);
  784. fftsize_slider->value(control.gui_sliders.fftsize_s);
  785. mode_choice->value(control.gui_sliders.mode_s);
  786. window_choice->value(control.window_type);
  787. pitch_shift_enabled->value(control.ppar.pitch_shift.enabled);
  788. pitch_shift_cents->value(control.ppar.pitch_shift.cents);
  789. octave_enabled->value(control.ppar.octave.enabled);
  790. octave_om2->value(control.ppar.octave.om2);
  791. octave_om1->value(control.ppar.octave.om1);
  792. octave_o0->value(control.ppar.octave.o0);
  793. octave_o1->value(control.ppar.octave.o1);
  794. octave_o15->value(control.ppar.octave.o15);
  795. octave_o2->value(control.ppar.octave.o2);
  796. freq_shift_enabled->value(control.ppar.freq_shift.enabled);
  797. freq_shift_Hz->value(control.ppar.freq_shift.Hz);
  798. compressor_enabled->value(control.ppar.compressor.enabled);
  799. compressor_power->value(control.ppar.compressor.power);
  800. filter_enabled->value(control.ppar.filter.enabled);
  801. filter_stop->value(control.ppar.filter.stop);
  802. filter_low->value(control.ppar.filter.low);
  803. filter_high->value(control.ppar.filter.high);
  804. filter_hdamp->value(control.ppar.filter.hdamp);
  805. harmonics_enabled->value(control.ppar.harmonics.enabled);
  806. harmonics_freq->value(control.ppar.harmonics.freq);
  807. harmonics_bandwidth->value(control.ppar.harmonics.bandwidth);
  808. harmonics_nharmonics->value(control.ppar.harmonics.nharmonics);
  809. harmonics_gauss->value(control.ppar.harmonics.gauss);
  810. spread_enabled->value(control.ppar.spread.enabled);
  811. spread_bandwidth->value(control.ppar.spread.bandwidth);
  812. bbpar_mono->value(control.bbpar.mono);
  813. bbpar_stereo_mode->value(control.bbpar.stereo_mode);
  814. stretch_multiplier_control->refresh();
  815. arbitrary_filter_control->refresh();
  816. binaural_beats_control->refresh();} {}
  817. }
  818. Function {tickrefresh()} {} {
  819. code {seek_slider->value(seek_slider->maximum()*control.get_seek_pos());
  820. if (playing_for_button&&control.playing()){
  821. play_button->labelcolor(FL_GREEN);
  822. window->redraw();
  823. playing_for_button=false;
  824. };
  825. if (eof_for_button&&control.playing_eof()){
  826. play_button->labelcolor(FL_BLACK);
  827. window->redraw();
  828. eof_for_button=false;
  829. };
  830. if (control.info.render_percent>0.0){
  831. render_percent_slider->value(control.info.render_percent);
  832. };
  833. if (infilename_output->new_drag_file){
  834. open_input_file(infilename_output->drag_file.c_str());
  835. infilename_output->new_drag_file=false;
  836. };} {}
  837. }
  838. Function {tickdraw(GUI *o)} {return_type {static void}
  839. } {
  840. code {o->tickrefresh();} {}
  841. }
  842. Function {tick(void *v)} {return_type {static void}
  843. } {
  844. code {tickdraw((GUI *) v);
  845. Fl::add_timeout(1.0/3.0,tick,v);//3 fps} {}
  846. }
  847. decl {Control control;} {}
  848. decl {bool playing_for_button;} {}
  849. decl {bool rendering;} {}
  850. decl {bool eof_for_button;} {}
  851. }
  852. Function {file_exists(const char *filename)} {return_type bool
  853. } {
  854. code {struct stat buf;
  855. int i = stat ( filename, &buf );
  856. // File exists
  857. if ( i == 0 ) return true;
  858. else return false;} {}
  859. }
  860. Function {main(int argc, char *argv[])} {return_type int
  861. } {
  862. code {GUI *gui=new GUI();
  863. if (argc>1){
  864. gui->open_input_file(argv[1]);
  865. };
  866. gui->window->show();
  867. Fl::run();
  868. delete gui;
  869. return 0;} {}
  870. }