ardour
spline.h
Go to the documentation of this file.
1 /* This code is based upon work that bore the legend:
2  *
3  * Copyright (C) 1997 David Mosberger
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
21 #ifndef __ardour_spline_h__
22 #define __ardour_spline_h__
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 typedef struct _spline Spline;
29 typedef struct _spline_point SplinePoint;
30 
32 {
33  float x;
34  float y;
35 };
36 
37 Spline *spline_new (void);
38 void spline_free (Spline *);
39 
40 void spline_set (Spline *, uint32_t n, SplinePoint *);
41 void spline_add (Spline *, uint32_t n, SplinePoint *);
42 void spline_solve (Spline *);
43 float spline_eval (Spline *, float val);
44 void spline_fill (Spline *, float x0, float x1, float *vec, uint32_t veclen);
45 float spline_get_max_x (Spline *);
46 float spline_get_min_x (Spline *);
47 
49 {
50  float *deriv2;
51  float *x;
52  float *y;
53  float max_x;
54  float min_x;
56  uint32_t npoints;
57  uint32_t space;
58 
59 #ifdef __cplusplus
60 
61  void set (uint32_t n, SplinePoint *points) {
62  spline_set (this, n, points);
63  }
64 
65  void add (uint32_t n, SplinePoint *points) {
66  spline_add (this, n, points);
67  }
68 
69  void solve () {
70  spline_solve (this);
71  }
72 
73  float eval (float val) {
74  return spline_eval (this, val);
75  }
76 
77  void fill (float x0, float x1, float *vec, uint32_t veclen) {
78  spline_fill (this, x0, x1, vec, veclen);
79  }
80 
81 #endif /* __cplusplus */
82 
83 };
84 
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif /* __ardour_spline_h__ */
float y
Definition: spline.h:34
Definition: spline.h:48
void spline_free(Spline *)
float spline_eval(Spline *, float val)
uint32_t space
Definition: spline.h:57
float * y
Definition: spline.h:52
float min_x
Definition: spline.h:54
SplinePoint * points
Definition: spline.h:55
void spline_add(Spline *, uint32_t n, SplinePoint *)
void spline_set(Spline *, uint32_t n, SplinePoint *)
void spline_fill(Spline *, float x0, float x1, float *vec, uint32_t veclen)
float * x
Definition: spline.h:51
float spline_get_min_x(Spline *)
#define LIBARDOUR_API
float * deriv2
Definition: spline.h:50
float spline_get_max_x(Spline *)
float x
Definition: spline.h:33
uint32_t npoints
Definition: spline.h:56
void spline_solve(Spline *)
Spline * spline_new(void)
float max_x
Definition: spline.h:53