6
6
// controller handling for mixer automation
8
8
// (C) Copyright 2003 Werner Schweer (ws@seh.de)
9
// (C) Copyright 2011 Time E. Real (terminator356 on users dot sourceforge dot net)
11
// This program is free software; you can redistribute it and/or
12
// modify it under the terms of the GNU General Public License
13
// as published by the Free Software Foundation; version 2 of
14
// the License, or (at your option) any later version.
16
// This program is distributed in the hope that it will be useful,
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
// GNU General Public License for more details.
21
// You should have received a copy of the GNU General Public License
22
// along with this program; if not, write to the Free Software
23
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
9
25
//=========================================================
82
100
//---------------------------------------------------------
84
double CtrlList::value(int frame)
102
double CtrlList::value(int frame) const
86
if (!automation || empty()) {
104
// Changed by Tim. p4.0.32...
106
///if (!automation || empty())
90
112
ciCtrl i = upper_bound(frame); // get the index after current frame
92
114
if (i == end()) { // if we are past all items just return the last value
95
const CtrlVal& val = i->second;
117
///const CtrlVal& val = i->second;
118
///_curVal = val.val;
98
121
else if(_mode == DISCRETE)
125
///_curVal = _default;
126
//if(i->second.frame == frame)
105
const CtrlVal& val = i->second;
134
///const CtrlVal& val = i->second;
135
///_curVal = val.val;
110
int frame2 = i->second.frame;
111
double val2 = i->second.val;
140
///int frame2 = i->second.frame;
141
///double val2 = i->second.val;
114
144
if (i == begin()) {
150
int frame2 = i->second.frame;
151
double val2 = i->second.val;
120
frame1 = i->second.frame;
121
val1 = i->second.val;
123
//printf("before val1=%f val2=%f\n", val1,val2);
124
if (_valueType == VAL_LOG) {
125
val1 = 20.0*fast_log10(val1);
126
if (val1 < config.minSlider)
127
val1=config.minSlider;
128
val2 = 20.0*fast_log10(val2);
129
if (val2 < config.minSlider)
130
val2=config.minSlider;
132
//printf("after val1=%f val2=%f\n", val1,val2);
136
val1 += (double(frame) * val2)/double(frame2);
138
if (_valueType == VAL_LOG) {
139
val1 = exp10(val1/20.0);
141
//printf("after val1=%f\n", val1);
153
///frame1 = i->second.frame;
154
///val1 = i->second.val;
155
int frame1 = i->second.frame;
156
double val1 = i->second.val;
158
//printf("before val1=%f val2=%f\n", val1,val2);
159
if (_valueType == VAL_LOG) {
160
val1 = 20.0*fast_log10(val1);
161
if (val1 < MusEGlobal::config.minSlider)
162
val1=MusEGlobal::config.minSlider;
163
val2 = 20.0*fast_log10(val2);
164
if (val2 < MusEGlobal::config.minSlider)
165
val2=MusEGlobal::config.minSlider;
167
//printf("after val1=%f val2=%f\n", val1,val2);
171
val1 += (double(frame) * val2)/double(frame2);
173
if (_valueType == VAL_LOG) {
174
val1 = exp10(val1/20.0);
176
//printf("after val1=%f\n", val1);
144
181
// printf("autoVal %d %f\n", frame, _curVal);
186
//---------------------------------------------------------
188
// returns the value at the current audio position
189
//---------------------------------------------------------
190
double CtrlList::curVal() const
192
//double v = value(Pos(audio->tickPos()).frame()); // p4.0.33
193
//double v = value(audio->pos().frame()); // Try this.
149
198
//---------------------------------------------------------