r602: Fix baver's code... don't insert timecode when show_tc is not set
[cinelerra_cv/mob.git] / cinelerra / autos.h
blob5a724d4cc75860f018735c4824dfe7432f7e61f4
1 #ifndef AUTOS_H
2 #define AUTOS_H
4 // Base class for automation lists.
5 // Units are the native units for the track data type.
7 #include "auto.h"
8 #include "edl.inc"
9 #include "guicast.h"
10 #include "filexml.inc"
11 #include "track.inc"
13 #define AUTOS_VIRTUAL_HEIGHT 160
15 class Autos : public List<Auto>
17 public:
18 Autos(EDL *edl,
19 Track *track);
21 virtual ~Autos();
23 void resample(double old_rate, double new_rate);
25 int create_objects();
26 void equivalent_output(Autos *autos, int64_t startproject, int64_t *result);
27 void copy_from(Autos *autos);
28 virtual Auto* new_auto();
29 virtual float value_to_percentage();
30 // Get existing auto on or before position.
31 // If use_default is true, return default_auto if none exists
32 // on or before position.
33 // Return 0 if none exists and use_default is false.
34 // If &current is nonzero it is used as a starting point for searching.
35 Auto* get_prev_auto(int64_t position, int direction, Auto* &current, int use_default = 1);
36 Auto* get_prev_auto(int direction, Auto* &current);
37 Auto* get_next_auto(int64_t position, int direction, Auto* &current, int use_default = 1);
38 // Determine if a keyframe exists before creating it.
39 int auto_exists_for_editing(double position);
40 // Returns auto at exact position, null if non-existent. ignores autokeyframming and align on frames
41 Auto* get_auto_at_position(double position = -1);
42 // Get keyframe for editing with automatic creation if enabled
43 Auto* get_auto_for_editing(double position = -1);
44 // Insert keyframe at the point if it doesn't exist
45 Auto* insert_auto(int64_t position);
46 // Insert keyframe at the point if it doesn't exist
47 // Interpolate it insead of copying
48 Auto* insert_auto_for_editing(int64_t position);
49 void insert_track(Autos *automation,
50 int64_t start_unit,
51 int64_t length_units,
52 int replace_default);
53 virtual int load(FileXML *xml);
54 void paste(int64_t start,
55 int64_t length,
56 double scale,
57 FileXML *file,
58 int default_only);
59 void remove_nonsequential(Auto *keyframe);
60 void optimize();
62 EDL *edl;
63 Track *track;
64 // Default settings if no autos.
65 // Having a persistent keyframe created problems when files were loaded and
66 // we wanted to keep only 1 auto.
67 // Default auto has position 0 except in effects, where multiple default autos
68 // exist.
69 Auto *default_auto;
75 int clear_all();
76 int insert(int64_t start, int64_t end);
77 int paste_silence(int64_t start, int64_t end);
78 int copy(int64_t start,
79 int64_t end,
80 FileXML *xml,
81 int default_only,
82 int autos_only);
83 // Stores the background rendering position in result
84 void clear(int64_t start,
85 int64_t end,
86 int shift_autos);
87 int clear_auto(int64_t position);
88 int save(FileXML *xml);
89 virtual int slope_adjustment(int64_t ax, double slope);
90 virtual float fix_value(float value) {};
91 int release_auto();
92 virtual int release_auto_derived() {};
93 virtual Auto* add_auto(int64_t position, float value) { printf("virtual Autos::add_auto\n"); };
94 virtual Auto* append_auto() { printf("virtual Autos::append_auto();\n"); };
95 int scale_time(float rate_scale, int scale_edits, int scale_autos, int64_t start, int64_t end);
96 int64_t get_length();
98 // rendering utilities
99 int get_neighbors(int64_t start, int64_t end, Auto **before, Auto **after);
100 // 1 if automation doesn't change
101 virtual int automation_is_constant(int64_t start, int64_t end);
102 virtual double get_automation_constant(int64_t start, int64_t end);
103 int init_automation(int64_t &buffer_position,
104 int64_t &input_start,
105 int64_t &input_end,
106 int &automate,
107 double &constant,
108 int64_t input_position,
109 int64_t buffer_len,
110 Auto **before,
111 Auto **after,
112 int reverse);
114 int init_slope(Auto **current_auto,
115 double &slope_start,
116 double &slope_value,
117 double &slope_position,
118 int64_t &input_start,
119 int64_t &input_end,
120 Auto **before,
121 Auto **after,
122 int reverse);
124 int get_slope(Auto **current_auto,
125 double &slope_start,
126 double &slope_end,
127 double &slope_value,
128 double &slope,
129 int64_t buffer_len,
130 int64_t buffer_position,
131 int reverse);
133 int advance_slope(Auto **current_auto,
134 double &slope_start,
135 double &slope_value,
136 double &slope_position,
137 int reverse);
139 Auto* autoof(int64_t position); // return nearest auto equal to or after position
140 // 0 if after all autos
141 Auto* nearest_before(int64_t position); // return nearest auto before or 0
142 Auto* nearest_after(int64_t position); // return nearest auto after or 0
144 int color;
145 Auto *selected;
146 int skip_selected; // if selected was added
147 int64_t selected_position, selected_position_; // original position for moves
148 double selected_value, selected_value_; // original position for moves
149 float virtual_h; // height cursor moves to cover entire range when track height is less than this
150 double min, max; // boundaries of this auto
151 double default_;
152 int virtual_center;
153 int stack_number;
154 int stack_total;
162 #endif