Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / automation.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008-2013 Adam Williams <broadcast at earthling dot net>
5  * Copyright (C) 2003-2016 Cinelerra CV contributors
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  *
21  */
22
23 #ifndef AUTOMATION_H
24 #define AUTOMATION_H
25
26 #include <stdio.h>
27 #include <stdint.h>
28
29 #include "arraylist.h"
30 #include "autoconf.inc"
31 #include "automation.inc"
32 #include "autos.inc"
33 #include "edl.inc"
34 #include "filexml.inc"
35 #include "maxchannels.h"
36 #include "module.inc"
37 #include "track.inc"
38
39 // Match the clipping at per cinelerra/virtualanode.C which contains:
40 //  if(fade_value <= INFINITYGAIN) fade_value = 0;
41 //  in reality, this should be matched to a user-defined minimum in the preferences
42 #define AUTOMATIONCLAMPS(value, autogrouptype)                          \
43         if (autogrouptype == AUTOGROUPTYPE_AUDIO_FADE && value <= INFINITYGAIN) \
44                 value = INFINITYGAIN;                                   \
45         if (autogrouptype == AUTOGROUPTYPE_VIDEO_FADE)                  \
46                 CLAMP(value, 0, 100);                                   \
47         if (autogrouptype == AUTOGROUPTYPE_ZOOM && value < ZOOM_MIN)    \
48                 value = ZOOM_MIN;                                       \
49         else if (autogrouptype == AUTOGROUPTYPE_SPEED && value < SPEED_MIN) \
50                 value = SPEED_MIN;
51
52 #define AUTOMATIONVIEWCLAMPS(value, autogrouptype)                      \
53         if (autogrouptype == AUTOGROUPTYPE_ZOOM && value < 0)           \
54                 value = 0;                                              \
55         else if (autogrouptype == AUTOGROUPTYPE_SPEED && value < SPEED_MIN)     \
56                 value = SPEED_MIN;
57
58
59 class Automation
60 {
61 public:
62         static int autogrouptypes_fixedrange[];
63         Automation(EDL *edl, Track *track);
64         virtual ~Automation();
65
66         static int autogrouptype(int type, Track *track);
67         virtual void create_objects();
68         void equivalent_output(Automation *automation, int64_t *result);
69         virtual Automation& operator=(Automation& automation);
70         virtual void copy_from(Automation *automation);
71         int load(FileXML *file);
72 // For copy automation, copy, and save
73         int copy(int64_t start,
74                 int64_t end,
75                 FileXML *xml,
76                 int default_only,
77                 int active_only);
78         virtual void dump(FILE *fp);
79         virtual int direct_copy_possible(int64_t start, int direction);
80         virtual int direct_copy_possible_derived(int64_t start, int direction) { return 1; };
81 // For paste automation only
82         int paste(int64_t start,
83                 int64_t length,
84                 double scale,
85                 FileXML *file,
86                 int default_only,
87                 int active_only,
88                 AutoConf *autoconf);
89
90 // Get projector coordinates if this is video automation
91         virtual void get_projector(float *x,
92                 float *y,
93                 float *z,
94                 int64_t position,
95                 int direction);
96 // Get camera coordinates if this is video automation
97         virtual void get_camera(float *x,
98                 float *y,
99                 float *z,
100                 int64_t position,
101                 int direction);
102
103 // Returns the point to restart background rendering at.
104 // -1 means nothing changed.
105         void clear(int64_t start,
106                 int64_t end,
107                 AutoConf *autoconf,
108                 int shift_autos);
109         void set_automation_mode(int64_t start,
110                 int64_t end,
111                 int mode,
112                 AutoConf *autoconf);
113         void paste_silence(int64_t start, int64_t end);
114         void insert_track(Automation *automation,
115                 int64_t start_unit,
116 // Pad keyframes to this length.
117                 int64_t length_units,
118                 int replace_default);
119         void resample(double old_rate, double new_rate);
120         int64_t get_length();
121         virtual void get_extents(float *min,
122                 float *max,
123                 int *coords_undefined,
124                 int64_t unit_start,
125                 int64_t unit_end,
126                 int autogrouptype);
127
128
129
130
131
132         Autos *autos[AUTOMATION_TOTAL];
133
134
135         EDL *edl;
136         Track *track;
137 };
138
139 #endif