Fixed initialisation of tf in file_open(). Without setting the memory to 0,
[cinelerra_cv/mob.git] / plugins / crossfade / crossfade.C
blobf64832587ed90a1fdff649a80a011caab1f5d81c
1 #include "crossfade.h"
2 #include "edl.inc"
3 #include "language.h"
4 #include "overlayframe.h"
5 #include "picon_png.h"
6 #include "vframe.h"
11 REGISTER_PLUGIN(CrossfadeMain)
16 CrossfadeMain::CrossfadeMain(PluginServer *server)
17  : PluginAClient(server)
21 CrossfadeMain::~CrossfadeMain()
25 char* CrossfadeMain::plugin_title() { return N_("Crossfade"); }
26 int CrossfadeMain::is_transition() { return 1; }
27 int CrossfadeMain::uses_gui() { return 0; }
29 NEW_PICON_MACRO(CrossfadeMain)
32 int CrossfadeMain::process_realtime(int64_t size, 
33         double *outgoing, 
34         double *incoming)
36         double intercept = (double)PluginClient::get_source_position() / 
37                 PluginClient::get_total_len();
38         double slope = (double)1 / PluginClient::get_total_len();
40 //printf("CrossfadeMain::process_realtime %f %f\n", intercept, slope);
41         for(int i = 0; i < size; i++)
42         {
43                 incoming[i] = outgoing[i] * ((double)1 - (slope * i + intercept)) + 
44                         incoming[i] * (slope * i + intercept);
45         }
47         return 0;