transition at beginning/end, shape xtion fixes
authorGood Guy <good1.2guy@gmail.com>
Sun, 24 Apr 2016 21:43:40 +0000 (15:43 -0600)
committerGood Guy <good1.2guy@gmail.com>
Sun, 24 Apr 2016 21:43:40 +0000 (15:43 -0600)
12 files changed:
cinelerra-5.1/cinelerra/apluginarray.C
cinelerra-5.1/cinelerra/edit.C
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/track.C
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/cinelerra/tracksedit.C
cinelerra-5.1/cinelerra/vpluginarray.C
cinelerra-5.1/plugins/shapes/circle.png
cinelerra-5.1/plugins/shapes/clock.png
cinelerra-5.1/plugins/shapes/heart.png
cinelerra-5.1/plugins/shapes/tile2x2h.png
cinelerra-5.1/plugins/shapes/tile2x2v.png

index b265d12cbb1a289f5d6607d9d1b9b7e62250341e..a2be55142a2494ec7cbbd20ac867a089f89303e0 100644 (file)
@@ -19,6 +19,7 @@
  * 
  */
 
+#include "asset.h"
 #include "amodule.h"
 #include "apluginarray.h"
 #include "atrack.h"
@@ -81,7 +82,8 @@ void APluginArray::create_modules()
 
 void APluginArray::process_realtime(int module, int64_t input_position, int64_t len)
 {
-       values[module]->process_buffer(realtime_buffers + module,
+       int ibfr = module % file->asset->channels;
+       values[module]->process_buffer(realtime_buffers + ibfr,
                        input_position, 
                        len,
                        edl->session->sample_rate,
@@ -92,7 +94,8 @@ void APluginArray::process_realtime(int module, int64_t input_position, int64_t
 int APluginArray::process_loop(int module, int64_t &write_length)
 {
        if(!realtime_buffers) realtime_buffers = file->get_audio_buffer();
-       int result = values[module]->process_loop(&realtime_buffers[module], 
+       int ibfr = module % file->asset->channels;
+       int result = values[module]->process_loop(&realtime_buffers[ibfr], 
                write_length);
        return result;
 }
index 0ede9b9ef2a34acfc7dc22f38bcb52771b469055..0792fa443c5a3c179b1306c6f696c2f7e736b9eb 100644 (file)
@@ -213,10 +213,8 @@ int64_t Edit::get_source_end(int64_t default_)
 void Edit::insert_transition(char *title)
 {
 //printf("Edit::insert_transition this=%p title=%p title=%s\n", this, title, title);
-       detach_transition();
-       transition = new Transition(edl,
-               this,
-               title,
+       delete transition;
+       transition = new Transition(edl, this, title,
                track->to_units(edl->session->default_transition_length, 1));
 }
 
@@ -228,10 +226,7 @@ void Edit::detach_transition()
 
 int Edit::silence()
 {
-       if(asset || nested_edl)
-               return 0;
-       else
-               return 1;
+       return asset || nested_edl ? 0 : 1;
 }
 
 
index 98736302e6e28a3188dc0f21bbb40fb560fff6be..890aaac6b46261ef70b4ced6b4905490c5e7b653 100644 (file)
@@ -2871,11 +2871,9 @@ void MWindow::rebuild_indices()
 void MWindow::save_backup()
 {
        FileXML file;
+       edl->optimize();
        edl->set_path(session->filename);
-       edl->save_xml(&file,
-               BACKUP_PATH,
-               0,
-               0);
+       edl->save_xml(&file, BACKUP_PATH, 0, 0);
        file.terminate_string();
        char path[BCTEXTLEN];
        FileSystem fs;
index ec243b282cc0d01e93d1e5401172083f0e3e9e2e..10460c0cff35d959a5bfff45a763faf8d45cacd5 100644 (file)
@@ -245,7 +245,8 @@ double Track::get_length()
        for(int i = 0; i < plugin_set.total; i++)
        {
                if( !plugin_set.values[i]->last ) continue;
-               length = from_units(plugin_set.values[i]->last->startproject);
+               length = from_units(plugin_set.values[i]->last->startproject +
+                       plugin_set.values[i]->last->length);
                if(length > total_length) total_length = length;
        }
 
index e9511d2ded9d2ce2bd8db076495483394eb0a384..2a64845af735e32a78d69bbac13b4298c386ac5c 100644 (file)
@@ -203,25 +203,24 @@ int TrackCanvas::drag_motion(Track **over_track,
                                {
                                        int64_t edit_x, edit_y, edit_w, edit_h;
                                        edit_dimensions(edit, edit_x, edit_y, edit_w, edit_h);
-
-                                       if( cursor_x >= edit_x && cursor_x < edit_x + edit_w &&
-                                           cursor_y >= edit_y && cursor_y < edit_y + edit_h ) {
+                                       if( cursor_y < edit_y || cursor_y >= edit_y + edit_h ) continue;
+                                       if( cursor_x >= edit_x && cursor_x < edit_x + edit_w ) {
                                                *over_edit = edit;
                                                break;
                                        }
                                        if( edit != track->edits->last ) continue;
-                                       if( edit->silence() ) continue;
                                        if( mwindow->session->current_operation != DRAG_ATRANSITION &&
                                            mwindow->session->current_operation != DRAG_VTRANSITION ) continue;
-                                       if( cursor_x >= edit_x + edit_w &&
-                                           cursor_y >= edit_y && cursor_y < edit_y + edit_h ) {
+                                       if( !edit->silence() ) {
                                                // add silence to allow drag transition past last edit
                                                //  will be deleted by Edits::optimize if not used
                                                double length = mwindow->edl->session->default_transition_length;
                                                int64_t start = edit->startproject+edit->length;
                                                int64_t units = track->to_units(length, 1); 
                                                track->edits->create_silence(start, start+units);
+                                               continue;
                                        }
+                                       if( cursor_x >= edit_x ) { *over_edit = edit; break; }
                                }
 
                                for(int i = 0; i < track->plugin_set.total; i++)
index 77f31e5c0a59d9ce9f621f0c298d543817d5bcac..4f83fff0e949bb8f9ff4a9ef1f9f1ae2ff02c300 100644 (file)
@@ -361,6 +361,10 @@ void Tracks::set_transition_length(double start, double end, double length)
                                {
                                        current_edit->transition->length =
                                                current_track->to_units(length, 1);
+                                       if( current_edit == current_track->edits->last &&
+                                           current_edit->silence() ) {
+                                               current_edit->length = current_edit->transition->length;
+                                       }
                                }
                        }
                }
@@ -383,6 +387,10 @@ void Tracks::set_transition_length(Transition *transition, double length)
                        if(current_edit->transition == transition)
                        {
                                transition->length = current_track->to_units(length, 1);
+                               if( current_edit == current_track->edits->last &&
+                                   current_edit->silence() ) {
+                                       current_edit->length = current_edit->transition->length;
+                               }
                                done = 1;
                        }
                }
@@ -399,22 +407,32 @@ void Tracks::paste_transitions(double start, double end, int track_type, char* t
                {
                        int64_t start_units = current_track->to_units(start, 0);
                        int64_t end_units = current_track->to_units(end, 0);
-
-                       for(Edit *current_edit = current_track->edits->first;
-                               current_edit;
-                               current_edit = current_edit->next)
-                       {
-                               if(current_edit->startproject > 0 &&
-                                       ((end_units > start_units &&
-                                       current_edit->startproject >= start_units &&
-                                       current_edit->startproject < end_units) ||
-                                       (end_units == start_units &&
-                                       current_edit->startproject <= start_units &&
-                                       current_edit->startproject + current_edit->length > start_units)))
-                               {
+                       if( start_units == end_units ) {
+                               for( Edit *current_edit = current_track->edits->first;
+                                    current_edit; current_edit = current_edit->next) {
+                                       int64_t edit_start = current_edit->startproject;
+                                       int64_t edit_end = edit_start + current_edit->length;
+                                       if( edit_start > start_units ) continue;
+                                       if( start_units == current_track->edits->length() ) {
+                                               double length = edl->session->default_transition_length;
+                                               int64_t units = current_track->to_units(length, 1);
+                                               current_edit = current_track->edits->
+                                                       create_silence(start_units, start_units+units);
+                                       }
+                                       else if( start_units >= edit_end ) continue;
                                        current_edit->insert_transition(title);
                                }
                        }
+                       else {
+                               for( Edit *current_edit = current_track->edits->first;
+                                    current_edit; current_edit = current_edit->next) {
+                                       int64_t edit_start = current_edit->startproject;
+                                       if( !edit_start ) continue;
+                                       if( edit_start >= start_units && edit_start < end_units ) {
+                                               current_edit->insert_transition(title);
+                                       }
+                               }
+                       }
                }
        }
 }
@@ -978,6 +996,11 @@ void Tracks::paste_audio_transition(PluginServer *server)
                        Edit *current_edit = current->edits->editof(position,
                                PLAY_FORWARD,
                                0);
+                       if( !current_edit && position == current->edits->length() ) {
+                               double length = edl->session->default_transition_length;
+                               int64_t units = current->to_units(length, 1);
+                               current_edit = current->edits->create_silence(position, position+units);
+                       }
                        if(current_edit)
                        {
                                paste_transition(server, current_edit);
@@ -1127,6 +1150,11 @@ void Tracks::paste_video_transition(PluginServer *server, int first_track)
                        Edit *current_edit = current->edits->editof(position,
                                PLAY_FORWARD,
                                0);
+                       if( !current_edit && position == current->edits->length() ) {
+                               double length = edl->session->default_transition_length;
+                               int64_t units = current->to_units(length, 1);
+                               current_edit = current->edits->create_silence(position, position+units);
+                       }
                        if(current_edit)
                        {
                                paste_transition(server, current_edit);
index bfb57271f95d15761d46d40b9cd35b8a0059776e..b5118ce9a10a2837ec84d09181ed4d9629d2cf75 100644 (file)
@@ -19,6 +19,7 @@
  * 
  */
 
+#include "asset.h"
 #include "bcsignals.h"
 #include "cache.h"
 #include "edl.h"
@@ -97,7 +98,8 @@ void VPluginArray::process_realtime(int module,
        int64_t input_position, 
        int64_t len)
 {
-       values[module]->process_buffer(realtime_buffers[module], 
+       int ibfr = module % file->asset->layers;
+       values[module]->process_buffer(realtime_buffers[ibfr], 
                        input_position, 
                        edl->session->frame_rate,
                        end - start,
@@ -109,15 +111,16 @@ int VPluginArray::process_loop(int module, int64_t &write_length)
        if(!realtime_buffers) realtime_buffers = file->get_video_buffer();
 
 // Convert from array of frames to array of tracks
-       VFrame **temp_buffer;
-       temp_buffer = new VFrame*[total_tracks()];
-       for(int i = 0; i < total_tracks(); i++)
-       {
-               temp_buffer[i] = realtime_buffers[i][0];
-       }
-
-       int result = values[module]->process_loop(realtime_buffers[module], write_length);
-       delete [] temp_buffer;
+//     VFrame **temp_buffer;
+//     temp_buffer = new VFrame*[total_tracks()];
+//     for(int i = 0; i < total_tracks(); i++)
+//     {
+//             temp_buffer[i] = realtime_buffers[i][0];
+//     }
+
+       int ibfr = module % file->asset->layers;
+       int result = values[module]->process_loop(realtime_buffers[ibfr], write_length);
+//     delete [] temp_buffer;
        return result;
 }
 
index 5707e287b381f29e2f1229efb8a8d4951435e17b..610fe6cb7f79e858d2b689a52c1816040608fe13 100644 (file)
Binary files a/cinelerra-5.1/plugins/shapes/circle.png and b/cinelerra-5.1/plugins/shapes/circle.png differ
index 229d009556e4246e42f73a574d1141b7414a887b..0a3f14114d82f684f1bec2381fe93b84011d3432 100644 (file)
Binary files a/cinelerra-5.1/plugins/shapes/clock.png and b/cinelerra-5.1/plugins/shapes/clock.png differ
index d36fe1c80beb1525ac0ef5e8f97a2831d16ea03b..76793239325f8fe5b4f0e9624d0c19c6240297c8 100644 (file)
Binary files a/cinelerra-5.1/plugins/shapes/heart.png and b/cinelerra-5.1/plugins/shapes/heart.png differ
index 2f44841e4a78ace1c6a757bb11bbf0bb07c9f733..b10667170823bb55bb27fb86042ae0880493c2d9 100644 (file)
Binary files a/cinelerra-5.1/plugins/shapes/tile2x2h.png and b/cinelerra-5.1/plugins/shapes/tile2x2h.png differ
index 7b83149b9c98c2e251264107f3cdaad2816b0096..7734f59c3a59eae3ba7566fcfc47a620b38dbc4c 100644 (file)
Binary files a/cinelerra-5.1/plugins/shapes/tile2x2v.png and b/cinelerra-5.1/plugins/shapes/tile2x2v.png differ