Andrew add of titler reset button and english save + tips and po updates
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / chorus / chorus.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008-2019 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 CHORUS_H
23 #define CHORUS_H
24
25 class Chorus;
26
27 #include "pluginaclient.h"
28
29 class ChorusConfig
30 {
31 public:
32         ChorusConfig();
33
34
35         int equivalent(ChorusConfig &that);
36         void copy_from(ChorusConfig &that);
37         void interpolate(ChorusConfig &prev, 
38                 ChorusConfig &next, 
39                 int64_t prev_frame, 
40                 int64_t next_frame, 
41                 int64_t current_frame);
42         void boundaries();
43
44
45 // number of voices per channel to be rendered
46     int voices;
47 // starting phase offset in ms
48         float offset;
49 // how much the phase oscillates in ms
50         float depth;
51 // rate of phase oscillation in Hz
52         float rate;
53 // how much of input signal
54         float wetness;
55 };
56
57 // state of a single voice
58 class Voice
59 {
60 public:
61     Voice();
62
63 // position in the waveform table
64     int table_offset;
65 // source channel
66     int src_channel;
67 // destination channel
68     int dst_channel;
69 };
70
71
72 // each sample in the flanging waveform
73 typedef struct 
74 {
75     double input_sample;
76 } flange_sample_t;
77
78
79 class Chorus : public PluginAClient
80 {
81 public:
82         Chorus(PluginServer *server);
83         ~Chorus();
84
85         void update_gui();
86
87
88
89 // required for all realtime/multichannel plugins
90         PLUGIN_CLASS_MEMBERS(ChorusConfig);
91     int process_buffer(int64_t size, 
92             Samples **buffer, 
93             int64_t start_position,
94             int sample_rate);
95     void reallocate_dsp(int new_dsp_allocated);
96     void reallocate_history(int new_allocation);
97     int total_voices();
98
99         int is_realtime();
100         int is_synthesis();
101         int is_multichannel();
102         void save_data(KeyFrame *keyframe);
103         void read_data(KeyFrame *keyframe);
104
105         double **history_buffer;
106 // Number of samples in the history buffer 
107         int64_t history_size;
108
109 // the temporary all voices are painted on
110         double **dsp_in;
111     int dsp_in_allocated;
112
113     Voice *voices;
114 // flanging table is a whole number of samples that repeats
115 // always an even number
116     int table_size;
117     flange_sample_t *flanging_table;
118
119 // detect seeking
120     int64_t last_position;
121
122         int need_reconfigure;
123 };
124
125
126
127
128 class ChorusWindow : public PluginClientWindow
129 {
130 public:
131         ChorusWindow(Chorus *plugin);
132         ~ChorusWindow();
133         
134         void create_objects();
135     void update();
136     void param_updated();
137
138         Chorus *plugin;
139     PluginParam *voices;
140     PluginParam *offset;
141     PluginParam *depth;
142     PluginParam *rate;
143     PluginParam *wetness;
144 };
145
146
147
148
149 #endif
150
151
152