Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

autos.h

Go to the documentation of this file.
00001 #ifndef AUTOS_H
00002 #define AUTOS_H
00003 
00004 // Base class for automation lists.
00005 // Units are the native units for the track data type.
00006 
00007 #include "auto.h"
00008 #include "edl.inc"
00009 #include "guicast.h"
00010 #include "filexml.inc"
00011 #include "track.inc"
00012 
00013 #define AUTOS_VIRTUAL_HEIGHT 160
00014 
00015 class Autos : public List<Auto>
00016 {
00017 public:
00018         Autos(EDL *edl, 
00019                 Track *track);
00020                 
00021         virtual ~Autos();
00022 
00023         void resample(double old_rate, double new_rate);
00024 
00025         virtual void create_objects();
00026         void equivalent_output(Autos *autos, int64_t startproject, int64_t *result);
00027         void copy_from(Autos *autos);
00028         virtual Auto* new_auto();
00029 // Get existing auto on or before position.
00030 // If use_default is true, return default_auto if none exists 
00031 // on or before position.
00032 // Return 0 if none exists and use_default is false.
00033 // If &current is nonzero it is used as a starting point for searching.
00034         Auto* get_prev_auto(int64_t position, int direction, Auto* &current, int use_default = 1);
00035         Auto* get_prev_auto(int direction, Auto* &current);
00036         Auto* get_next_auto(int64_t position, int direction, Auto* &current, int use_default = 1);
00037 // Determine if a keyframe exists before creating it.
00038         int auto_exists_for_editing(double position);
00039 // Returns auto at exact position, null if non-existent. ignores autokeyframming and align on frames
00040         Auto* get_auto_at_position(double position = -1);
00041 
00042 // Get keyframe for editing with automatic creation if enabled
00043         Auto* get_auto_for_editing(double position = -1);
00044 
00045 // Insert keyframe at the point if it doesn't exist
00046         Auto* insert_auto(int64_t position);
00047 // Insert keyframe at the point if it doesn't exist
00048 // Interpolate it insead of copying
00049         Auto* insert_auto_for_editing(int64_t position);
00050         void insert_track(Autos *automation, 
00051                 int64_t start_unit, 
00052                 int64_t length_units,
00053                 int replace_default);
00054         virtual int load(FileXML *xml);
00055         void paste(int64_t start, 
00056                 int64_t length, 
00057                 double scale, 
00058                 FileXML *file, 
00059                 int default_only);
00060         void remove_nonsequential(Auto *keyframe);
00061         void optimize();
00062 
00063 // Returns a type enumeration
00064         int get_type();
00065         int64_t get_length();
00066         virtual void get_extents(float *min, 
00067                 float *max,
00068                 int *coords_undefined,
00069                 int64_t unit_start,
00070                 int64_t unit_end);
00071 
00072         EDL *edl;
00073         Track *track;
00074 // Default settings if no autos.
00075 // Having a persistent keyframe created problems when files were loaded and
00076 // we wanted to keep only 1 auto.
00077 // Default auto has position 0 except in effects, where multiple default autos
00078 // exist.
00079         Auto *default_auto;
00080 
00081         int type;
00082 
00083 
00084 
00085         virtual void dump();
00086 
00087 
00088 
00089 
00090 
00091 
00092         int clear_all();
00093         int insert(int64_t start, int64_t end);
00094         int paste_silence(int64_t start, int64_t end);
00095         int copy(int64_t start, 
00096                 int64_t end, 
00097                 FileXML *xml, 
00098                 int default_only,
00099                 int autos_only);
00100 // Stores the background rendering position in result
00101         void clear(int64_t start, 
00102                 int64_t end, 
00103                 int shift_autos);
00104         int clear_auto(int64_t position);
00105         int save(FileXML *xml);
00106         virtual int slope_adjustment(int64_t ax, double slope);
00107         int release_auto();
00108         virtual int release_auto_derived() {};
00109         Auto* append_auto();
00110         int scale_time(float rate_scale, int scale_edits, int scale_autos, int64_t start, int64_t end);
00111 
00112 // rendering utilities
00113         int get_neighbors(int64_t start, int64_t end, Auto **before, Auto **after);
00114 // 1 if automation doesn't change
00115         virtual int automation_is_constant(int64_t start, int64_t end);       
00116         virtual double get_automation_constant(int64_t start, int64_t end);
00117         int init_automation(int64_t &buffer_position,
00118                                 int64_t &input_start, 
00119                                 int64_t &input_end, 
00120                                 int &automate, 
00121                                 double &constant, 
00122                                 int64_t input_position,
00123                                 int64_t buffer_len,
00124                                 Auto **before, 
00125                                 Auto **after,
00126                                 int reverse);
00127 
00128         int init_slope(Auto **current_auto, 
00129                                 double &slope_start, 
00130                                 double &slope_value,
00131                                 double &slope_position, 
00132                                 int64_t &input_start, 
00133                                 int64_t &input_end, 
00134                                 Auto **before, 
00135                                 Auto **after,
00136                                 int reverse);
00137 
00138         int get_slope(Auto **current_auto, 
00139                                 double &slope_start, 
00140                                 double &slope_end, 
00141                                 double &slope_value,
00142                                 double &slope, 
00143                                 int64_t buffer_len, 
00144                                 int64_t buffer_position,
00145                                 int reverse);
00146 
00147         int advance_slope(Auto **current_auto, 
00148                                 double &slope_start, 
00149                                 double &slope_value,
00150                                 double &slope_position, 
00151                                 int reverse);
00152 
00153         Auto* autoof(int64_t position);   // return nearest auto equal to or after position
00154                                                                                                   // 0 if after all autos
00155         Auto* nearest_before(int64_t position);    // return nearest auto before or 0
00156         Auto* nearest_after(int64_t position);     // return nearest auto after or 0
00157 
00158         Auto *selected;
00159         int skip_selected;      // if selected was added
00160         int64_t selected_position, selected_position_;      // original position for moves
00161         double selected_value, selected_value_;      // original position for moves
00162         float virtual_h;  // height cursor moves to cover entire range when track height is less than this
00163         int virtual_center;
00164         int stack_number;
00165         int stack_total;
00166 };
00167 
00168 
00169 
00170 
00171 
00172 
00173 #endif

Generated on Sun Jan 8 13:38:50 2006 for Cinelerra-svn by  doxygen 1.4.4