license header for review
[cinelerra_cv/ct.git] / cinelerra / panauto.C
blob55e3c30481c8d06a6863a429b463759111b48b6b
1 #include "apatchgui.inc"
2 #include "bcpan.h"
3 #include "edl.h"
4 #include "edlsession.h"
5 #include "filexml.h"
6 #include "panauto.h"
8 PanAuto::PanAuto(EDL *edl, PanAutos *autos)
9  : Auto(edl, (Autos*)autos)
11         bzero(values, MAXCHANNELS * sizeof(float));
12         handle_x = handle_y = 0;
15 PanAuto::~PanAuto()
19 int PanAuto::operator==(Auto &that)
21         PanAuto *panauto = (PanAuto*)&that;
23         return handle_x == panauto->handle_x &&
24                 handle_y == panauto->handle_y;
27 void PanAuto::rechannel()
29         BC_Pan::stick_to_values(values,
30                 edl->session->audio_channels, 
31                 edl->session->achannel_positions, 
32                 handle_x, 
33                 handle_y,
34                 PAN_RADIUS,
35                 1);
38 void PanAuto::load(FileXML *file)
40         bzero(values, MAXCHANNELS * sizeof(float));
41         handle_x = file->tag.get_property("HANDLE_X", (int64_t)handle_x);
42         handle_y = file->tag.get_property("HANDLE_Y", (int64_t)handle_y);
43         for(int i = 0; i < edl->session->audio_channels; i++)
44         {
45                 char string[BCTEXTLEN];
46                 sprintf(string, "VALUE%d", i);
47                 values[i] = file->tag.get_property(string, values[i]);
48         }
51 void PanAuto::copy(int64_t start, int64_t end, FileXML *file, int default_auto)
53         file->tag.set_title("AUTO");
54         if(default_auto)
55                 file->tag.set_property("POSITION", 0);
56         else
57                 file->tag.set_property("POSITION", position - start);
58         file->tag.set_property("HANDLE_X", (int64_t)handle_x);
59         file->tag.set_property("HANDLE_Y", (int64_t)handle_y);
60         for(int i = 0; i < edl->session->audio_channels; i++)
61         {
62                 char  string[BCTEXTLEN];
63                 sprintf(string, "VALUE%d", i);
64                 file->tag.set_property(string, values[i]);
65         }
66         file->append_tag();
67         file->tag.set_title("/AUTO");
68         file->append_tag();
72 void PanAuto::copy_from(Auto *that)
74         Auto::copy_from(that);
76         PanAuto *pan_auto = (PanAuto*)that;
77         memcpy(this->values, pan_auto->values, MAXCHANNELS * sizeof(float));
78         this->handle_x = pan_auto->handle_x;
79         this->handle_y = pan_auto->handle_y;
82 void PanAuto::dump()
84         printf("                handle_x %d\n", handle_x);
85         printf("                handle_y %d\n", handle_y);
86         for(int i = 0; i < edl->session->audio_channels; i++)
87                 printf("                value %d %f\n", i, values[i]);
92 //      Local Variables:
93 //      mode: C++
94 //      c-file-style: "linux"
95 //      End: