Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

panauto.C

Go to the documentation of this file.
00001 #include "apatchgui.inc"
00002 #include "bcpan.h"
00003 #include "edl.h"
00004 #include "edlsession.h"
00005 #include "filexml.h"
00006 #include "panauto.h"
00007 
00008 PanAuto::PanAuto(EDL *edl, PanAutos *autos)
00009  : Auto(edl, (Autos*)autos)
00010 {
00011         bzero(values, MAXCHANNELS * sizeof(float));
00012         handle_x = handle_y = 0;
00013 }
00014 
00015 PanAuto::~PanAuto()
00016 {
00017 }
00018 
00019 int PanAuto::operator==(Auto &that)
00020 {
00021         PanAuto *panauto = (PanAuto*)&that;
00022 
00023         return handle_x == panauto->handle_x &&
00024                 handle_y == panauto->handle_y;
00025 }
00026 
00027 void PanAuto::rechannel()
00028 {
00029         BC_Pan::stick_to_values(values,
00030                 edl->session->audio_channels, 
00031                 edl->session->achannel_positions, 
00032                 handle_x, 
00033                 handle_y,
00034                 PAN_RADIUS,
00035                 1);
00036 }
00037 
00038 void PanAuto::load(FileXML *file)
00039 {
00040         bzero(values, MAXCHANNELS * sizeof(float));
00041         handle_x = file->tag.get_property("HANDLE_X", (int64_t)handle_x);
00042         handle_y = file->tag.get_property("HANDLE_Y", (int64_t)handle_y);
00043         for(int i = 0; i < edl->session->audio_channels; i++)
00044         {
00045                 char string[BCTEXTLEN];
00046                 sprintf(string, "VALUE%d", i);
00047                 values[i] = file->tag.get_property(string, values[i]);
00048         }
00049 }
00050 
00051 void PanAuto::copy(int64_t start, int64_t end, FileXML *file, int default_auto)
00052 {
00053         file->tag.set_title("AUTO");
00054         if(default_auto)
00055                 file->tag.set_property("POSITION", 0);
00056         else
00057                 file->tag.set_property("POSITION", position - start);
00058         file->tag.set_property("HANDLE_X", (int64_t)handle_x);
00059         file->tag.set_property("HANDLE_Y", (int64_t)handle_y);
00060         for(int i = 0; i < edl->session->audio_channels; i++)
00061         {
00062                 char  string[BCTEXTLEN];
00063                 sprintf(string, "VALUE%d", i);
00064                 file->tag.set_property(string, values[i]);
00065         }
00066         file->append_tag();
00067         file->tag.set_title("/AUTO");
00068         file->append_tag();
00069 }
00070 
00071 
00072 void PanAuto::copy_from(Auto *that)
00073 {
00074         Auto::copy_from(that);
00075 
00076         PanAuto *pan_auto = (PanAuto*)that;
00077         memcpy(this->values, pan_auto->values, MAXCHANNELS * sizeof(float));
00078         this->handle_x = pan_auto->handle_x;
00079         this->handle_y = pan_auto->handle_y;
00080 }
00081 
00082 void PanAuto::dump()
00083 {
00084         printf("                handle_x %d\n", handle_x);
00085         printf("                handle_y %d\n", handle_y);
00086         for(int i = 0; i < edl->session->audio_channels; i++)
00087                 printf("                value %d %f\n", i, values[i]);
00088 }
00089 
00090 

Generated on Sun Jan 8 13:38:58 2006 for Cinelerra-svn by  doxygen 1.4.4