4 * Copyright (C) 2008-2013 Adam Williams <broadcast at earthling dot net>
5 * Copyright (C) 2003-2016 Cinelerra CV contributors
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.
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.
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
29 #include "arraylist.h"
30 #include "autoconf.inc"
31 #include "automation.inc"
34 #include "filexml.inc"
35 #include "maxchannels.h"
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) \
49 else if (autogrouptype == AUTOGROUPTYPE_SPEED && value < SPEED_MIN) \
52 #define AUTOMATIONVIEWCLAMPS(value, autogrouptype) \
53 if (autogrouptype == AUTOGROUPTYPE_ZOOM && value < 0) \
55 else if (autogrouptype == AUTOGROUPTYPE_SPEED && value < SPEED_MIN) \
62 static int autogrouptypes_fixedrange[];
63 Automation(EDL *edl, Track *track);
64 virtual ~Automation();
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,
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,
90 // Get projector coordinates if this is video automation
91 virtual void get_projector(float *x,
96 // Get camera coordinates if this is video automation
97 virtual void get_camera(float *x,
103 // Returns the point to restart background rendering at.
104 // -1 means nothing changed.
105 void clear(int64_t start,
109 void set_automation_mode(int64_t start,
113 void paste_silence(int64_t start, int64_t end);
114 void insert_track(Automation *automation,
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,
123 int *coords_undefined,
132 Autos *autos[AUTOMATION_TOTAL];