Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / intauto.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * Copyright (C) 2003-2016 Cinelerra CV contributors
6  *
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.
11  *
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.
16  *
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
20  *
21  */
22
23 #include "edl.h"
24 #include "edlsession.h"
25 #include "filexml.h"
26 #include "intauto.h"
27 #include "intautos.h"
28
29 IntAuto::IntAuto(EDL *edl, IntAutos *autos)
30  : Auto(edl, (Autos*)autos)
31 {
32         value = 0;
33 }
34
35 IntAuto::~IntAuto()
36 {
37 }
38
39 int IntAuto::operator==(Auto &that)
40 {
41         return identical((IntAuto*)&that);
42 }
43
44 int IntAuto::operator==(IntAuto &that)
45 {
46         return identical((IntAuto*)&that);
47 }
48
49 int IntAuto::identical(IntAuto *that)
50 {
51         return that->value == value;
52 }
53
54 void IntAuto::load(FileXML *file)
55 {
56         value = file->tag.get_property("VALUE", value);
57 //printf("IntAuto::load 1 %d\n", value);
58 }
59
60 void IntAuto::copy(int64_t start, int64_t end, FileXML *file, int default_auto)
61 {
62         file->tag.set_title("AUTO");
63         if(default_auto)
64                 file->tag.set_property("POSITION", 0);
65         else
66                 file->tag.set_property("POSITION", position - start);
67         file->tag.set_property("VALUE", value);
68         file->append_tag();
69         file->tag.set_title("/AUTO");
70         file->append_tag();
71         file->append_newline();
72 }
73
74
75 void IntAuto::copy_from(Auto *that)
76 {
77         copy_from((IntAuto*)that);
78 //printf("IntAuto::copy_from(Auto *that) %d\n", value);
79 }
80
81 void IntAuto::copy_from(IntAuto *that)
82 {
83 //printf("IntAuto::copy_from(IntAuto *that) %d %d\n", value, that->value);
84         Auto::copy_from(that);
85         this->value = that->value;
86 }
87
88 int IntAuto::percentage_to_value(float percentage)
89 {
90         return percentage > .5;
91 }
92
93