4 // Base class for automation lists.
5 // Units are the native units for the track data type.
10 #include "filexml.inc"
13 #define AUTOS_VIRTUAL_HEIGHT 160
15 class Autos
: public List
<Auto
>
23 void resample(double old_rate
, double new_rate
);
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 ¤t is nonzero it is used as a starting point for searching.
35 Auto
* get_prev_auto(int64_t position
, int direction
, Auto
* ¤t
, int use_default
= 1);
36 Auto
* get_prev_auto(int direction
, Auto
* ¤t
);
37 Auto
* get_next_auto(int64_t position
, int direction
, Auto
* ¤t
, 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
,
53 virtual int load(FileXML
*xml
);
54 void paste(int64_t start
,
59 void remove_nonsequential(Auto
*keyframe
);
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
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
,
83 // Stores the background rendering position in result
84 void clear(int64_t start
,
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
) {};
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
);
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
,
108 int64_t input_position
,
114 int init_slope(Auto
**current_auto
,
117 double &slope_position
,
118 int64_t &input_start
,
124 int get_slope(Auto
**current_auto
,
130 int64_t buffer_position
,
133 int advance_slope(Auto
**current_auto
,
136 double &slope_position
,
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
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