4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "apatchgui.inc"
25 #include "edlsession.h"
29 PanAuto::PanAuto(EDL *edl, PanAutos *autos)
30 : Auto(edl, (Autos*)autos)
32 bzero(values, MAXCHANNELS * sizeof(float));
33 handle_x = handle_y = 0;
40 int PanAuto::operator==(Auto &that)
42 PanAuto *panauto = (PanAuto*)&that;
44 return handle_x == panauto->handle_x &&
45 handle_y == panauto->handle_y;
48 void PanAuto::rechannel()
50 BC_Pan::stick_to_values(values,
51 edl->session->audio_channels,
52 edl->session->achannel_positions,
59 void PanAuto::load(FileXML *file)
61 bzero(values, MAXCHANNELS * sizeof(float));
62 handle_x = file->tag.get_property("HANDLE_X", (int64_t)handle_x);
63 handle_y = file->tag.get_property("HANDLE_Y", (int64_t)handle_y);
64 for(int i = 0; i < edl->session->audio_channels; i++)
66 char string[BCTEXTLEN];
67 sprintf(string, "VALUE%d", i);
68 values[i] = file->tag.get_property(string, values[i]);
72 void PanAuto::copy(int64_t start, int64_t end, FileXML *file, int default_auto)
74 file->tag.set_title("AUTO");
76 file->tag.set_property("POSITION", 0);
78 file->tag.set_property("POSITION", position - start);
79 file->tag.set_property("HANDLE_X", (int64_t)handle_x);
80 file->tag.set_property("HANDLE_Y", (int64_t)handle_y);
81 for(int i = 0; i < edl->session->audio_channels; i++)
83 char string[BCTEXTLEN];
84 sprintf(string, "VALUE%d", i);
85 file->tag.set_property(string, values[i]);
88 file->tag.set_title("/AUTO");
93 void PanAuto::copy_from(Auto *that)
95 Auto::copy_from(that);
97 PanAuto *pan_auto = (PanAuto*)that;
98 memcpy(this->values, pan_auto->values, MAXCHANNELS * sizeof(float));
99 this->handle_x = pan_auto->handle_x;
100 this->handle_y = pan_auto->handle_y;
105 printf(" handle_x %d\n", handle_x);
106 printf(" handle_y %d\n", handle_y);
107 for(int i = 0; i < edl->session->audio_channels; i++)
108 printf(" value %d %f\n", i, values[i]);