File: Control.h

package info (click to toggle)
paulstretch 2.2-2-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 420 kB
  • ctags: 670
  • sloc: cpp: 3,717; ansic: 576; sh: 47; makefile: 20
file content (127 lines) | stat: -rw-r--r-- 3,276 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
   Copyright (C) 2006-2011 Nasca Octavian Paul
Author: Nasca Octavian Paul

This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License 
as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License (version 2) for more details.

You should have received a copy of the GNU General Public License (version 2)
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
*/

#ifndef CONTROL_H
#define CONTROL_H

#include "globals.h"
#include "Input/AInputS.h"
#include "Input/VorbisInputS.h"
#include "Input/MP3InputS.h"
#include "Output/AOutputS.h"
#include "Output/VorbisOutputS.h"
#include "ProcessedStretch.h"
#include "Player.h"
#include "JAaudiooutput.h"
#include "PAaudiooutput.h"
#include "BinauralBeats.h"

class Control{
	public:
		Control();
		~Control();

		void UpdateControlInfo();
		void startplay(bool bypass);
		void stopplay();
		void pauseplay();
		void freezeplay();

		void set_volume(REALTYPE vol);

		void set_seek_pos(REALTYPE x);
		REALTYPE get_seek_pos();

		bool save_parameters(const char *filename);
		bool load_parameters(const char *filename);

		bool playing(){
			return player->info.playing;
		};
		bool playing_eof(){
			return player->info.eof;
		};

		bool set_input_filename(std::string filename,FILE_TYPE intype);//return false if the file cannot be opened
		std::string get_input_filename();
		std::string get_input_filename_and_info();
		std::string get_stretch_info();
		std::string get_fftsize_info();
		std::string get_fftresolution_info();
		double get_stretch(){
			return process.stretch;
		};
		double get_onset_detection_sensitivity(){
			return process.onset_detection_sensitivity;
		};
		

		bool is_freeze(){
			return player->is_freeze();
		};

		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
		double get_stretch_control(double stretch,int mode);
		void update_player_stretch();

		void set_window_type(FFTWindow window);
		///	void pre_analyse_whole_audio(InputS *ai);

		std::string Render(std::string inaudio,std::string outaudio,FILE_TYPE outtype,FILE_TYPE intype,
				REALTYPE pos1,REALTYPE pos2);//returneaza o eroare sau un string gol (pos1,pos2 are from 0.0 to 1.0)
		struct {
			REALTYPE render_percent;
			bool cancel_render;
		}info;

		ProcessParameters ppar;
		BinauralBeatsParameters	bbpar;
		bool wav32bit;
		void update_process_parameters();//pt. player
		struct{
			double fftsize_s,stretch_s;
			int mode_s;
		}gui_sliders;	   
		FFTWindow window_type;

	private:
		REALTYPE volume;

		int get_optimized_updown(int n,bool up);
		int optimizebufsize(int bufsize);
		std::string getfftsizestr(int fftsize);

		struct {
			int bufsize;
			double stretch;
			double onset_detection_sensitivity;
		}process;

		struct {
			int samplerate;
			int nsamples;
			std::string filename;
			FILE_TYPE intype;
		}wavinfo;//input
		REALTYPE seek_pos;

		Player *player;
};

#endif