From: Good Guy Date: Tue, 14 Nov 2017 18:47:08 +0000 (-0700) Subject: rework deglitch/optimize/stop_playback, sams ladspa icons, reticle color, tweak frame... X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=ad2996ab94e6e12c9c14a5b9f14792f76111dff7;p=goodguy%2Fhistory.git rework deglitch/optimize/stop_playback, sams ladspa icons, reticle color, tweak frame align, mem leak in mask, hard edge clr tweak --- diff --git a/cinelerra-5.1/cinelerra/atrack.C b/cinelerra-5.1/cinelerra/atrack.C index 9aceea09..ee39162a 100644 --- a/cinelerra-5.1/cinelerra/atrack.C +++ b/cinelerra-5.1/cinelerra/atrack.C @@ -175,15 +175,3 @@ int ATrack::paste_derived(int64_t start, int64_t end, int64_t total_length, File return 0; } -void ATrack::deglitch(double position, - int edit_labels, int edit_plugins, int edit_autos) -{ - int64_t samples = to_units(position, 0); - edits->deglitch(samples); - if( edit_plugins ) { - for(int i = 0; i < plugin_set.size(); i++) { - plugin_set.get(i)->deglitch(samples); - } - } -} - diff --git a/cinelerra-5.1/cinelerra/atrack.h b/cinelerra-5.1/cinelerra/atrack.h index 74a4d935..0295697f 100644 --- a/cinelerra-5.1/cinelerra/atrack.h +++ b/cinelerra-5.1/cinelerra/atrack.h @@ -33,8 +33,6 @@ #include "track.h" - - class ATrack : public Track { public: @@ -58,33 +56,15 @@ public: double to_doubleunits(double position); double from_units(int64_t position); - - - - - - - // ====================================== initialization int create_derived_objs(int flash); - - - // ===================================== editing int paste_derived(int64_t start, int64_t end, int64_t total_length, FileXML *xml, int ¤t_channel); - - int modify_handles(int64_t oldposition, int64_t newposition, int currentend); - void deglitch(double position, - int edit_labels, - int edit_plugins, - int edit_autos); int64_t length(); -// int get_dimensions(double &view_start, -// double &view_units, -// double &zoom_units); +// int get_dimensions(double &view_start, double &view_units, double &zoom_units); }; #endif diff --git a/cinelerra-5.1/cinelerra/cwindow.C b/cinelerra-5.1/cinelerra/cwindow.C index 176bf3c4..c292d66d 100644 --- a/cinelerra-5.1/cinelerra/cwindow.C +++ b/cinelerra-5.1/cinelerra/cwindow.C @@ -215,12 +215,9 @@ void CWindow::calculate_affected_autos(FloatAuto **x_auto, } } -void CWindow::stop_playback() +void CWindow::stop_playback(int wait) { - int locked = gui->get_window_lock(); - if( locked ) gui->unlock_window(); - playback_engine->interrupt_playback(1); - if( locked ) gui->lock_window("CWindow::stop_playback"); + playback_engine->stop_playback(wait); } void CWindow::run() diff --git a/cinelerra-5.1/cinelerra/cwindow.h b/cinelerra-5.1/cinelerra/cwindow.h index 3d81ce09..33c43a1d 100644 --- a/cinelerra-5.1/cinelerra/cwindow.h +++ b/cinelerra-5.1/cinelerra/cwindow.h @@ -69,7 +69,7 @@ public: void show_window(); void hide_window(); int update_position(double position); - void stop_playback(); + void stop_playback(int wait); int destination; MWindow *mwindow; diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index 95bae397..cb2dbac9 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -604,7 +604,7 @@ int CWindowGUI::drag_stop() if(mwindow->session->drag_assets->total) { mwindow->gui->lock_window("CWindowGUI::drag_stop 1"); - mwindow->clear(0, 1); + mwindow->clear(0); mwindow->load_assets(mwindow->session->drag_assets, mwindow->edl->local_session->get_selectionstart(), LOADMODE_PASTE, @@ -619,7 +619,7 @@ int CWindowGUI::drag_stop() if(mwindow->session->drag_clips->total) { mwindow->gui->lock_window("CWindowGUI::drag_stop 2"); - mwindow->clear(0, 1); + mwindow->clear(0); mwindow->paste_edls(mwindow->session->drag_clips, LOADMODE_PASTE, mwindow->session->track_highlighted, diff --git a/cinelerra-5.1/cinelerra/edits.C b/cinelerra-5.1/cinelerra/edits.C index 6c512009..9024af90 100644 --- a/cinelerra-5.1/cinelerra/edits.C +++ b/cinelerra-5.1/cinelerra/edits.C @@ -295,25 +295,20 @@ void Edits::resample(double old_rate, double new_rate) } } - - - - - - - - - - - - +int Edits::is_glitch(Edit *edit) +{ + if( track->data_type != TRACK_AUDIO ) return 0; + int64_t threshold = edl->session->frame_rate > 0 ? + 0.5 * edl->session->sample_rate / edl->session->frame_rate : 0; +// audio edit shorter than .5 frames is a glitch + return edit->length < threshold ? 1 : 0; +} int Edits::optimize() { int result = 1; Edit *current; - //printf("Edits::optimize %d\n", __LINE__); // Sort edits by starting point while(result) @@ -379,43 +374,55 @@ int Edits::optimize() current = next; } -//printf("Edits::optimize %d result=%d\n", __LINE__, result); -// merge same files or transitions - if(track->data_type == TRACK_SUBTITLE ) continue; - - for(current = first; !result && current && current->next; ) { - Edit *next_edit = current->next; -// printf("Edits::optimize %d %lld=%lld %d=%d %p=%p %p=%p\n", -// __LINE__, current->startsource + current->length, next_edit->startsource, -// current->channel, next_edit->channel, current->asset, next_edit->asset, -// current->nested_edl, next_edit->nested_edl); - +// merge same files or transitions, and deglitch + if( !result && track->data_type != TRACK_SUBTITLE ) { + current = first; + if( current && !current->hard_right && + current->next && !current->next->hard_left && + is_glitch(current) ) { +// if the first edit is a glitch, change it to silence + current->asset = 0; + current->nested_edl = 0; + } + Edit *next_edit = 0; + for( ; current && (next_edit=current->next); current=NEXT ) { // both edges are not hard edges + if( current->hard_right || next_edit->hard_left ) continue; +// next edit is a glitch + if( is_glitch(next_edit) ) + break; // both edits are silence & not a plugin -// source channels are identical, assets are identical - if( !current->hard_right && !next_edit->hard_left && ( - (current->silence() && next_edit->silence() && !current->is_plugin) || - (current->startsource + current->length == next_edit->startsource && - current->channel == next_edit->channel && - current->asset == next_edit->asset && - current->nested_edl == next_edit->nested_edl)) ) { -//printf("Edits::optimize %d\n", __LINE__); - current->length += next_edit->length; - remove(next_edit); - result = 1; - break; - } - - current = current->next; + if( !current->is_plugin && current->silence() && + !next_edit->is_plugin && next_edit->silence() ) + break; +// source channels are identical & assets are identical + if( !result && current->channel == next_edit->channel && + current->asset == next_edit->asset && + current->nested_edl == next_edit->nested_edl ) { +// and stop and start in the same frame + int64_t current_end = current->startsource + current->length; + int64_t next_start = next_edit->startsource; + if( current_end == next_start || + EQUIV(edl->frame_align(track->from_units(current_end), 1), + edl->frame_align(track->from_units(next_start), 1)) ) + break; + } + } + if( next_edit ) { + int64_t current_start = current->startproject; + int64_t next_end = next_edit->startproject + next_edit->length; + current->length = next_end - current_start; + remove(next_edit); + result = 1; + } } - if(last && last->silence() && !last->transition ) { + if( last && last->silence() && !last->transition ) { delete last; result = 1; } } -//track->dump(); return 0; } @@ -593,7 +600,7 @@ void Edits::clear(int64_t start, int64_t end) end = this->length(); } - if(edit1 != edit2) + if( edit1 && edit2 && edit1 != edit2) { // in different edits @@ -844,124 +851,3 @@ void Edits::shift_effects_recursive(int64_t position, int64_t length, int edit_a track->shift_effects(position, length, edit_autos); } -// only used for audio but also used for plugins which inherit from Edits -void Edits::deglitch(int64_t position) -{ -// range from the splice junk appears - int64_t threshold = (int64_t)((double)edl->session->sample_rate / - edl->session->frame_rate) / 2; - Edit *current = 0; - -// the last edit before the splice - Edit *edit1 = 0; - if(first) - { - for(current = first; current; current = NEXT) - { - if(current->startproject + current->length >= position - threshold) - { - edit1 = current; - break; - } - } - -// ignore if it ends after the splice - if(current && current->startproject + current->length >= position) - { - edit1 = 0; - } - } - -// the first edit after the splice - Edit *edit2 = 0; - if(last) - { - for(current = last; current; current = PREVIOUS) - { - if(current->startproject < position + threshold) - { - edit2 = current; - break; - } - } - - // ignore if it starts before the splice - if(current && current->startproject < position) - { - edit2 = 0; - } - } - - - - -// printf("Edits::deglitch %d position=%ld edit1=%p edit2=%p\n", __LINE__, -// position, -// edit1, -// edit2); -// delete junk between the edits - if(edit1 != edit2) - { - if(edit1 != 0) - { -// end the starting edit later - current = edit1->next; - while(current != 0 && - current != edit2 && - current->startproject < position) - { - Edit* next = NEXT; - - edit1->length += current->length; - remove(current); - - current = next; - } - } - - if(edit2 != 0) - { -// start the ending edit earlier - current = edit2->previous; - while(current != 0 && - current != edit1 && - current->startproject >= position) - { - Edit *previous = PREVIOUS; - - int64_t length = current->length; -//printf("Edits::deglitch %d length=%ld\n", __LINE__, length); - if(!edit2->silence() && - length > edit2->startsource) - { - length = edit2->startsource; - } - - // shift edit2 by using material from its source - edit2->startproject -= length; - edit2->startsource -= length; - // assume enough is at the end - edit2->length += length; - - // shift edit2 & its source earlier by remainder - if(length < current->length) - { - int64_t remainder = current->length - length; - edit2->startproject -= remainder; - // assume enough is at the end - edit2->length += remainder; - } - - remove(current); - - - current = previous; - } - } - } - -} - - - - diff --git a/cinelerra-5.1/cinelerra/edits.h b/cinelerra-5.1/cinelerra/edits.h index 040c6bfa..c0f2cdf0 100644 --- a/cinelerra-5.1/cinelerra/edits.h +++ b/cinelerra-5.1/cinelerra/edits.h @@ -111,6 +111,8 @@ public: Edit* get_playable_edit(int64_t position, int use_nudge); // int64_t total_length(); int64_t length(); // end position of last edit +// audio edit shorter than .5 frames is a glitch + int is_glitch(Edit *edit); // ==================================== editing @@ -123,7 +125,6 @@ public: int edit_plugins, int edit_autos, Edits *trim_edits); - void deglitch(int64_t position); virtual int optimize(); virtual int clone_derived(Edit* new_edit, Edit* old_edit) { return 0; } diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index 12fe4f35..9b4e9c14 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -825,24 +825,9 @@ void EDL::set_outpoint(double position) } } -void EDL::deglitch(double position) -{ - if( !session->cursor_on_frames ) return; - Track *current_track = tracks->first; - for( ; current_track; current_track=current_track->next ) { - if( !current_track->record ) continue; - if( current_track->data_type != TRACK_AUDIO ) continue; - ATrack *atrack = (ATrack*)current_track; - atrack->deglitch(position, - session->labels_follow_edits, - session->plugins_follow_edits, - session->autos_follow_edits); - } -} - int EDL::blade(double position) { - return tracks->blade(align_to_frame(position,0)); + return tracks->blade(position); } int EDL::clear(double start, double end, @@ -1334,15 +1319,20 @@ void EDL::get_shared_tracks(Track *track, } } -// Convert position to frames if cursor alignment is enabled +// aligned frame time +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; +} + +// Convert position to frames if alignment is enabled. double EDL::align_to_frame(double position, int round) { - if( session->cursor_on_frames && session->frame_rate > 0 ) { - double frame_no = position * session->frame_rate; - int64_t frame_pos = frame_no + (round ? 0.5 : 1e-6); - double pos = frame_pos / session->frame_rate; - if( !EQUIV(pos, position) ) position = pos; - } + if( session->cursor_on_frames ) + position = frame_align(position, round); return position; } diff --git a/cinelerra-5.1/cinelerra/edl.h b/cinelerra-5.1/cinelerra/edl.h index 00f31bb0..13fd8d5d 100644 --- a/cinelerra-5.1/cinelerra/edl.h +++ b/cinelerra-5.1/cinelerra/edl.h @@ -95,7 +95,9 @@ public: int direction, PlayableTracks *playable_tracks); -// Convert position to frames if cursor alignment is enabled +// Convert position to frame boundry times + double frame_align(double position, int round); +// frame align if cursor alignment is enabled double align_to_frame(double position, int round); // increase track w/h to at least session w/h diff --git a/cinelerra-5.1/cinelerra/maskauto.C b/cinelerra-5.1/cinelerra/maskauto.C index b9681418..a4b64a84 100644 --- a/cinelerra-5.1/cinelerra/maskauto.C +++ b/cinelerra-5.1/cinelerra/maskauto.C @@ -71,6 +71,7 @@ SubMask::SubMask(MaskAuto *keyframe) SubMask::~SubMask() { + points.remove_all_objects(); } int SubMask::equivalent(SubMask& ptr) diff --git a/cinelerra-5.1/cinelerra/menueffects.C b/cinelerra-5.1/cinelerra/menueffects.C index b1f8a050..12f43384 100644 --- a/cinelerra-5.1/cinelerra/menueffects.C +++ b/cinelerra-5.1/cinelerra/menueffects.C @@ -516,7 +516,7 @@ void MenuEffectThread::run() mwindow->undo->update_undo_before("", 0); if(load_mode == LOADMODE_PASTE) - mwindow->clear(0, 1); + mwindow->clear(0); mwindow->load_assets(&assets, -1, load_mode, 0, 0, mwindow->edl->session->labels_follow_edits, diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 448f37b6..ae471267 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -237,10 +237,8 @@ MWindow::MWindow() MWindow::~MWindow() { run_lock->lock("MWindow::~MWindow"); - stop_playback(1); in_destructor = 1; //printf("MWindow::~MWindow %d\n", __LINE__); - gui->stop_drawing(); gui->remote_control->deactivate(); gui->record->stop(); #ifdef HAVE_DVB @@ -1563,23 +1561,20 @@ int MWindow::put_commercial() void MWindow::stop_playback(int wait) { - int locked = gui->get_window_lock(); - if( locked ) gui->unlock_window(); gui->stop_drawing(); - cwindow->stop_playback(); + cwindow->stop_playback(wait); for(int i = 0; i < vwindows.size(); i++) { VWindow *vwindow = vwindows[i]; if( !vwindow->is_running() ) continue; - vwindow->stop_playback(); + vwindow->stop_playback(wait); } for(int i = 0; i < zwindows.size(); i++) { ZWindow *zwindow = zwindows[i]; if( !zwindow->is_running() ) continue; - zwindow->stop_playback(); + zwindow->stop_playback(wait); } - if( locked ) gui->lock_window("MWindow::stop_playback"); } int MWindow::load_filenames(ArrayList *filenames, @@ -1597,7 +1592,9 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__); // Need to stop playback since tracking depends on the EDL not getting // deleted. + gui->unlock_window(); stop_playback(1); + gui->lock_window("MWindow::load_filenames 0"); if(debug) printf("MWindow::load_filenames %d\n", __LINE__); undo->update_undo_before(); @@ -3376,17 +3373,10 @@ int MWindow::create_aspect_ratio(float &w, float &h, int width, int height) void MWindow::reset_caches() { - stop_playback(1); - int locked = gui->get_window_lock(); - if( locked ) gui->unlock_window(); - gui->resource_thread->stop_draw(1); - gui->resource_thread->source_lock->lock("MWindow::reset_caches"); frame_cache->remove_all(); wave_cache->remove_all(); audio_cache->remove_all(); video_cache->remove_all(); - gui->resource_thread->source_lock->unlock(); - if( locked ) gui->lock_window("MWindow::reset_caches"); if( cwindow->playback_engine ) { if( cwindow->playback_engine->audio_cache ) cwindow->playback_engine->audio_cache->remove_all(); @@ -3406,17 +3396,10 @@ void MWindow::reset_caches() void MWindow::remove_asset_from_caches(Asset *asset) { - stop_playback(1); - int locked = gui->get_window_lock(); - if( locked ) gui->unlock_window(); - gui->resource_thread->stop_draw(1); - gui->resource_thread->source_lock->lock("MWindow::remove_asset_from_caches"); frame_cache->remove_asset(asset); wave_cache->remove_asset(asset); audio_cache->delete_entry(asset); video_cache->delete_entry(asset); - gui->resource_thread->source_lock->unlock(); - if( locked ) gui->lock_window("MWindow::remove_asset_from_caches"); if( cwindow->playback_engine && cwindow->playback_engine->audio_cache ) cwindow->playback_engine->audio_cache->delete_entry(asset); if( cwindow->playback_engine && cwindow->playback_engine->video_cache ) diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index 6bf48433..f15081b6 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -202,7 +202,7 @@ public: static int plugin_exists(const char *plugin_path, ArrayList &plugins); static int plugin_exists(char *plugin_path); void dump_plugindb(FILE *fp); - void stop_playback(int wait=0); + void stop_playback(int wait); void queue_mixers(EDL *edl, int command, int wait_tracking, int use_inout, int update_refresh, int toggle_audio); @@ -324,7 +324,7 @@ public: // Clears active region in EDL. // If clear_handle, edit boundaries are cleared if the range is 0. // Called by paste, record, menueffects, render, and CWindow drop. - void clear(int clear_handle, int deglitch); + void clear(int clear_handle); void clear_labels(); int clear_labels(double start, double end); void concatenate_tracks(); diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index 168b7c93..e128a19b 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -301,7 +301,7 @@ void MWindow::asset_to_rate() void MWindow::clear_entry() { undo->update_undo_before(); - clear(1, 1); + clear(1); edl->optimize(); save_backup(); @@ -315,7 +315,7 @@ void MWindow::clear_entry() send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); } -void MWindow::clear(int clear_handle, int deglitch) +void MWindow::clear(int clear_handle) { double start = edl->local_session->get_selectionstart(); double end = edl->local_session->get_selectionend(); @@ -326,12 +326,6 @@ void MWindow::clear(int clear_handle, int deglitch) edl->session->plugins_follow_edits, edl->session->autos_follow_edits); } - -// always needed by paste operations - if(deglitch) - { - edl->deglitch(start); - } } void MWindow::set_automation_mode(int mode) @@ -550,8 +544,6 @@ void MWindow::cut(double start, double end, double new_position) edl->session->labels_follow_edits, edl->session->plugins_follow_edits, edl->session->autos_follow_edits); - edl->deglitch(start); - edl->optimize(); save_backup(); @@ -892,14 +884,12 @@ void MWindow::finish_modify_handles() //printf("MWindow::finish_modify_handles %d\n", __LINE__); edl->local_session->set_selectionstart(session->drag_position); edl->local_session->set_selectionend(session->drag_position); - edl->deglitch(session->drag_position); } else if( edit_mode != MOVE_NO_EDITS ) { //printf("MWindow::finish_modify_handles %d\n", __LINE__); edl->local_session->set_selectionstart(session->drag_start); edl->local_session->set_selectionend(session->drag_start); - edl->deglitch(session->drag_start); } // clamp the selection to 0 @@ -1081,10 +1071,7 @@ void MWindow::mute_selection() edl->paste_silence(start, end, 0, edl->session->plugins_follow_edits, edl->session->autos_follow_edits); - edl->deglitch(start); - edl->deglitch(end); - save_backup(); undo->update_undo_after(_("mute"), LOAD_EDITS); @@ -1146,7 +1133,7 @@ int MWindow::paste(double start, int edit_plugins, int edit_autos) { - clear(0, 1); + clear(0); // Want to insert with assets shared with the master EDL. insert(start, file, @@ -1169,7 +1156,7 @@ void MWindow::paste() gui->from_clipboard(string, len, BC_PRIMARY_SELECTION); FileXML file; file.read_from_string(string); - clear(0, 1); + clear(0); insert(start, &file, edl->session->labels_follow_edits, @@ -1648,8 +1635,6 @@ void MWindow::paste_silence() edl->session->labels_follow_edits, edl->session->plugins_follow_edits, edl->session->autos_follow_edits); - edl->deglitch(start); - edl->deglitch(end); edl->optimize(); save_backup(); undo->update_undo_after(_("silence"), LOAD_EDITS | LOAD_TIMEBAR); @@ -1902,20 +1887,8 @@ void MWindow::set_transition_length(double length) void MWindow::redo_entry(BC_WindowBase *calling_window_gui) { - calling_window_gui->unlock_window(); - - cwindow->playback_engine->que-> - send_command(STOP, CHANGE_NONE, 0, 0); - cwindow->playback_engine->interrupt_playback(0); - - for( int i = 0; i < vwindows.size(); i++ ) { - if( vwindows.get(i)->is_running() ) { - vwindows.get(i)->playback_engine->que-> - send_command(STOP, CHANGE_NONE, 0, 0); - vwindows.get(i)->playback_engine->interrupt_playback(0); - } - } + stop_playback(0); cwindow->gui->lock_window("MWindow::redo_entry"); for( int i = 0; i < vwindows.size(); i++ ) { @@ -2187,10 +2160,6 @@ void MWindow::trim_selection() edl->session->labels_follow_edits, edl->session->plugins_follow_edits, edl->session->autos_follow_edits); - edl->deglitch(0); - edl->deglitch(edl->local_session->get_selectionend() - - edl->local_session->get_selectionstart()); - save_backup(); undo->update_undo_after(_("trim selection"), LOAD_EDITS | LOAD_TIMEBAR); @@ -2207,19 +2176,7 @@ void MWindow::trim_selection() void MWindow::undo_entry(BC_WindowBase *calling_window_gui) { calling_window_gui->unlock_window(); - - cwindow->playback_engine->que-> - send_command(STOP, CHANGE_NONE, 0, 0); - cwindow->playback_engine->interrupt_playback(0); - -//printf("MWindow::undo_entry %d %d\n", __LINE__, vwindows.size()); - for( int i = 0; i < vwindows.size(); i++ ) { - if( vwindows.get(i)->is_running() ) { - vwindows.get(i)->playback_engine->que-> - send_command(STOP, CHANGE_NONE, 0, 0); - vwindows.get(i)->playback_engine->interrupt_playback(0); - } - } + stop_playback(0); cwindow->gui->lock_window("MWindow::undo_entry 1"); for( int i = 0; i < vwindows.size(); i++ ) { diff --git a/cinelerra-5.1/cinelerra/new.C b/cinelerra-5.1/cinelerra/new.C index 14df0a12..d157d58a 100644 --- a/cinelerra-5.1/cinelerra/new.C +++ b/cinelerra-5.1/cinelerra/new.C @@ -94,18 +94,7 @@ void New::create_new_edl() int New::create_new_project() { - mwindow->cwindow->playback_engine->que->send_command(STOP, - CHANGE_NONE, 0, 0); - - for( int i=0; ivwindows.size(); ++i ) { - VWindow *vwindow = mwindow->vwindows.get(i); - if( !vwindow->is_running() ) continue; - vwindow->playback_engine->que->send_command(STOP, CHANGE_NONE, 0, 0); - vwindow->playback_engine->interrupt_playback(0); - } - - mwindow->cwindow->playback_engine->interrupt_playback(0); - + mwindow->stop_playback(0); mwindow->gui->lock_window(); mwindow->reset_caches(); diff --git a/cinelerra-5.1/cinelerra/playback3d.C b/cinelerra-5.1/cinelerra/playback3d.C index 3dcb00df..835d8a22 100644 --- a/cinelerra-5.1/cinelerra/playback3d.C +++ b/cinelerra-5.1/cinelerra/playback3d.C @@ -1260,6 +1260,7 @@ void Playback3D::do_mask_sync(Playback3DCommand *command) // Need to tabulate every vertex in persistent memory because // gluTessVertex doesn't copy them. ArrayList coords; + coords.set_array_delete(); for(int i = 0; i < points->total; i++) { MaskPoint *point1 = points->values[i]; diff --git a/cinelerra-5.1/cinelerra/playbackengine.C b/cinelerra-5.1/cinelerra/playbackengine.C index 0918ead4..2842377a 100644 --- a/cinelerra-5.1/cinelerra/playbackengine.C +++ b/cinelerra-5.1/cinelerra/playbackengine.C @@ -415,10 +415,10 @@ void PlaybackEngine::run() } -void PlaybackEngine::stop_playback() +void PlaybackEngine::stop_playback(int wait) { que->send_command(STOP, CHANGE_NONE, 0, 0); - interrupt_playback(1); + interrupt_playback(wait); renderengine_lock->lock("PlaybackEngine::stop_playback"); if(render_engine) render_engine->wait_done(); diff --git a/cinelerra-5.1/cinelerra/playbackengine.h b/cinelerra-5.1/cinelerra/playbackengine.h index 1dd0482e..5d915877 100644 --- a/cinelerra-5.1/cinelerra/playbackengine.h +++ b/cinelerra-5.1/cinelerra/playbackengine.h @@ -81,7 +81,7 @@ public: ChannelDB* get_channeldb(); void run(); - void stop_playback(); + void stop_playback(int wait); void issue_command(EDL *edl, int command, int wait_tracking, int use_inout, int update_refresh, int toggle_audio); diff --git a/cinelerra-5.1/cinelerra/record.C b/cinelerra-5.1/cinelerra/record.C index 3ea53a42..ece6d088 100644 --- a/cinelerra-5.1/cinelerra/record.C +++ b/cinelerra-5.1/cinelerra/record.C @@ -405,7 +405,7 @@ void Record::run() mwindow->undo->update_undo_before(); // For pasting, clear the active region if(load_mode == LOADMODE_PASTE) - mwindow->clear(0, 1); + mwindow->clear(0); int loadmode = load_mode == LOADMODE_RESOURCESONLY ? LOADMODE_ASSETSONLY : load_mode; mwindow->paste_edls(&new_edls, loadmode, 0, -1, diff --git a/cinelerra-5.1/cinelerra/render.C b/cinelerra-5.1/cinelerra/render.C index 433876bb..5ce03541 100644 --- a/cinelerra-5.1/cinelerra/render.C +++ b/cinelerra-5.1/cinelerra/render.C @@ -970,7 +970,7 @@ if(debug) printf("Render::render %d\n", __LINE__); ArrayList *assets = render->packages->get_asset_list(); if(debug) printf("Render::render %d\n", __LINE__); if(render->load_mode == LOADMODE_PASTE) - mwindow->clear(0, 1); + mwindow->clear(0); if(debug) printf("Render::render %d\n", __LINE__); mwindow->load_assets(assets, -1, render->load_mode, 0, 0, mwindow->edl->session->labels_follow_edits, diff --git a/cinelerra-5.1/cinelerra/resourcethread.C b/cinelerra-5.1/cinelerra/resourcethread.C index 62aee466..2e53c4da 100644 --- a/cinelerra-5.1/cinelerra/resourcethread.C +++ b/cinelerra-5.1/cinelerra/resourcethread.C @@ -164,7 +164,6 @@ ResourceThread::ResourceThread(MWindow *mwindow, MWindowGUI *gui) temp_picon = 0; temp_picon2 = 0; draw_lock = new Condition(0, "ResourceThread::draw_lock", 0); - source_lock = new Condition(1, "ResourceThread::source_lock", 0); item_lock = new Mutex("ResourceThread::item_lock"); audio_buffer = 0; for(int i = 0; i < MAXCHANNELS; i++) @@ -186,7 +185,6 @@ ResourceThread::~ResourceThread() { stop(); delete draw_lock; - delete source_lock; delete item_lock; delete temp_picon; delete temp_picon2; @@ -298,7 +296,6 @@ void ResourceThread::run() { draw_lock->lock("ResourceThread::run"); - source_lock->lock("ResourceThread::run"); while(!interrupted) { // Pull off item @@ -329,7 +326,6 @@ void ResourceThread::run() get_audio_source(0); get_video_source(0); mwindow->age_caches(); - source_lock->unlock(); } } diff --git a/cinelerra-5.1/cinelerra/resourcethread.h b/cinelerra-5.1/cinelerra/resourcethread.h index 34cb6c07..0d165ff5 100644 --- a/cinelerra-5.1/cinelerra/resourcethread.h +++ b/cinelerra-5.1/cinelerra/resourcethread.h @@ -159,7 +159,6 @@ public: MWindow *mwindow; MWindowGUI *gui; Condition *draw_lock; - Condition *source_lock; Mutex *item_lock; ArrayList items; int interrupted; diff --git a/cinelerra-5.1/cinelerra/track.C b/cinelerra-5.1/cinelerra/track.C index 1a11c434..bfd53eca 100644 --- a/cinelerra-5.1/cinelerra/track.C +++ b/cinelerra-5.1/cinelerra/track.C @@ -1155,7 +1155,7 @@ int Track::copy_assets(double start, int Track::blade(double position) { - int64_t start = to_units(position, 1); + int64_t start = to_units(position, 0); Edit *edit = edits->split_edit(start); if( !edit ) return 1; edit->hard_left = 1; diff --git a/cinelerra-5.1/cinelerra/trackcanvas.C b/cinelerra-5.1/cinelerra/trackcanvas.C index 00ca2b63..81537be2 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.C +++ b/cinelerra-5.1/cinelerra/trackcanvas.C @@ -512,6 +512,7 @@ int64_t TrackCanvas::drop_edit_position(int *is_insertion, Edit *moved_edit, int int cursor_x = get_relative_cursor_x(); double zoom_scale = (double)mwindow->edl->session->sample_rate / mwindow->edl->local_session->zoom_sample; double drop_time = (cursor_x + mwindow->edl->local_session->view_start[pane->number]) / zoom_scale; + drop_time = mwindow->edl->align_to_frame(drop_time, 0); // we use cursor position for affinity calculations int64_t cursor_position = track->to_units(drop_time, 0); if( cursor_position <= 0 ) { @@ -520,7 +521,7 @@ int64_t TrackCanvas::drop_edit_position(int *is_insertion, Edit *moved_edit, int } if( moved_edit ) // relative cursor position depends upon drop point drop_time -= mwindow->session->drag_position - moved_edit->track->from_units(moved_edit->startproject); - int64_t drop_position = track->to_units(drop_time, 1); + int64_t drop_position = track->to_units(drop_time, 0); if( !moved_edit ) // for clips and assets acts as they were grabbed in the middle drop_position -= moved_edit_length / 2; Edit *last_edit = track->edits->last; @@ -587,6 +588,7 @@ int64_t TrackCanvas::drop_plugin_position(PluginSet *plugin_set, Plugin *moved_p int cursor_x = get_relative_cursor_x(); double zoom_scale = (double)mwindow->edl->session->sample_rate / mwindow->edl->local_session->zoom_sample; double drop_time = (cursor_x + mwindow->edl->local_session->view_start[pane->number]) / zoom_scale; + drop_time = mwindow->edl->align_to_frame(drop_time, 0); // we use cursor position for affinity calculations int64_t cursor_position = track->to_units(drop_time, 0); if( cursor_position <= 0 ) return 0; @@ -2178,7 +2180,7 @@ void TrackCanvas::draw_keyframe_reticle() if( !autos ) continue; for( Auto *auto_keyframe=autos->first; auto_keyframe; auto_keyframe = auto_keyframe->next ) { - draw_hairline(auto_keyframe, GREEN); + draw_hairline(auto_keyframe, BLUE); } } @@ -4418,15 +4420,21 @@ int TrackCanvas::do_edit_handles(int cursor_x, int cursor_y, int button_press, if( left_edit ) { int64_t left_edge = left_edit->startproject; double left_position = track->from_units(left_edge); - if( EQUIV(edge_position, left_position) ) + if( EQUIV(edge_position, left_position) ) { left_edit->hard_left = new_status; + if( left_edit->previous ) + left_edit->previous->hard_right = new_status; + } } Edit *right_edit = track->edits->editof(track_position, PLAY_REVERSE, 0); if( right_edit ) { int64_t right_edge = right_edit->startproject + right_edit->length; double right_position = track->from_units(right_edge); - if( EQUIV(edge_position, right_position) ) + if( EQUIV(edge_position, right_position) ) { right_edit->hard_right = new_status; + if( right_edit->next ) + right_edit->next->hard_left = new_status; + } } } } diff --git a/cinelerra-5.1/cinelerra/vwindow.C b/cinelerra-5.1/cinelerra/vwindow.C index e22dcde0..717972a1 100644 --- a/cinelerra-5.1/cinelerra/vwindow.C +++ b/cinelerra-5.1/cinelerra/vwindow.C @@ -340,12 +340,9 @@ void VWindow::update_position(int change_type, } } -void VWindow::stop_playback() +void VWindow::stop_playback(int wait) { - int locked = gui->get_window_lock(); - if( locked ) gui->unlock_window(); - playback_engine->interrupt_playback(1); - if( locked ) gui->lock_window("VWindow::stop_playback"); + playback_engine->stop_playback(wait); } int VWindow::update_position(double position) diff --git a/cinelerra-5.1/cinelerra/vwindow.h b/cinelerra-5.1/cinelerra/vwindow.h index 9029596e..fb5268be 100644 --- a/cinelerra-5.1/cinelerra/vwindow.h +++ b/cinelerra-5.1/cinelerra/vwindow.h @@ -76,7 +76,7 @@ public: void delete_source(int do_main_edl, int update_gui); void goto_start(); void goto_end(); - void stop_playback(); + void stop_playback(int wait); VTracking *playback_cursor; diff --git a/cinelerra-5.1/cinelerra/zwindow.C b/cinelerra-5.1/cinelerra/zwindow.C index 22c8250b..46e00a91 100644 --- a/cinelerra-5.1/cinelerra/zwindow.C +++ b/cinelerra-5.1/cinelerra/zwindow.C @@ -222,12 +222,9 @@ void ZWindow::change_source(EDL *edl) } } -void ZWindow::stop_playback() +void ZWindow::stop_playback(int wait) { - int locked = zgui->get_window_lock(); - if( locked ) zgui->unlock_window(); - zgui->playback_engine->interrupt_playback(1); - if( locked ) zgui->lock_window("ZWindow::stop_playback"); + zgui->playback_engine->stop_playback(wait); } void ZWindow::issue_command(int command, int wait_tracking, diff --git a/cinelerra-5.1/cinelerra/zwindow.h b/cinelerra-5.1/cinelerra/zwindow.h index 33babfd5..528d576d 100644 --- a/cinelerra-5.1/cinelerra/zwindow.h +++ b/cinelerra-5.1/cinelerra/zwindow.h @@ -70,7 +70,7 @@ public: void handle_done_event(int result); void handle_close_event(int result); void change_source(EDL *edl); - void stop_playback(); + void stop_playback(int wait); void issue_command(int command, int wait_tracking, int use_inout, int update_refresh, int toggle_audio); void update_mixer_ids(); diff --git a/cinelerra-5.1/picon/cinfinity/impulse_1885.png b/cinelerra-5.1/picon/cinfinity/impulse_1885.png new file mode 100644 index 00000000..c7b0c5f6 Binary files /dev/null and b/cinelerra-5.1/picon/cinfinity/impulse_1885.png differ diff --git a/cinelerra-5.1/picon/cinfinity/multivoice_chorus_1201.png b/cinelerra-5.1/picon/cinfinity/multivoice_chorus_1201.png new file mode 100644 index 00000000..baf91fbc Binary files /dev/null and b/cinelerra-5.1/picon/cinfinity/multivoice_chorus_1201.png differ diff --git a/cinelerra-5.1/picon/cinfinity/pitch_scale_1193.png b/cinelerra-5.1/picon/cinfinity/pitch_scale_1193.png new file mode 100644 index 00000000..86b7aefb Binary files /dev/null and b/cinelerra-5.1/picon/cinfinity/pitch_scale_1193.png differ diff --git a/cinelerra-5.1/picon/cinfinity/plate_1423.png b/cinelerra-5.1/picon/cinfinity/plate_1423.png new file mode 100644 index 00000000..708d28f7 Binary files /dev/null and b/cinelerra-5.1/picon/cinfinity/plate_1423.png differ diff --git a/cinelerra-5.1/picon/cinfinity/pointer_cast_1910.png b/cinelerra-5.1/picon/cinfinity/pointer_cast_1910.png new file mode 100644 index 00000000..63f5a0c8 Binary files /dev/null and b/cinelerra-5.1/picon/cinfinity/pointer_cast_1910.png differ diff --git a/cinelerra-5.1/picon/cinfinity/rate_shifter_1417.png b/cinelerra-5.1/picon/cinfinity/rate_shifter_1417.png new file mode 100644 index 00000000..fdc0f611 Binary files /dev/null and b/cinelerra-5.1/picon/cinfinity/rate_shifter_1417.png differ diff --git a/cinelerra-5.1/picon/cinfinity/retro_flange_1208.png b/cinelerra-5.1/picon/cinfinity/retro_flange_1208.png new file mode 100644 index 00000000..418cfeb2 Binary files /dev/null and b/cinelerra-5.1/picon/cinfinity/retro_flange_1208.png differ diff --git a/cinelerra-5.1/picon/cinfinity/revdelay_1605.png b/cinelerra-5.1/picon/cinfinity/revdelay_1605.png new file mode 100644 index 00000000..a3e433b5 Binary files /dev/null and b/cinelerra-5.1/picon/cinfinity/revdelay_1605.png differ diff --git a/cinelerra-5.1/picon/cinfinity/ringmod_1188.png b/cinelerra-5.1/picon/cinfinity/ringmod_1188.png new file mode 100644 index 00000000..f5d58edf Binary files /dev/null and b/cinelerra-5.1/picon/cinfinity/ringmod_1188.png differ diff --git a/cinelerra-5.1/picon/cinfinity/sc1_1425.png b/cinelerra-5.1/picon/cinfinity/sc1_1425.png new file mode 100644 index 00000000..a38c69f5 Binary files /dev/null and b/cinelerra-5.1/picon/cinfinity/sc1_1425.png differ diff --git a/cinelerra-5.1/picon/cinfinity/sc2_1426.png b/cinelerra-5.1/picon/cinfinity/sc2_1426.png new file mode 100644 index 00000000..9ffa90e1 Binary files /dev/null and b/cinelerra-5.1/picon/cinfinity/sc2_1426.png differ diff --git a/cinelerra-5.1/picon/cinfinity/sc3_1427.png b/cinelerra-5.1/picon/cinfinity/sc3_1427.png new file mode 100644 index 00000000..4f31af97 Binary files /dev/null and b/cinelerra-5.1/picon/cinfinity/sc3_1427.png differ