Ardour  8.12
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 Lesser 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  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef __ardour_spline_h__
21 #define __ardour_spline_h__
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 typedef struct _spline Spline;
28 typedef struct _spline_point SplinePoint;
29 
31 {
32  float x;
33  float y;
34 };
35 
38 
39 void spline_set (Spline *, uint32_t n, SplinePoint *);
40 void spline_add (Spline *, uint32_t n, SplinePoint *);
42 float spline_eval (Spline *, float val);
43 void spline_fill (Spline *, float x0, float x1, float *vec, uint32_t veclen);
46 
48 {
49  float *deriv2;
50  float *x;
51  float *y;
52  float max_x;
53  float min_x;
55  uint32_t npoints;
56  uint32_t space;
57 
58 #ifdef __cplusplus
59 
60  void set (uint32_t n, SplinePoint *points) {
61  spline_set (this, n, points);
62  }
63 
64  void add (uint32_t n, SplinePoint *points) {
65  spline_add (this, n, points);
66  }
67 
68  void solve () {
69  spline_solve (this);
70  }
71 
72  float eval (float val) {
73  return spline_eval (this, val);
74  }
75 
76  void fill (float x0, float x1, float *vec, uint32_t veclen) {
77  spline_fill (this, x0, x1, vec, veclen);
78  }
79 
80 #endif /* __cplusplus */
81 
82 };
83 
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif /* __ardour_spline_h__ */
#define LIBARDOUR_API
void add(const Gtk::StockItem &item)
void spline_fill(Spline *, float x0, float x1, float *vec, uint32_t veclen)
void spline_add(Spline *, uint32_t n, SplinePoint *)
void spline_free(Spline *)
float spline_get_max_x(Spline *)
float spline_get_min_x(Spline *)
void spline_solve(Spline *)
void spline_set(Spline *, uint32_t n, SplinePoint *)
float spline_eval(Spline *, float val)
Spline * spline_new(void)
float x
Definition: spline.h:32
float y
Definition: spline.h:33
Definition: spline.h:48
float max_x
Definition: spline.h:52
SplinePoint * points
Definition: spline.h:54
float min_x
Definition: spline.h:53
float * x
Definition: spline.h:50
float * y
Definition: spline.h:51
uint32_t space
Definition: spline.h:56
float * deriv2
Definition: spline.h:49
uint32_t npoints
Definition: spline.h:55