X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fedl.C;h=d033b8d5377c00401f16be10989748eb12494041;hp=5f23b1b1cd945c4ecc045a627495074b9bc140cf;hb=15b020d5c21b2cc5545227f7c092f06086666b4a;hpb=0c086b3e7b552e0f6b06c8696d7682d9d4bd91db diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index 5f23b1b1..d033b8d5 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -49,6 +49,7 @@ #include "playbackconfig.h" #include "playabletracks.h" #include "plugin.h" +#include "pluginset.h" #include "preferences.h" #include "recordconfig.h" #include "recordlabel.h" @@ -794,24 +795,42 @@ int EDL::clear(double start, double end, return 0; } +static int dead_edit_cmp(Edit**ap, Edit**bp) +{ + Edit *a = *ap, *b = *bp; + if( a->track != b->track ) return 0; + return a->startproject > b->startproject ? -1 : 1; +} + void EDL::delete_edits(ArrayList *edits, int collapse) { - if( session->labels_follow_edits ) - delete_edit_labels(edits, collapse); + edits->sort(dead_edit_cmp); for( int i=0; isize(); ++i ) { Edit *edit = edits->get(i); Track *track = edit->track; int64_t start = edit->startproject; - int end = start + edit->length; - track->clear(start, end, 1, 0, - session->plugins_follow_edits, - session->autos_follow_edits, 0); - if( !collapse ) - track->paste_silence(start, end, - session->plugins_follow_edits, - session->autos_follow_edits); + int64_t length = edit->length; + int64_t end = start + length; + if( session->autos_follow_edits ) { + track->automation->clear(start, end, 0, collapse); + } + if( session->plugins_follow_edits ) { + for( int k=0; kplugin_set.size(); ++k ) { + PluginSet *plugin_set = track->plugin_set[k]; + plugin_set->clear(start, end, 1); + if( !collapse ) + plugin_set->paste_silence(start, end, 1); + plugin_set->optimize(); + } + } + Edit *dead_edit = edit; + if( collapse ) { + while( (edit=edit->next) ) + edit->startproject -= length; + } + delete dead_edit; + track->edits->optimize(); } - optimize(); } class Range { @@ -891,58 +910,33 @@ void EDL::move_edit_labels(ArrayList *edits, double dist) } -void EDL::modify_edithandles(double oldposition, - double newposition, - int currentend, - int handle_mode, - int edit_labels, - int edit_plugins, - int edit_autos) +void EDL::modify_edithandles(double oldposition, double newposition, + int currentend, int handle_mode, int edit_labels, + int edit_plugins, int edit_autos, int group_id) { - tracks->modify_edithandles(oldposition, - newposition, - currentend, - handle_mode, - edit_labels, - edit_plugins, - edit_autos); - labels->modify_handles(oldposition, - newposition, - currentend, - handle_mode, - edit_labels); -} - -void EDL::modify_pluginhandles(double oldposition, - double newposition, - int currentend, - int handle_mode, - int edit_labels, - int edit_autos, - Edits *trim_edits) -{ - tracks->modify_pluginhandles(oldposition, - newposition, - currentend, - handle_mode, - edit_labels, - edit_autos, - trim_edits); + tracks->modify_edithandles(oldposition, newposition, + currentend, handle_mode, edit_labels, + edit_plugins, edit_autos, group_id); + labels->modify_handles(oldposition, newposition, + currentend, handle_mode, edit_labels); +} + +void EDL::modify_pluginhandles(double oldposition, double newposition, + int currentend, int handle_mode, int edit_labels, + int edit_autos, Edits *trim_edits) +{ + tracks->modify_pluginhandles(oldposition, newposition, + currentend, handle_mode, edit_labels, + edit_autos, trim_edits); optimize(); } -void EDL::paste_silence(double start, - double end, - int edit_labels, - int edit_plugins, - int edit_autos) +void EDL::paste_silence(double start, double end, + int edit_labels, int edit_plugins, int edit_autos) { if( edit_labels ) labels->paste_silence(start, end); - tracks->paste_silence(start, - end, - edit_plugins, - edit_autos); + tracks->paste_silence(start, end, edit_plugins, edit_autos); } @@ -1276,13 +1270,15 @@ void EDL::get_shared_tracks(Track *track, } } -// aligned frame time +// aligned frame time, account for sample truncation double EDL::frame_align(double position, int round) { - double frame_pos = position * session->frame_rate; - frame_pos = (int64_t)(frame_pos + (round ? 0.5 : 1e-6)); - position = frame_pos / session->frame_rate; - return position; + if( !round && session->sample_rate > 0 ) { + int64_t sample_pos = position * session->sample_rate; + position = (sample_pos+2.) / session->sample_rate; + } + int64_t frame_pos = (position * session->frame_rate + (round ? 0.5 : 1e-6)); + return frame_pos / session->frame_rate; } // Convert position to frames if alignment is enabled.