improve delays created by vicon drawing locks, reset_cache segv fix, gang track toolt...
[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  *
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 AUTOMATION_H
23 #define AUTOMATION_H
24
25 #include <stdio.h>
26 #include <stdint.h>
27
28 #include "arraylist.h"
29 #include "autoconf.inc"
30 #include "automation.inc"
31 #include "autos.inc"
32 #include "edl.inc"
33 #include "filexml.inc"
34 #include "maxchannels.h"
35 #include "module.inc"
36 #include "track.inc"
37
38 // Match the clipping at per cinelerra/virtualanode.C which contains:
39 //  if(fade_value <= INFINITYGAIN) fade_value = 0;
40 //  in reality, this should be matched to a user-defined minimum in the preferences
41 #define AUTOMATIONCLAMPS(value, autogrouptype)                          \
42         if (autogrouptype == AUTOGROUPTYPE_AUDIO_FADE && value <= INFINITYGAIN) \
43                 value = INFINITYGAIN;                                   \
44         if (autogrouptype == AUTOGROUPTYPE_VIDEO_FADE)                  \
45                 CLAMP(value, 0, 100);                                   \
46         if (autogrouptype == AUTOGROUPTYPE_ZOOM && value < 0)           \
47                 value = 0;                                              \
48         else if (autogrouptype == AUTOGROUPTYPE_SPEED && value < SPEED_MIN) \
49                 value = SPEED_MIN;
50
51 #define AUTOMATIONVIEWCLAMPS(value, autogrouptype)                      \
52         if (autogrouptype == AUTOGROUPTYPE_ZOOM && value < 0)           \
53                 value = 0;                                              \
54         else if (autogrouptype == AUTOGROUPTYPE_SPEED && value < SPEED_MIN)     \
55                 value = SPEED_MIN;
56
57
58 class Automation
59 {
60 public:
61         static int autogrouptypes_fixedrange[];
62         Automation(EDL *edl, Track *track);
63         virtual ~Automation();
64
65         static int autogrouptype(int type, Track *track);
66         virtual void create_objects();
67         void equivalent_output(Automation *automation, int64_t *result);
68         virtual Automation& operator=(Automation& automation);
69         virtual void copy_from(Automation *automation);
70         int load(FileXML *file);
71 // For copy automation, copy, and save
72         int copy(int64_t start,
73                 int64_t end,
74                 FileXML *xml,
75                 int default_only,
76                 int active_only);
77         virtual void dump(FILE *fp);
78         virtual int direct_copy_possible(int64_t start, int direction);
79         virtual int direct_copy_possible_derived(int64_t start, int direction) { return 1; };
80 // For paste automation only
81         int paste(int64_t start,
82                 int64_t length,
83                 double scale,
84                 FileXML *file,
85                 int default_only,
86                 int active_only,
87                 AutoConf *autoconf);
88
89 // Get projector coordinates if this is video automation
90         virtual void get_projector(float *x,
91                 float *y,
92                 float *z,
93                 int64_t position,
94                 int direction);
95 // Get camera coordinates if this is video automation
96         virtual void get_camera(float *x,
97                 float *y,
98                 float *z,
99                 int64_t position,
100                 int direction);
101
102 // Returns the point to restart background rendering at.
103 // -1 means nothing changed.
104         void clear(int64_t start,
105                 int64_t end,
106                 AutoConf *autoconf,
107                 int shift_autos);
108         void set_automation_mode(int64_t start,
109                 int64_t end,
110                 int mode,
111                 AutoConf *autoconf);
112         void paste_silence(int64_t start, int64_t end);
113         void insert_track(Automation *automation,
114                 int64_t start_unit,
115 // Pad keyframes to this length.
116                 int64_t length_units,
117                 int replace_default);
118         void resample(double old_rate, double new_rate);
119         int64_t get_length();
120         virtual void get_extents(float *min,
121                 float *max,
122                 int *coords_undefined,
123                 int64_t unit_start,
124                 int64_t unit_end,
125                 int autogrouptype);
126
127
128
129
130
131         Autos *autos[AUTOMATION_TOTAL];
132
133
134         EDL *edl;
135         Track *track;
136 };
137
138 #endif