Ardour  9.0-pre0-582-g084a23a80d
ParameterDescriptor.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 David Robillard <d@drobilla.net>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef EVORAL_PARAMETER_DESCRIPTOR_HPP
20 #define EVORAL_PARAMETER_DESCRIPTOR_HPP
21 
22 namespace Evoral {
23 
26 {
28  : normal(0.0)
29  , lower(0.0)
30  , upper(1.0)
31  , toggled(false)
32  , logarithmic(false)
33  , rangesteps (0)
34  {}
35 
36  virtual ~ParameterDescriptor () {}
37  virtual float to_interface (float val, bool rotary = false) const {
38  return (val - lower) / (upper - lower);
39  }
40 
41  float normal;
42  float lower;
43  float upper;
44  bool toggled;
45  bool logarithmic;
46  unsigned int rangesteps;
47 };
48 
49 } // namespace Evoral
50 
51 #endif // EVORAL_PARAMETER_DESCRIPTOR_HPP
Definition: editor.h:86
bool logarithmic
True for log-scale parameters.
float upper
Maximum value (in Hz, for frequencies)
float lower
Minimum value (in Hz, for frequencies)
bool toggled
True iff parameter is boolean.
virtual float to_interface(float val, bool rotary=false) const
unsigned int rangesteps
number of steps, [min,max] (inclusive). <= 1 means continuous. == 2 only min, max....