initial commit
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / timestretch / timestretch.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2009 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef TIMESTRETCH_H
23 #define TIMESTRETCH_H
24
25 #include "bchash.inc"
26 #include "fourier.h"
27 #include "guicast.h"
28 #include "mainprogress.inc"
29 #include "pluginaclient.h"
30 #include "resample.inc"
31 #include "timestretchengine.inc"
32 #include "vframe.inc"
33
34
35
36
37 class TimeStretch;
38 class TimeStretchWindow;
39
40
41
42
43 class TimeStretchFraction : public BC_TextBox
44 {
45 public:
46         TimeStretchFraction(TimeStretch *plugin, int x, int y);
47         int handle_event();
48         TimeStretch *plugin;
49 };
50
51
52 class TimeStretchFreq : public BC_Radial
53 {
54 public:
55         TimeStretchFreq(TimeStretch *plugin, TimeStretchWindow *gui, int x, int y);
56         int handle_event();
57         TimeStretch *plugin;
58         TimeStretchWindow *gui;
59 };
60
61 class TimeStretchTime : public BC_Radial
62 {
63 public:
64         TimeStretchTime(TimeStretch *plugin, TimeStretchWindow *gui, int x, int y);
65         int handle_event();
66         TimeStretch *plugin;
67         TimeStretchWindow *gui;
68 };
69
70
71 class TimeStretchWindow : public BC_Window
72 {
73 public:
74         TimeStretchWindow(TimeStretch *plugin, int x, int y);
75         ~TimeStretchWindow();
76
77         void create_objects();
78
79         TimeStretch *plugin;
80         TimeStretchFreq *freq;
81         TimeStretchTime *time;
82 };
83
84
85 class PitchEngine : public CrossfadeFFT
86 {
87 public:
88         PitchEngine(TimeStretch *plugin);
89         ~PitchEngine();
90
91
92         int read_samples(int64_t output_sample,
93                 int samples,
94                 Samples *buffer);
95         int signal_process();
96
97         TimeStretch *plugin;
98         double *temp;
99         double *input_buffer;
100         int input_size;
101         int input_allocated;
102         int64_t current_position;
103 };
104
105 class TimeStretchResample : public Resample
106 {
107 public:
108         TimeStretchResample(TimeStretch *plugin);
109
110         int read_samples(Samples *buffer, int64_t start, int64_t len);
111
112         TimeStretch *plugin;
113 };
114
115
116
117 class TimeStretch : public PluginAClient
118 {
119 public:
120         TimeStretch(PluginServer *server);
121         ~TimeStretch();
122
123
124         const char* plugin_title();
125         int get_parameters();
126         int start_loop();
127         int process_loop(Samples *buffer, int64_t &write_length);
128         int stop_loop();
129
130         int load_defaults();
131         int save_defaults();
132
133
134
135
136         PitchEngine *pitch;
137         TimeStretchResample *resample;
138         double *temp;
139         int temp_allocated;
140         Samples *input;
141         int input_allocated;
142
143         int use_fft;
144         TimeStretchEngine *stretch;
145
146         MainProgressBar *progress;
147         double scale;
148         int64_t scaled_size;
149         int64_t current_position;
150         int64_t total_written;
151         int64_t current_written;
152         int64_t total_read;
153 };
154
155
156 #endif