8d7300ffa99cbd5eeed97cd58a3f553a829ed063
[goodguy/history.git] / cinelerra-5.1 / plugins / resamplert / resamplert.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2010 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 RESAMPLERT_H
23 #define RESAMPLERT_H
24
25
26 #include "guicast.h"
27 #include "pluginaclient.h"
28 #include "resample.h"
29
30
31
32 class ResampleRT;
33 class ResampleRTWindow;
34
35 class ResampleRTConfig
36 {
37 public:
38         ResampleRTConfig();
39         void boundaries();
40         int equivalent(ResampleRTConfig &src);
41         void copy_from(ResampleRTConfig &src);
42         void interpolate(ResampleRTConfig &prev, 
43                 ResampleRTConfig &next, 
44                 int64_t prev_frame, 
45                 int64_t next_frame, 
46                 int64_t current_frame);
47         double scale;
48 };
49
50
51 class ResampleRTScale : public BC_TumbleTextBox
52 {
53 public:
54         ResampleRTScale(ResampleRTWindow *window,
55                 ResampleRT *plugin,
56                 int x,
57                 int y);
58         int handle_event();
59         ResampleRT *plugin;
60 };
61
62 class ResampleRTWindow : public PluginClientWindow
63 {
64 public:
65         ResampleRTWindow(ResampleRT *plugin);
66         ~ResampleRTWindow();
67         void create_objects();
68
69         ResampleRT *plugin;
70         ResampleRTScale *scale;
71 };
72
73
74 class ResampleRTResample : public Resample
75 {
76 public:
77         ResampleRTResample(ResampleRT *plugin);
78         int read_samples(Samples *buffer, int64_t start, int64_t len);
79         ResampleRT *plugin;
80 };
81
82
83
84 class ResampleRT : public PluginAClient
85 {
86 public:
87         ResampleRT(PluginServer *server);
88         ~ResampleRT();
89
90         PLUGIN_CLASS_MEMBERS(ResampleRTConfig)
91
92         void save_data(KeyFrame *keyframe);
93         void read_data(KeyFrame *keyframe);
94         void update_gui();
95         int is_realtime();
96         int is_synthesis();
97         int process_buffer(int64_t size, 
98                 Samples *buffer,
99                 int64_t start_position,
100                 int sample_rate);
101         void render_stop();
102
103 // Start of current resample region in input sample rate
104         int64_t source_start;
105 // Start of playback in output sample rate.
106         int64_t dest_start;
107 // End of playback in output sample rate
108         int64_t dest_end;
109         int need_reconfigure;
110         int prev_scale;
111         ResampleRTResample *resample;
112 };
113
114
115 #endif
116