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

atrack.C

Go to the documentation of this file.
00001 #include "aedit.h"
00002 #include "aedits.h"
00003 #include "amodule.h"
00004 #include "apluginset.h"
00005 #include "atrack.h"
00006 #include "autoconf.h"
00007 #include "aautomation.h"
00008 #include "edit.h"
00009 #include "edl.h"
00010 #include "edlsession.h"
00011 #include "cache.h"
00012 #include "clip.h"
00013 #include "datatype.h"
00014 #include "file.h"
00015 #include "filexml.h"
00016 #include "floatautos.h"
00017 #include "language.h"
00018 #include "localsession.h"
00019 #include "mainsession.h"
00020 #include "panautos.h"
00021 #include "theme.h"
00022 #include "trackcanvas.h"
00023 #include "tracks.h"
00024 
00025 #include <string.h>
00026 
00027 
00028 
00029 ATrack::ATrack(EDL *edl, Tracks *tracks)
00030  : Track(edl, tracks)
00031 {
00032         data_type = TRACK_AUDIO;
00033 }
00034 
00035 ATrack::~ATrack()
00036 {
00037 }
00038 
00039 // Used by PlaybackEngine
00040 void ATrack::synchronize_params(Track *track)
00041 {
00042         Track::synchronize_params(track);
00043 
00044         ATrack *atrack = (ATrack*)track;
00045 }
00046 
00047 int ATrack::copy_settings(Track *track)
00048 {
00049         Track::copy_settings(track);
00050 
00051         ATrack *atrack = (ATrack*)track;
00052         return 0;
00053 }
00054 
00055 
00056 int ATrack::save_header(FileXML *file)
00057 {
00058         file->tag.set_property("TYPE", "AUDIO");
00059         return 0;
00060 }
00061 
00062 int ATrack::save_derived(FileXML *file)
00063 {
00064         char string[BCTEXTLEN];
00065         file->append_newline();
00066         return 0;
00067 }
00068 
00069 int ATrack::load_header(FileXML *file, uint32_t load_flags)
00070 {
00071         return 0;
00072 }
00073 
00074 
00075 int ATrack::load_derived(FileXML *file, uint32_t load_flags)
00076 {
00077         return 0;
00078 }
00079 
00080 int ATrack::create_objects()
00081 {
00082         Track::create_objects();
00083         automation = new AAutomation(edl, this);
00084         automation->create_objects();
00085         edits = new AEdits(edl, this);
00086         return 0;
00087 }
00088 
00089 int ATrack::vertical_span(Theme *theme)
00090 {
00091         int track_h = Track::vertical_span(theme);
00092         int patch_h = 0;
00093         if(expand_view)
00094         {
00095                 patch_h += theme->title_h + theme->play_h + theme->fade_h + theme->meter_h + theme->pan_h;
00096         }
00097         return MAX(track_h, patch_h);
00098 }
00099 
00100 PluginSet* ATrack::new_plugins()
00101 {
00102         return new APluginSet(edl, this);
00103 }
00104 
00105 int ATrack::load_defaults(Defaults *defaults)
00106 {
00107         Track::load_defaults(defaults);
00108         return 0;
00109 }
00110 
00111 void ATrack::set_default_title()
00112 {
00113         Track *current = ListItem<Track>::owner->first;
00114         int i;
00115         for(i = 0; current; current = NEXT)
00116         {
00117                 if(current->data_type == TRACK_AUDIO) i++;
00118         }
00119         sprintf(title, _("Audio %d"), i);
00120 }
00121 
00122 int64_t ATrack::to_units(double position, int round)
00123 {
00124         if(round)
00125                 return Units::round(position * edl->session->sample_rate);
00126         else
00127                 return Units::to_int64(position * edl->session->sample_rate);
00128 }
00129 
00130 double ATrack::to_doubleunits(double position)
00131 {
00132         return position * edl->session->sample_rate;
00133 }
00134 
00135 double ATrack::from_units(int64_t position)
00136 {
00137         return (double)position / edl->session->sample_rate;
00138 }
00139 
00140 
00141 int ATrack::identical(int64_t sample1, int64_t sample2)
00142 {
00143 // Units of samples
00144         if(labs(sample1 - sample2) <= 1) return 1; else return 0;
00145 }
00146 
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 
00165 
00166 
00167 
00168 
00169 
00170 int64_t ATrack::length()
00171 {
00172         return edits->length();
00173 }
00174 
00175 int ATrack::get_dimensions(double &view_start, 
00176         double &view_units, 
00177         double &zoom_units)
00178 {
00179         view_start = (double)edl->local_session->view_start * edl->session->sample_rate;
00180         view_units = (double)0;
00181 //      view_units = (double)tracks->view_samples();
00182         zoom_units = (double)edl->local_session->zoom_sample;
00183 }
00184 
00185 
00186 
00187 
00188 
00189 
00190 
00191 int ATrack::paste_derived(int64_t start, int64_t end, int64_t total_length, FileXML *xml, int &current_channel)
00192 {
00193         if(!strcmp(xml->tag.get_title(), "PANAUTOS"))
00194         {
00195                 current_channel = xml->tag.get_property("CHANNEL", current_channel);
00196 //              pan_autos->paste(start, end, total_length, xml, "/PANAUTOS", mwindow->session->autos_follow_edits);
00197                 return 1;
00198         }
00199         return 0;
00200 }
00201 
00202 
00203 
00204 
00205 

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