detect missing transitions, dont draw transitions if show off, obey audio transition...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / amodule.C
index 9e2c59b6840a0ea98559c95813ec9818ff78fc16..d8fb4396437ecea793686c20b5d55539880bdfd6 100644 (file)
@@ -37,6 +37,7 @@
 #include "filexml.h"
 #include "floatautos.h"
 #include "language.h"
 #include "filexml.h"
 #include "floatautos.h"
 #include "language.h"
+#include "mainerror.h"
 #include "module.h"
 #include "patch.h"
 #include "plugin.h"
 #include "module.h"
 #include "patch.h"
 #include "plugin.h"
@@ -49,6 +50,7 @@
 #include "theme.h"
 #include "transition.h"
 #include "transportque.h"
 #include "theme.h"
 #include "transition.h"
 #include "transportque.h"
+#include "tracks.h"
 #include <string.h>
 
 
 #include <string.h>
 
 
@@ -280,13 +282,12 @@ int AModule::import_samples(AEdit *edit,
                edit_sample_rate = nested_edl->session->sample_rate;
                int command = direction == PLAY_REVERSE ?
                        NORMAL_REWIND : NORMAL_FWD;
                edit_sample_rate = nested_edl->session->sample_rate;
                int command = direction == PLAY_REVERSE ?
                        NORMAL_REWIND : NORMAL_FWD;
-               if( !nested_command ) {
+               if( !nested_command )
                        nested_command = new TransportCommand;
                        nested_command = new TransportCommand;
-                       nested_command->command = command;
-                       nested_command->get_edl()->copy_all(nested_edl);
-                       nested_command->change_type = CHANGE_ALL;
-                       nested_command->realtime = renderengine->command->realtime;
-               }
+               nested_command->command = command;
+               nested_command->get_edl()->copy_all(nested_edl);
+               nested_command->change_type = CHANGE_ALL;
+               nested_command->realtime = renderengine->command->realtime;
                if( !nested_renderengine ) {
                        nested_renderengine = new RenderEngine(0, get_preferences(), 0, 1);
                        nested_renderengine->set_acache(get_cache());
                if( !nested_renderengine ) {
                        nested_renderengine = new RenderEngine(0, get_preferences(), 0, 1);
                        nested_renderengine->set_acache(get_cache());
@@ -295,6 +296,8 @@ int AModule::import_samples(AEdit *edit,
                nested_renderengine->command->command = command;
                result = 0;
        }
                nested_renderengine->command->command = command;
                result = 0;
        }
+       if( edit_sample_rate <= 0 )
+               result = 1;
 
        if( !result ) {
 // speed_buffer is (have_speed ? speed_temp : buffer)
 
        if( !result ) {
 // speed_buffer is (have_speed ? speed_temp : buffer)
@@ -499,13 +502,9 @@ if(debug) printf("AModule::render %d %jd\n", __LINE__, fragment_len);
 
 // Clamp to end of transition
                        int64_t transition_len = 0;
 
 // Clamp to end of transition
                        int64_t transition_len = 0;
-
-                       if(transition &&
-                               previous_edit)
-                       {
-                               transition_len = transition->length *
-                                       sample_rate /
-                                       edl_rate;
+                       Plugin *transition = get_edl()->tracks->plugin_exists(transition_id);
+                       if( transition && transition->on && previous_edit ) {
+                               transition_len = transition->length * sample_rate / edl_rate;
                                if(direction == PLAY_FORWARD &&
                                        start_position < edit_startproject + transition_len &&
                                        start_position + fragment_len > edit_startproject + transition_len)
                                if(direction == PLAY_FORWARD &&
                                        start_position < edit_startproject + transition_len &&
                                        start_position + fragment_len > edit_startproject + transition_len)
@@ -536,7 +535,7 @@ if(debug) printf("AModule::render %d\n", __LINE__);
 
 
 // Read transition into temp and render
 
 
 // Read transition into temp and render
-                       if(transition && previous_edit)
+                       if(transition && transition->on && previous_edit)
                        {
                                int64_t previous_startproject = previous_edit->startproject *
                                        sample_rate /
                        {
                                int64_t previous_startproject = previous_edit->startproject *
                                        sample_rate /
@@ -594,13 +593,13 @@ if(debug) printf("AModule::render %d %jd\n", __LINE__, fragment_len);
                                        {
                                                current_position = start_position - edit_startproject;
                                        }
                                        {
                                                current_position = start_position - edit_startproject;
                                        }
-
-                                       transition_server->process_transition(
-                                               transition_temp,
-                                               &output,
-                                               current_position,
-                                               transition_fragment_len,
-                                               transition->length);
+                                       if( transition_server ) {
+                                               transition_server->process_transition(
+                                                       transition_temp, &output, current_position,
+                                                       transition_fragment_len, transition->length);
+                                       }
+                                       else
+                                               eprintf("missing transition plugin: %s\n", transition->title);
 
 // Reverse output buffer here so transitions always render forward.
                                        if(direction == PLAY_REVERSE)
 
 // Reverse output buffer here so transitions always render forward.
                                        if(direction == PLAY_REVERSE)