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.

128 lines
3.2KB

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