summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/spline.h
diff options
context:
space:
mode:
authorTaybin Rutkin <taybin@taybin.com>2005-09-24 19:13:41 +0000
committerTaybin Rutkin <taybin@taybin.com>2005-09-24 19:13:41 +0000
commit8af0757b61990767f2a85e68f535a5af9976fd79 (patch)
treef9e06fe12cac866d658a2e7074a61aa74d12f68f /libs/ardour/ardour/spline.h
parentf9546e5c76afa101e9dbe8a057e72463b03430e5 (diff)
libardour added.
git-svn-id: svn://localhost/trunk/ardour2@17 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour/spline.h')
-rw-r--r--libs/ardour/ardour/spline.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/libs/ardour/ardour/spline.h b/libs/ardour/ardour/spline.h
new file mode 100644
index 0000000000..de1ece6edb
--- /dev/null
+++ b/libs/ardour/ardour/spline.h
@@ -0,0 +1,90 @@
+/* This code is based upon work that bore the legend:
+ *
+ * Copyright (C) 1997 David Mosberger
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __ardour_spline_h__
+#define __ardour_spline_h__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _spline Spline;
+typedef struct _spline_point SplinePoint;
+
+struct _spline_point
+{
+ float x;
+ float y;
+};
+
+Spline *spline_new (void);
+void spline_free (Spline *);
+
+void spline_set (Spline *, uint32_t n, SplinePoint *);
+void spline_add (Spline *, uint32_t n, SplinePoint *);
+void spline_solve (Spline *);
+float spline_eval (Spline *, float val);
+void spline_fill (Spline *, float x0, float x1, float *vec, uint32_t veclen);
+float spline_get_max_x (Spline *);
+float spline_get_min_x (Spline *);
+
+struct _spline
+{
+ float *deriv2;
+ float *x;
+ float *y;
+ float max_x;
+ float min_x;
+ SplinePoint *points;
+ uint32_t npoints;
+ uint32_t space;
+
+#ifdef __cplusplus
+
+ void set (uint32_t n, SplinePoint *points) {
+ spline_set (this, n, points);
+ }
+
+ void add (uint32_t n, SplinePoint *points) {
+ spline_add (this, n, points);
+ }
+
+ void solve () {
+ spline_solve (this);
+ }
+
+ float eval (float val) {
+ return spline_eval (this, val);
+ }
+
+ void fill (float x0, float x1, float *vec, uint32_t veclen) {
+ spline_fill (this, x0, x1, vec, veclen);
+ }
+
+#endif /* __cplusplus */
+
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ardour_spline_h__ */