r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / plugins / crossfade / crossfade.C
blobbcfc4fa6c4fd051e73eb5789db196e4df80510f1
1 #include "crossfade.h"
2 #include "edl.inc"
3 #include "overlayframe.h"
4 #include "picon_png.h"
5 #include "vframe.h"
7 #include <libintl.h>
8 #define _(String) gettext(String)
9 #define gettext_noop(String) String
10 #define N_(String) gettext_noop (String)
14 REGISTER_PLUGIN(CrossfadeMain)
19 CrossfadeMain::CrossfadeMain(PluginServer *server)
20  : PluginAClient(server)
24 CrossfadeMain::~CrossfadeMain()
28 char* CrossfadeMain::plugin_title() { return _("Crossfade"); }
29 int CrossfadeMain::is_transition() { return 1; }
30 int CrossfadeMain::uses_gui() { return 0; }
32 NEW_PICON_MACRO(CrossfadeMain)
35 int CrossfadeMain::process_realtime(int64_t size, 
36         double *outgoing, 
37         double *incoming)
39         double intercept = (double)PluginClient::get_source_position() / 
40                 PluginClient::get_total_len();
41         double slope = (double)1 / PluginClient::get_total_len();
43         for(int i = 0; i < size; i++)
44         {
45                 incoming[i] = outgoing[i] * ((double)1 - (slope * i + intercept)) + 
46                         incoming[i] * (slope * i + intercept);
47         }
49         return 0;