Fix last commit
[carla.git] / source / includes / lv2 / resize-port.h
blob5eb47f2357be1eed78ff6c676b1da933760c368e
1 /*
2 Copyright 2007-2016 David Robillard <http://drobilla.net>
4 Permission to use, copy, modify, and/or distribute this software for any
5 purpose with or without fee is hereby granted, provided that the above
6 copyright notice and this permission notice appear in all copies.
8 THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 /**
18 @defgroup resize-port Resize Port
20 Dynamically sized LV2 port buffers.
25 #ifndef LV2_RESIZE_PORT_H
26 #define LV2_RESIZE_PORT_H
28 #include <stddef.h>
29 #include <stdint.h>
31 #define LV2_RESIZE_PORT_URI "http://lv2plug.in/ns/ext/resize-port" ///< http://lv2plug.in/ns/ext/resize-port
32 #define LV2_RESIZE_PORT_PREFIX LV2_RESIZE_PORT_URI "#" ///< http://lv2plug.in/ns/ext/resize-port#
34 #define LV2_RESIZE_PORT__asLargeAs LV2_RESIZE_PORT_PREFIX "asLargeAs" ///< http://lv2plug.in/ns/ext/port#asLargeAs
35 #define LV2_RESIZE_PORT__minimumSize LV2_RESIZE_PORT_PREFIX "minimumSize" ///< http://lv2plug.in/ns/ext/port#minimumSize
36 #define LV2_RESIZE_PORT__resize LV2_RESIZE_PORT_PREFIX "resize" ///< http://lv2plug.in/ns/ext/port#resize
38 #ifdef __cplusplus
39 extern "C" {
40 #else
41 # include <stdbool.h>
42 #endif
44 /** A status code for state functions. */
45 typedef enum {
46 LV2_RESIZE_PORT_SUCCESS = 0, /**< Completed successfully. */
47 LV2_RESIZE_PORT_ERR_UNKNOWN = 1, /**< Unknown error. */
48 LV2_RESIZE_PORT_ERR_NO_SPACE = 2 /**< Insufficient space. */
49 } LV2_Resize_Port_Status;
51 /** Opaque data for resize method. */
52 typedef void* LV2_Resize_Port_Feature_Data;
54 /** Host feature to allow plugins to resize their port buffers. */
55 typedef struct {
56 /** Opaque data for resize method. */
57 LV2_Resize_Port_Feature_Data data;
59 /**
60 Resize a port buffer to at least `size` bytes.
62 This function MAY return an error, in which case the port buffer was not
63 resized and the port is still connected to the same location. Plugins
64 MUST gracefully handle this situation.
66 This function is in the audio threading class.
68 The host MUST preserve the contents of the port buffer when resizing.
70 Plugins MAY resize a port many times in a single run callback. Hosts
71 SHOULD make this as inexpensive as possible.
73 LV2_Resize_Port_Status (*resize)(LV2_Resize_Port_Feature_Data data,
74 uint32_t index,
75 size_t size);
76 } LV2_Resize_Port_Resize;
78 #ifdef __cplusplus
79 } /* extern "C" */
80 #endif
82 #endif /* LV2_RESIZE_PORT_H */
84 /**