4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5 * Copyright (C) 2003-2016 Cinelerra CV contributors
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "apatchgui.inc"
26 #include "edlsession.h"
30 PanAuto::PanAuto(EDL *edl, PanAutos *autos)
31 : Auto(edl, (Autos*)autos)
33 bzero(values, MAXCHANNELS * sizeof(float));
34 handle_x = handle_y = 0;
41 int PanAuto::operator==(Auto &that)
43 PanAuto *panauto = (PanAuto*)&that;
45 return handle_x == panauto->handle_x &&
46 handle_y == panauto->handle_y;
49 void PanAuto::rechannel()
51 BC_Pan::stick_to_values(values,
52 edl->session->audio_channels,
53 edl->session->achannel_positions,
60 void PanAuto::load(FileXML *file)
62 bzero(values, MAXCHANNELS * sizeof(float));
63 handle_x = file->tag.get_property("HANDLE_X", (int64_t)handle_x);
64 handle_y = file->tag.get_property("HANDLE_Y", (int64_t)handle_y);
65 for(int i = 0; i < edl->session->audio_channels; i++)
67 char string[BCTEXTLEN];
68 sprintf(string, "VALUE%d", i);
69 values[i] = file->tag.get_property(string, values[i]);
73 void PanAuto::copy(int64_t start, int64_t end, FileXML *file, int default_auto)
75 file->tag.set_title("AUTO");
77 file->tag.set_property("POSITION", 0);
79 file->tag.set_property("POSITION", position - start);
80 file->tag.set_property("HANDLE_X", (int64_t)handle_x);
81 file->tag.set_property("HANDLE_Y", (int64_t)handle_y);
82 for(int i = 0; i < edl->session->audio_channels; i++)
84 char string[BCTEXTLEN];
85 sprintf(string, "VALUE%d", i);
86 file->tag.set_property(string, values[i]);
89 file->tag.set_title("/AUTO");
94 void PanAuto::copy_from(Auto *that)
96 Auto::copy_from(that);
98 PanAuto *pan_auto = (PanAuto*)that;
99 memcpy(this->values, pan_auto->values, MAXCHANNELS * sizeof(float));
100 this->handle_x = pan_auto->handle_x;
101 this->handle_y = pan_auto->handle_y;
106 printf(" handle_x %d\n", handle_x);
107 printf(" handle_y %d\n", handle_y);
108 for(int i = 0; i < edl->session->audio_channels; i++)
109 printf(" value %d %f\n", i, values[i]);