1
// ------------------------------------------------------------------------
2
// linear-envelope.cpp: Linear envelope
3
// Copyright (C) 1999-2002,2005,2008 Kai Vehmanen
6
// eca-style-version: 3 (see Ecasound Programmer's Guide)
8
// This program is fre software; you can redistribute it and/or modify
9
// it under the terms of the GNU General Public License as published by
10
// the Free Software Foundation; either version 2 of the License, or
11
// (at your option) any later version.
13
// This program is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
// GNU General Public License for more details.
18
// You should have received a copy of the GNU General Public License
19
// along with this program; if not, write to the Free Software
20
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
// ------------------------------------------------------------------------
24
#include <kvu_numtostr.h>
25
#include <kvu_message_item.h>
27
#include "linear-envelope.h"
28
#include "eca-logger.h"
30
LINEAR_ENVELOPE::LINEAR_ENVELOPE(void)
34
LINEAR_ENVELOPE::~LINEAR_ENVELOPE(void)
38
CONTROLLER_SOURCE::parameter_t LINEAR_ENVELOPE::value(double pos)
42
/* note: position may go beyond stages_len_rep */
44
if (pos < stages_len_rep) {
45
retval = (pos / stages_len_rep);
53
void LINEAR_ENVELOPE::init(void)
56
otemp << "Linear enveloped initialized; length ";
57
otemp.setprecision(3);
58
otemp << stages_len_rep;
60
ECA_LOG_MSG(ECA_LOGGER::user_objects, otemp.to_string());
63
void LINEAR_ENVELOPE::set_parameter(int param, CONTROLLER_SOURCE::parameter_t value)
67
stages_len_rep = value;
72
CONTROLLER_SOURCE::parameter_t LINEAR_ENVELOPE::get_parameter(int param) const
76
return stages_len_rep;