diff options
Diffstat (limited to 'slv2')
-rw-r--r-- | slv2/Makefile.am | 2 | ||||
-rw-r--r-- | slv2/port.h | 15 | ||||
-rw-r--r-- | slv2/scalepoint.h | 55 | ||||
-rw-r--r-- | slv2/scalepoints.h | 73 | ||||
-rw-r--r-- | slv2/slv2.h | 2 | ||||
-rw-r--r-- | slv2/types.h | 8 |
6 files changed, 154 insertions, 1 deletions
diff --git a/slv2/Makefile.am b/slv2/Makefile.am index 2c11b91..4c37778 100644 --- a/slv2/Makefile.am +++ b/slv2/Makefile.am @@ -13,6 +13,8 @@ slv2include_HEADERS = \ port.h \ slv2.h \ types.h \ + scalepoint.h \ + scalepoints.h \ util.h \ value.h \ values.h \ diff --git a/slv2/port.h b/slv2/port.h index 5c0549c..6b55a56 100644 --- a/slv2/port.h +++ b/slv2/port.h @@ -138,13 +138,26 @@ slv2_port_is_a(SLV2Plugin plugin, * Time = Query */ void -slv2_port_get_range(SLV2Plugin p, +slv2_port_get_range(SLV2Plugin plugin, SLV2Port port, SLV2Value* def, SLV2Value* min, SLV2Value* max); +/** Get the scale points (enumeration values) of a port. + * + * This returns a collection of 'interesting' named values of a port + * (e.g. appropriate entries for a UI selector associated with this port). + * + * Returned value may be NULL if @a port has no scale points, otherwise it + * must be freed by caller with slv2_scale_points_free. + */ +SLV2ScalePoints +slv2_port_get_scale_points(SLV2Plugin plugin, + SLV2Port port); + + /** @} */ #ifdef __cplusplus diff --git a/slv2/scalepoint.h b/slv2/scalepoint.h new file mode 100644 index 0000000..e5fd9cf --- /dev/null +++ b/slv2/scalepoint.h @@ -0,0 +1,55 @@ +/* SLV2 + * Copyright (C) 2007 Dave Robillard <http://drobilla.net> + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU 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 General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __SLV2_SCALE_POINT_H__ +#define __SLV2_SCALE_POINT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <slv2/types.h> + +/** \addtogroup slv2_data + * @{ + */ + + +/** Get the label of this scale point (enumeration value) + * + * Returned value is owned by \a point and must not be freed. + */ +SLV2Value +slv2_scale_point_get_label(SLV2ScalePoint point); + + +/** Get the value of this scale point (enumeration value) + * + * Returned value is owned by \a point and must not be freed. + */ +SLV2Value +slv2_scale_point_get_value(SLV2ScalePoint point); + + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __SLV2_SCALE_POINT_H__ */ diff --git a/slv2/scalepoints.h b/slv2/scalepoints.h new file mode 100644 index 0000000..baaa43c --- /dev/null +++ b/slv2/scalepoints.h @@ -0,0 +1,73 @@ +/* SLV2 + * Copyright (C) 2007 Dave Robillard <http://drobilla.net> + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU 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 General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __SLV2_SCALE_POINTS_H__ +#define __SLV2_SCALE_POINTS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdbool.h> +#include <slv2/value.h> + +/** \defgroup slv2_collections Collections of scale_points/objects + * + * Ordered collections of typed scale_points which are fast for random + * access by index (i.e. a fancy array). + * + * @{ + */ + + +/** Allocate a new, empty SLV2Values + */ +SLV2Values +slv2_scale_points_new(); + + +/** Free an SLV2Values. + */ +void +slv2_scale_points_free(SLV2Values); + + +/** Get the number of elements in a string list. + */ +unsigned +slv2_scale_points_size(SLV2Values list); + + +/** Get a string from a string list at the given index. + * + * @return the element at \a index, or NULL if index is out of range. + * + * Time = O(1) + */ +SLV2ScalePoint +slv2_scale_points_get_at(SLV2ScalePoints points, unsigned index); + + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __SLV2_SCALE_POINTS_H__ */ + diff --git a/slv2/slv2.h b/slv2/slv2.h index 6d0298b..3ddd85f 100644 --- a/slv2/slv2.h +++ b/slv2/slv2.h @@ -35,6 +35,8 @@ extern "C" { #include <slv2/util.h> #include <slv2/value.h> #include <slv2/values.h> +#include <slv2/scalepoint.h> +#include <slv2/scalepoints.h> #include <slv2/world.h> #ifdef __cplusplus diff --git a/slv2/types.h b/slv2/types.h index ce73fc3..59ebefe 100644 --- a/slv2/types.h +++ b/slv2/types.h @@ -68,6 +68,14 @@ typedef struct _SLV2Value* SLV2Value; typedef void* SLV2Values; +/** A scale point */ +typedef struct _SLV2ScalePoint* SLV2ScalePoint; + + +/** A collection of scale points. */ +typedef void* SLV2ScalePoints; + + /** A plugin UI */ typedef struct _SLV2UI* SLV2UI; |