r370: Heroine Virutal's official release 1.2.1
[cinelerra_cv/mob.git] / hvirtual / cinelerra / panauto.C
blob443157782e36f45ba9c32069e61818026be67ec8
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         position = file->tag.get_property("POSITION", (int64_t)0);
42         handle_x = file->tag.get_property("HANDLE_X", (int64_t)handle_x);
43         handle_y = file->tag.get_property("HANDLE_Y", (int64_t)handle_y);
44         for(int i = 0; i < edl->session->audio_channels; i++)
45         {
46                 char string[BCTEXTLEN];
47                 sprintf(string, "VALUE%d", i);
48                 values[i] = file->tag.get_property(string, values[i]);
49         }
52 void PanAuto::copy(int64_t start, int64_t end, FileXML *file, int default_auto)
54         file->tag.set_title("AUTO");
55         if(default_auto)
56                 file->tag.set_property("POSITION", 0);
57         else
58                 file->tag.set_property("POSITION", position - start);
59         file->tag.set_property("HANDLE_X", (int64_t)handle_x);
60         file->tag.set_property("HANDLE_Y", (int64_t)handle_y);
61         for(int i = 0; i < edl->session->audio_channels; i++)
62         {
63                 char  string[BCTEXTLEN];
64                 sprintf(string, "VALUE%d", i);
65                 file->tag.set_property(string, values[i]);
66         }
67         file->append_tag();
71 void PanAuto::copy_from(Auto *that)
73         Auto::copy_from(that);
75         PanAuto *pan_auto = (PanAuto*)that;
76         memcpy(this->values, pan_auto->values, MAXCHANNELS * sizeof(float));
77         this->handle_x = pan_auto->handle_x;
78         this->handle_y = pan_auto->handle_y;
81 void PanAuto::dump()
83         printf("                handle_x %d\n", handle_x);
84         printf("                handle_y %d\n", handle_y);
85         for(int i = 0; i < edl->session->audio_channels; i++)
86                 printf("                value %d %f\n", i, values[i]);