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
);
25 virtual void 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 // Get existing auto on or before position.
30 // If use_default is true, return default_auto if none exists
31 // on or before position.
32 // Return 0 if none exists and use_default is false.
33 // If ¤t is nonzero it is used as a starting point for searching.
34 Auto
* get_prev_auto(int64_t position
, int direction
, Auto
* ¤t
, int use_default
= 1);
35 Auto
* get_prev_auto(int direction
, Auto
* ¤t
);
36 Auto
* get_next_auto(int64_t position
, int direction
, Auto
* ¤t
, int use_default
= 1);
37 // Determine if a keyframe exists before creating it.
38 int auto_exists_for_editing(double position
);
39 // Returns auto at exact position, null if non-existent. ignores autokeyframming and align on frames
40 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);
45 // Insert keyframe at the point if it doesn't exist
46 Auto
* insert_auto(int64_t position
);
47 // Insert keyframe at the point if it doesn't exist
48 // Interpolate it insead of copying
49 Auto
* insert_auto_for_editing(int64_t position
);
50 void insert_track(Autos
*automation
,
54 virtual int load(FileXML
*xml
);
55 void paste(int64_t start
,
60 void remove_nonsequential(Auto
*keyframe
);
63 // Returns a type enumeration
66 virtual void get_extents(float *min
,
68 int *coords_undefined
,
74 // Default settings if no autos.
75 // Having a persistent keyframe created problems when files were loaded and
76 // we wanted to keep only 1 auto.
77 // Default auto has position 0 except in effects, where multiple default autos
93 int insert(int64_t start
, int64_t end
);
94 int paste_silence(int64_t start
, int64_t end
);
95 int copy(int64_t start
,
100 // Stores the background rendering position in result
101 void clear(int64_t start
,
104 int clear_auto(int64_t position
);
105 int save(FileXML
*xml
);
106 virtual int slope_adjustment(int64_t ax
, double slope
);
108 virtual int release_auto_derived() {};
110 int scale_time(float rate_scale
, int scale_edits
, int scale_autos
, int64_t start
, int64_t end
);
112 // rendering utilities
113 int get_neighbors(int64_t start
, int64_t end
, Auto
**before
, Auto
**after
);
114 // 1 if automation doesn't change
115 virtual int automation_is_constant(int64_t start
, int64_t end
);
116 virtual double get_automation_constant(int64_t start
, int64_t end
);
117 int init_automation(int64_t &buffer_position
,
118 int64_t &input_start
,
122 int64_t input_position
,
128 int init_slope(Auto
**current_auto
,
131 double &slope_position
,
132 int64_t &input_start
,
138 int get_slope(Auto
**current_auto
,
144 int64_t buffer_position
,
147 int advance_slope(Auto
**current_auto
,
150 double &slope_position
,
153 Auto
* autoof(int64_t position
); // return nearest auto equal to or after position
154 // 0 if after all autos
155 Auto
* nearest_before(int64_t position
); // return nearest auto before or 0
156 Auto
* nearest_after(int64_t position
); // return nearest auto after or 0
159 int skip_selected
; // if selected was added
160 int64_t selected_position
, selected_position_
; // original position for moves
161 double selected_value
, selected_value_
; // original position for moves
162 float virtual_h
; // height cursor moves to cover entire range when track height is less than this