4 * Copyright (C) 2008-2013 Adam Williams <broadcast at earthling dot net>
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.
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.
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
28 #include "arraylist.h"
29 #include "autoconf.inc"
30 #include "automation.inc"
33 #include "filexml.inc"
34 #include "maxchannels.h"
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 < ZOOM_MIN) \
48 else if (autogrouptype == AUTOGROUPTYPE_SPEED && value < SPEED_MIN) \
51 #define AUTOMATIONVIEWCLAMPS(value, autogrouptype) \
52 if (autogrouptype == AUTOGROUPTYPE_ZOOM && value < 0) \
54 else if (autogrouptype == AUTOGROUPTYPE_SPEED && value < SPEED_MIN) \
61 static int autogrouptypes_fixedrange[];
62 Automation(EDL *edl, Track *track);
63 virtual ~Automation();
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,
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,
89 // Get projector coordinates if this is video automation
90 virtual void get_projector(float *x,
95 // Get camera coordinates if this is video automation
96 virtual void get_camera(float *x,
102 // Returns the point to restart background rendering at.
103 // -1 means nothing changed.
104 void clear(int64_t start,
108 void set_automation_mode(int64_t start,
112 void paste_silence(int64_t start, int64_t end);
113 void insert_track(Automation *automation,
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,
122 int *coords_undefined,
131 Autos *autos[AUTOMATION_TOTAL];