r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / autos.h
blob7740b20dfcdc26e2b25eb3b27b4b076170741996
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 // Get keyframe for editing with automatic creation if enabled
41 Auto* get_auto_for_editing(double position = -1);
42 // Insert keyframe at the point if it doesn't exist
43 Auto* insert_auto(int64_t position);
44 void insert_track(Autos *automation,
45 int64_t start_unit,
46 int64_t length_units,
47 int replace_default);
48 virtual int load(FileXML *xml);
49 void paste(int64_t start,
50 int64_t length,
51 double scale,
52 FileXML *file,
53 int default_only);
54 void remove_nonsequential(Auto *keyframe);
55 void optimize();
57 EDL *edl;
58 Track *track;
59 // Default settings if no autos.
60 // Having a persistent keyframe created problems when files were loaded and
61 // we wanted to keep only 1 auto.
62 // Default auto has position 0 except in effects, where multiple default autos
63 // exist.
64 Auto *default_auto;
70 int clear_all();
71 int insert(int64_t start, int64_t end);
72 int paste_silence(int64_t start, int64_t end);
73 int copy(int64_t start,
74 int64_t end,
75 FileXML *xml,
76 int default_only,
77 int autos_only);
78 // Stores the background rendering position in result
79 void clear(int64_t start,
80 int64_t end,
81 int shift_autos);
82 int clear_auto(int64_t position);
83 int save(FileXML *xml);
84 virtual int slope_adjustment(int64_t ax, double slope);
85 virtual float fix_value(float value) {};
86 int release_auto();
87 virtual int release_auto_derived() {};
88 virtual Auto* add_auto(int64_t position, float value) { printf("virtual Autos::add_auto\n"); };
89 virtual Auto* append_auto() { printf("virtual Autos::append_auto();\n"); };
90 int scale_time(float rate_scale, int scale_edits, int scale_autos, int64_t start, int64_t end);
91 int64_t get_length();
93 // rendering utilities
94 int get_neighbors(int64_t start, int64_t end, Auto **before, Auto **after);
95 // 1 if automation doesn't change
96 virtual int automation_is_constant(int64_t start, int64_t end);
97 virtual double get_automation_constant(int64_t start, int64_t end);
98 int init_automation(int64_t &buffer_position,
99 int64_t &input_start,
100 int64_t &input_end,
101 int &automate,
102 double &constant,
103 int64_t input_position,
104 int64_t buffer_len,
105 Auto **before,
106 Auto **after,
107 int reverse);
109 int init_slope(Auto **current_auto,
110 double &slope_start,
111 double &slope_value,
112 double &slope_position,
113 int64_t &input_start,
114 int64_t &input_end,
115 Auto **before,
116 Auto **after,
117 int reverse);
119 int get_slope(Auto **current_auto,
120 double &slope_start,
121 double &slope_end,
122 double &slope_value,
123 double &slope,
124 int64_t buffer_len,
125 int64_t buffer_position,
126 int reverse);
128 int advance_slope(Auto **current_auto,
129 double &slope_start,
130 double &slope_value,
131 double &slope_position,
132 int reverse);
134 Auto* autoof(int64_t position); // return nearest auto equal to or after position
135 // 0 if after all autos
136 Auto* nearest_before(int64_t position); // return nearest auto before or 0
137 Auto* nearest_after(int64_t position); // return nearest auto after or 0
139 int color;
140 Auto *selected;
141 int skip_selected; // if selected was added
142 int64_t selected_position, selected_position_; // original position for moves
143 double selected_value, selected_value_; // original position for moves
144 float virtual_h; // height cursor moves to cover entire range when track height is less than this
145 double min, max; // boundaries of this auto
146 double default_;
147 int virtual_center;
148 int stack_number;
149 int stack_total;
157 #endif