X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Ftrack.C;h=e3f624c0e3fc4564f92b6dc76c90705d237e0091;hb=0513350234a8dcd08e5a0117d5121724ef7b76b6;hp=10460c0cff35d959a5bfff45a763faf8d45cacd5;hpb=05bf5047966713579bd8e7a692fda3b49bc43450;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/track.C b/cinelerra-5.1/cinelerra/track.C index 10460c0c..e3f624c0 100644 --- a/cinelerra-5.1/cinelerra/track.C +++ b/cinelerra-5.1/cinelerra/track.C @@ -66,6 +66,7 @@ Track::Track(EDL *edl, Tracks *tracks) : ListItem() track_w = edl->session->output_w; track_h = edl->session->output_h; id = EDL::next_id(); + mixer_id = -1; } Track::~Track() @@ -87,6 +88,7 @@ int Track::copy_settings(Track *track) this->gang = track->gang; this->record = track->record; this->nudge = track->nudge; + this->mixer_id = track->mixer_id; this->play = track->play; this->track_w = track->track_w; this->track_h = track->track_h; @@ -321,6 +323,7 @@ int Track::load(FileXML *file, int track_offset, uint32_t load_flags) gang = file->tag.get_property("GANG", gang); draw = file->tag.get_property("DRAW", draw); nudge = file->tag.get_property("NUDGE", nudge); + mixer_id = file->tag.get_property("MIXER_ID", mixer_id); expand_view = file->tag.get_property("EXPAND", expand_view); track_w = file->tag.get_property("TRACK_W", track_w); track_h = file->tag.get_property("TRACK_H", track_h); @@ -352,6 +355,8 @@ int Track::load(FileXML *file, int track_offset, uint32_t load_flags) { if(load_flags & LOAD_EDITS) edits->load(file, track_offset); + else + result = file->skip_tag(); } else if(file->tag.title_is("PLUGINSET")) @@ -372,6 +377,8 @@ int Track::load(FileXML *file, int track_offset, uint32_t load_flags) current_plugin++; } } + else + result = file->skip_tag(); } else load_derived(file, load_flags); @@ -1064,6 +1071,7 @@ int Track::copy(double start, file->tag.set_title("TRACK"); file->tag.set_property("RECORD", record); file->tag.set_property("NUDGE", nudge); + file->tag.set_property("MIXER_ID", mixer_id); file->tag.set_property("PLAY", play); file->tag.set_property("GANG", gang); file->tag.set_property("DRAW", draw); @@ -1146,17 +1154,9 @@ int Track::copy_assets(double start, } - - - -int Track::clear(double start, - double end, - int edit_edits, - int edit_labels, - int edit_plugins, - int edit_autos, - int convert_units, - Edits *trim_edits) +int Track::clear(double start, double end, + int edit_edits, int edit_labels, int edit_plugins, + int edit_autos, int convert_units, Edits *trim_edits) { // Edits::move_auto calls this routine after the units are converted to the track // format. @@ -1541,7 +1541,10 @@ void Track::shuffle_edits(double start, double end, int first_track) int index = rand() % new_edits.size(); Edit *edit = new_edits.get(index); new_edits.remove_number(index); - edits->insert_after(start_edit, edit); + if( !start_edit ) + edits->insert_before(edits->first, edit); + else + edits->insert_after(start_edit, edit); start_edit = edit; // Recalculate start position @@ -1564,20 +1567,18 @@ void Track::shuffle_edits(double start, double end, int first_track) if(first_track && edl->session->labels_follow_edits) { double start_seconds1 = from_units(startproject1); + double end_seconds1 = from_units(startproject1 + edit->length); double start_seconds2 = from_units(startproject2); - //double end_seconds1 = from_units(edit->startproject + - // edit->length); for(int i = new_labels.size() - 1; i >= 0; i--) { Label *label = new_labels.get(i); // Was in old edit position if(label->position >= start_seconds1 && - label->position < start_seconds2) + label->position < end_seconds1) { // Move to new edit position double position = label->position - - start_seconds1 + - start_seconds2; + start_seconds1 + start_seconds2; edl->labels->insert_label(position); new_labels.remove_object_number(i); } @@ -1657,7 +1658,10 @@ void Track::reverse_edits(double start, double end, int first_track) int index = new_edits.size() - 1; Edit *edit = new_edits.get(index); new_edits.remove_number(index); - edits->insert_after(start_edit, edit); + if( !start_edit ) + edits->insert_before(edits->first, edit); + else + edits->insert_after(start_edit, edit); start_edit = edit; // Recalculate start position @@ -1680,19 +1684,18 @@ void Track::reverse_edits(double start, double end, int first_track) if(first_track && edl->session->labels_follow_edits) { double start_seconds1 = from_units(startproject1); + double end_seconds1 = from_units(startproject1 + edit->length); double start_seconds2 = from_units(startproject2); - //double end_seconds1 = from_units(edit->startproject + edit->length); for(int i = new_labels.size() - 1; i >= 0; i--) { Label *label = new_labels.get(i); // Was in old edit position if(label->position >= start_seconds1 && - label->position < start_seconds2) + label->position < end_seconds1) { // Move to new edit position double position = label->position - - start_seconds1 + - start_seconds2; + start_seconds1 + start_seconds2; edl->labels->insert_label(position); new_labels.remove_object_number(i); } @@ -1867,3 +1870,14 @@ int Track::plugin_exists(Plugin *plugin) return 0; } +int Track::get_mixer_id() +{ + if( mixer_id < 0 ) { + int v = 0; + for( Track *track=tracks->first; track!=0; track=track->next ) + if( track->mixer_id > v ) v = track->mixer_id; + mixer_id = v + 1; + } + return mixer_id; +} +