Control.h (3276B)
1 /* 2 Copyright (C) 2006-2011 Nasca Octavian Paul 3 Author: Nasca Octavian Paul 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of version 2 of the GNU General Public License 7 as published by the Free Software Foundation. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License (version 2) for more details. 13 14 You should have received a copy of the GNU General Public License (version 2) 15 along with this program; if not, write to the Free Software Foundation, 16 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 19 #ifndef CONTROL_H 20 #define CONTROL_H 21 22 #include "globals.h" 23 #include "Input/AInputS.h" 24 #include "Input/VorbisInputS.h" 25 #include "Input/MP3InputS.h" 26 #include "Output/AOutputS.h" 27 #include "Output/VorbisOutputS.h" 28 #include "ProcessedStretch.h" 29 #include "Player.h" 30 #include "JAaudiooutput.h" 31 #include "PAaudiooutput.h" 32 #include "BinauralBeats.h" 33 34 class Control{ 35 public: 36 Control(); 37 ~Control(); 38 39 void UpdateControlInfo(); 40 void startplay(bool bypass); 41 void stopplay(); 42 void pauseplay(); 43 void freezeplay(); 44 45 void set_volume(REALTYPE vol); 46 47 void set_seek_pos(REALTYPE x); 48 REALTYPE get_seek_pos(); 49 50 bool save_parameters(const char *filename); 51 bool load_parameters(const char *filename); 52 53 bool playing(){ 54 return player->info.playing; 55 }; 56 bool playing_eof(){ 57 return player->info.eof; 58 }; 59 60 bool set_input_filename(std::string filename,FILE_TYPE intype);//return false if the file cannot be opened 61 std::string get_input_filename(); 62 std::string get_input_filename_and_info(); 63 std::string get_stretch_info(); 64 std::string get_fftsize_info(); 65 std::string get_fftresolution_info(); 66 double get_stretch(){ 67 return process.stretch; 68 }; 69 double get_onset_detection_sensitivity(){ 70 return process.onset_detection_sensitivity; 71 }; 72 73 74 bool is_freeze(){ 75 return player->is_freeze(); 76 }; 77 78 void set_stretch_controls(double stretch_s,int mode,double fftsize_s,double onset_detection_sensitivity);//*_s sunt de la 0.0 la 1.0 79 double get_stretch_control(double stretch,int mode); 80 void update_player_stretch(); 81 82 void set_window_type(FFTWindow window); 83 /// void pre_analyse_whole_audio(InputS *ai); 84 85 std::string Render(std::string inaudio,std::string outaudio,FILE_TYPE outtype,FILE_TYPE intype, 86 REALTYPE pos1,REALTYPE pos2);//returneaza o eroare sau un string gol (pos1,pos2 are from 0.0 to 1.0) 87 struct { 88 REALTYPE render_percent; 89 bool cancel_render; 90 }info; 91 92 ProcessParameters ppar; 93 BinauralBeatsParameters bbpar; 94 bool wav32bit; 95 void update_process_parameters();//pt. player 96 struct{ 97 double fftsize_s,stretch_s; 98 int mode_s; 99 }gui_sliders; 100 FFTWindow window_type; 101 102 private: 103 REALTYPE volume; 104 105 int get_optimized_updown(int n,bool up); 106 int optimizebufsize(int bufsize); 107 std::string getfftsizestr(int fftsize); 108 109 struct { 110 int bufsize; 111 double stretch; 112 double onset_detection_sensitivity; 113 }process; 114 115 struct { 116 int samplerate; 117 int nsamples; 118 std::string filename; 119 FILE_TYPE intype; 120 }wavinfo;//input 121 REALTYPE seek_pos; 122 123 Player *player; 124 }; 125 126 #endif 127