4 #include "apluginset.h"
7 #include "aautomation.h"
10 #include "edlsession.h"
16 #include "floatautos.h"
18 #include "localsession.h"
19 #include "mainsession.h"
22 #include "trackcanvas.h"
29 ATrack::ATrack(EDL *edl, Tracks *tracks)
32 data_type = TRACK_AUDIO;
39 // Used by PlaybackEngine
40 void ATrack::synchronize_params(Track *track)
42 Track::synchronize_params(track);
44 ATrack *atrack = (ATrack*)track;
47 int ATrack::copy_settings(Track *track)
49 Track::copy_settings(track);
51 ATrack *atrack = (ATrack*)track;
56 int ATrack::save_header(FileXML *file)
58 file->tag.set_property("TYPE", "AUDIO");
62 int ATrack::save_derived(FileXML *file)
64 char string[BCTEXTLEN];
65 file->append_newline();
69 int ATrack::load_header(FileXML *file, uint32_t load_flags)
75 int ATrack::load_derived(FileXML *file, uint32_t load_flags)
80 int ATrack::create_objects()
82 Track::create_objects();
83 automation = new AAutomation(edl, this);
84 automation->create_objects();
85 edits = new AEdits(edl, this);
89 int ATrack::vertical_span(Theme *theme)
91 int track_h = Track::vertical_span(theme);
95 patch_h += theme->title_h + theme->play_h + theme->fade_h + theme->meter_h + theme->pan_h;
97 return MAX(track_h, patch_h);
100 PluginSet* ATrack::new_plugins()
102 return new APluginSet(edl, this);
105 int ATrack::load_defaults(Defaults *defaults)
107 Track::load_defaults(defaults);
111 void ATrack::set_default_title()
113 Track *current = ListItem<Track>::owner->first;
115 for(i = 0; current; current = NEXT)
117 if(current->data_type == TRACK_AUDIO) i++;
119 sprintf(title, _("Audio %d"), i);
122 int64_t ATrack::to_units(double position, int round)
125 return Units::round(position * edl->session->sample_rate);
127 return Units::to_int64(position * edl->session->sample_rate);
130 double ATrack::to_doubleunits(double position)
132 return position * edl->session->sample_rate;
135 double ATrack::from_units(int64_t position)
137 return (double)position / edl->session->sample_rate;
141 int ATrack::identical(int64_t sample1, int64_t sample2)
144 if(labs(sample1 - sample2) <= 1) return 1; else return 0;
170 int64_t ATrack::length()
172 return edits->length();
175 int ATrack::get_dimensions(double &view_start,
179 view_start = (double)edl->local_session->view_start * edl->session->sample_rate;
180 view_units = (double)0;
181 // view_units = (double)tracks->view_samples();
182 zoom_units = (double)edl->local_session->zoom_sample;
191 int ATrack::paste_derived(int64_t start, int64_t end, int64_t total_length, FileXML *xml, int ¤t_channel)
193 if(!strcmp(xml->tag.get_title(), "PANAUTOS"))
195 current_channel = xml->tag.get_property("CHANNEL", current_channel);
196 // pan_autos->paste(start, end, total_length, xml, "/PANAUTOS", mwindow->session->autos_follow_edits);