6 #include "autoconf.inc"
7 #include "automation.inc"
9 #include "defaults.inc"
13 #include "filexml.inc"
14 #include "floatautos.inc"
16 #include "keyframe.inc"
21 #include "pluginset.inc"
22 #include "renderengine.inc"
23 #include "sharedlocation.inc"
25 #include "intautos.inc"
26 #include "trackcanvas.inc"
28 #include "transition.inc"
32 // UNITS ARE SAMPLES FOR ALL
34 class Track
: public ListItem
<Track
>
37 Track(EDL
*edl
, Tracks
*tracks
);
43 virtual int load_defaults(Defaults
*defaults
);
44 int load(FileXML
*file
, int track_offset
, uint32_t load_flags
);
45 virtual int save_header(FileXML
*file
) { return 0; };
46 virtual int save_derived(FileXML
*file
) { return 0; };
47 virtual int load_header(FileXML
*file
, uint32_t load_flags
) { return 0; };
48 virtual int load_derived(FileXML
*file
, uint32_t load_flags
) { return 0; };
49 void equivalent_output(Track
*track
, double *result
);
51 virtual void copy_from(Track
*track
);
52 Track
& operator=(Track
& track
);
53 virtual PluginSet
* new_plugins() { return 0; };
54 // Synchronize playback numbers
55 virtual void synchronize_params(Track
*track
);
57 // Get number of pixels to display
58 virtual int vertical_span(Theme
*theme
);
59 int64_t horizontal_span();
60 void resample(double old_rate
, double new_rate
);
62 // Get length of track in seconds
64 // Get dimensions of source for convenience functions
65 void get_source_dimensions(double position
, int &w
, int &h
);
68 void insert_asset(Asset
*asset
,
72 Plugin
* insert_effect(char *title
,
73 SharedLocation
*shared_location
,
75 PluginSet
*plugin_set
,
79 void insert_plugin_set(Track
*track
, double position
);
80 void detach_effect(Plugin
*plugin
);
81 // Insert a track from another EDL
82 void insert_track(Track
*track
,
88 int is_muted(int64_t position
, int direction
); // Test muting status
90 void move_plugins_up(PluginSet
*plugin_set
);
91 void move_plugins_down(PluginSet
*plugin_set
);
92 void remove_pluginset(PluginSet
*plugin_set
);
93 void remove_asset(Asset
*asset
);
95 // Used for determining a selection for editing so leave as int.
96 // converts the selection to SAMPLES OR FRAMES and stores in value
97 virtual int64_t to_units(double position
, int round
);
99 virtual double to_doubleunits(double position
);
100 virtual double from_units(int64_t position
);
104 // Positions are identical for handle modifications
105 virtual int identical(int64_t sample1
, int64_t sample2
) { return 0; };
107 // Get the plugin belonging to the set.
108 Plugin
* get_current_plugin(double position
,
113 Plugin
* get_current_transition(double position
,
118 // detach shared effects referencing module
119 void detach_shared_effects(int module
);
122 // Called by playable tracks to test for playable server.
123 // Descends the plugin tree without creating a virtual console.
124 // Used by PlayableTracks::is_playable.
125 int is_synthesis(RenderEngine
*renderengine
,
129 // Used by PlayableTracks::is_playable
130 virtual int channel_is_playable(int64_t position
,
134 // Test direct copy conditions common to all the rendering routines
135 virtual int direct_copy_possible(int64_t start
, int direction
, int use_nudge
);
137 // Used by PlayableTracks::is_playable
138 int plugin_used(int64_t position
, int64_t direction
);
144 virtual int copy_settings(Track
*track
);
145 void shift_keyframes(double position
, double length
, int convert_units
);
146 void shift_effects(double position
, double length
, int convert_units
);
147 void change_plugins(SharedLocation
&old_location
,
148 SharedLocation
&new_location
,
150 void change_modules(int old_location
,
158 // Plugin set uses key frames for automation
159 ArrayList
<PluginSet
*> plugin_set
;
160 Automation
*automation
;
162 // Vertical offset from top of timeline
166 // There is some debate on whether to expand gang from faders to
167 // dragging operations. This would allow every edit in a column to get dragged
170 char title
[BCTEXTLEN
];
173 // Nudge in track units. Positive shifts track earlier in time. This way
174 // the position variables only need to add the nudge.
176 // TRACK_AUDIO or TRACK_VIDEO
197 int load_automation(FileXML
*file
);
198 int load_edits(FileXML
*file
);
200 virtual int change_channels(int oldchannels
, int newchannels
) { return 0; };
205 // ===================================== editing
206 int copy(double start
,
209 char *output_path
= "");
210 int copy_assets(double start
,
212 ArrayList
<Asset
*> *asset_list
);
213 virtual int copy_derived(int64_t start
, int64_t end
, FileXML
*file
) { return 0; };
214 virtual int paste_derived(int64_t start
, int64_t end
, int64_t total_length
, FileXML
*file
, int ¤t_channel
) { return 0; };
215 int clear(double start
,
222 // Returns the point to restart background rendering at.
223 // -1 means nothing changed.
224 void clear_automation(double selectionstart
,
226 int shift_autos
/* = 1 */,
227 int default_only
/* = 0 */);
228 virtual int clear_automation_derived(AutoConf
*auto_conf
,
229 double selectionstart
,
231 int shift_autos
= 1) { return 0; };
232 virtual int clear_derived(double start
,
233 double end
) { return 0; };
235 int copy_automation(double selectionstart
,
240 virtual int copy_automation_derived(AutoConf
*auto_conf
,
241 double selectionstart
,
243 FileXML
*file
) { return 0; };
244 int paste_automation(double selectionstart
,
250 virtual int paste_automation_derived(double selectionstart
,
255 int ¤t_pan
) { return 0; };
256 int paste_auto_silence(double start
, double end
);
257 virtual int paste_auto_silence_derived(int64_t start
, int64_t end
) { return 0; };
258 int scale_time(float rate_scale
, int scale_edits
, int scale_autos
, int64_t start
, int64_t end
);
259 virtual int scale_time_derived(float rate_scale
, int scale_edits
, int scale_autos
, int64_t start
, int64_t end
) { return 0; };
260 int purge_asset(Asset
*asset
);
261 int asset_used(Asset
*asset
);
262 int clear_handle(double start
,
267 int paste_silence(double start
, double end
, int edit_plugins
);
268 virtual int select_translation(int cursor_x
, int cursor_y
) { return 0; }; // select video coordinates for frame
269 virtual int update_translation(int cursor_x
, int cursor_y
, int shift_down
) { return 0; }; // move video coordinates
270 int select_auto(AutoConf
*auto_conf
, int cursor_x
, int cursor_y
);
271 virtual int select_auto_derived(float zoom_units
, float view_start
, AutoConf
*auto_conf
, int cursor_x
, int cursor_y
) { return 0; };
272 int move_auto(AutoConf
*auto_conf
, int cursor_x
, int cursor_y
, int shift_down
);
273 virtual int move_auto_derived(float zoom_units
, float view_start
, AutoConf
*auto_conf
, int cursor_x
, int cursor_y
, int shift_down
) { return 0; };
275 virtual int release_auto_derived() { return 0; };
276 // Return whether automation would prevent direct frame copies. Not fully implemented.
277 int automation_is_used(int64_t start
, int64_t end
);
278 virtual int automation_is_used_derived(int64_t start
, int64_t end
) { return 0; }
280 int popup_transition(int cursor_x
, int cursor_y
);
282 // Return 1 if the left handle was selected 2 if the right handle was selected 3 if the track isn't recordable
283 int modify_edithandles(double oldposition
,
289 int modify_pluginhandles(double oldposition
,
295 int select_edit(int cursor_x
,
299 virtual int end_translation() { return 0; };
300 virtual int reset_translation(int64_t start
, int64_t end
) { return 0; };
301 int feather_edits(int64_t start
, int64_t end
, int64_t units
);
302 int64_t get_feather(int64_t selectionstart
, int64_t selectionend
);
305 // Absolute number of this track
308 // get_dimensions is used for getting drawing regions so use floats for partial frames
309 // get the display dimensions in SAMPLES OR FRAMES
310 virtual int get_dimensions(double &view_start
,
312 double &zoom_units
) { return 0; };
313 // Longest time from current_position in which nothing changes
314 int64_t edit_change_duration(int64_t input_position
,
315 int64_t input_length
,
317 int test_transitions
,
319 int64_t plugin_change_duration(int64_t input_position
,
320 int64_t input_length
,
323 // Utility for edit_change_duration.
324 int need_edit(Edit
*current
, int test_transitions
);
325 // If the edit under position is playable.
326 // Used by PlayableTracks::is_playable.
327 int playable_edit(int64_t position
, int direction
);
329 // ===================================== for handles, titles, etc
331 int64_t old_view_start
;
332 int pixel
; // pixel position from top of track view
333 // Dimensions of this track if video
334 int track_w
, track_h
;
340 // Identification of the track