]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/misc.hh
Run `make grand-replace'.
[lilypond.git] / lily / include / misc.hh
1 /*
2   misc.hh -- declare miscellaneous functions.
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2005--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef MISC_HH
10 #define MISC_HH
11
12 #include <cstdlib>
13 using namespace std;
14
15 #include "std-vector.hh"
16 #include "interval.hh"
17
18 double log_2 (double x);
19 int intlog2 (int d);
20
21 inline int
22 sign (int i)
23 {
24   if (i < 0)
25     return -1;
26   else if (i)
27     return 1;
28   else return 0;
29 }
30
31 inline Real
32 linear_interpolate (Real x, Real x1, Real x2, Real y1, Real y2)
33 {
34   return (x2 - x) / (x2 - x1) * y1
35     + (x - x1) / (x2 - x1) * y2;
36 }
37
38 Real directed_round (Real f, Direction d);
39
40 Real peak_around (Real epsilon,  Real threshold, Real x);
41 Real convex_amplifier (Real standard_x, Real increase_factor, Real x);
42 string camel_case_to_lisp_identifier (string in);
43
44 #endif
45