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 // 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
,
48 virtual int load(FileXML
*xml
);
49 void paste(int64_t start
,
54 void remove_nonsequential(Auto
*keyframe
);
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
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
,
78 // Stores the background rendering position in result
79 void clear(int64_t start
,
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
) {};
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
);
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
,
103 int64_t input_position
,
109 int init_slope(Auto
**current_auto
,
112 double &slope_position
,
113 int64_t &input_start
,
119 int get_slope(Auto
**current_auto
,
125 int64_t buffer_position
,
128 int advance_slope(Auto
**current_auto
,
131 double &slope_position
,
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
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