1 /* === S Y N F I G ========================================================= */
2 /*! \file valuenode_sine.cpp
3 ** \brief Template File
5 ** $Id: valuenode_sine.cpp,v 1.1.1.1 2005/01/04 01:23:15 darco Exp $
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 /* ========================================================================= */
23 /* === H E A D E R S ======================================================= */
32 #include "valuenode_sine.h"
33 #include "valuenode_const.h"
38 /* === U S I N G =========================================================== */
42 using namespace synfig;
44 /* === M A C R O S ========================================================= */
46 /* === G L O B A L S ======================================================= */
48 /* === P R O C E D U R E S ================================================= */
50 /* === M E T H O D S ======================================================= */
52 ValueNode_Sine::ValueNode_Sine(const ValueBase::Type &x):
57 case ValueBase::TYPE_REAL:
58 set_link("angle",ValueNode_Const::create(Angle::zero()));
59 set_link("amp",ValueNode_Const::create(Real(1)));
62 throw Exception::BadType(ValueBase::type_name(x));
69 ValueNode_Sine::create(const ValueBase &x)
71 return new ValueNode_Sine(x.get_type());
74 ValueNode_Sine::~ValueNode_Sine()
80 ValueNode_Sine::operator()(Time t)const
84 (*angle_)(t).get(Angle())
85 ).get() * (*amp_)(t).get(Real())
91 ValueNode_Sine::get_name()const
97 ValueNode_Sine::get_local_name()const
103 ValueNode_Sine::check_type(ValueBase::Type type)
105 return type==ValueBase::TYPE_REAL;
109 ValueNode_Sine::set_link_vfunc(int i,ValueNode::Handle x)
111 assert(i==0 || i==1);
115 signal_child_changed()(i);signal_value_changed()();
121 signal_child_changed()(i);signal_value_changed()();
127 ValueNode::LooseHandle
128 ValueNode_Sine::get_link_vfunc(int i)const
130 assert(i==0 || i==1);
140 ValueNode_Sine::link_count()const
146 ValueNode_Sine::link_name(int i)const
148 assert(i==0 || i==1);
157 ValueNode_Sine::link_local_name(int i)const
159 assert(i==0 || i==1);
163 return _("Amplitude");
168 ValueNode_Sine::get_link_index_from_name(const String &name)const
175 throw Exception::BadLinkName(name);
179 ValueNode_Sine::create_new()const
181 return new ValueNode_Sine(get_type());