Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
4.9KB

  1. /*
  2. Copyright 2012-2016 David Robillard <http://drobilla.net>
  3. Permission to use, copy, modify, and/or distribute this software for any
  4. purpose with or without fee is hereby granted, provided that the above
  5. copyright notice and this permission notice appear in all copies.
  6. THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  7. WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  8. MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  9. ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  10. WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  11. ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  12. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  13. */
  14. /**
  15. @defgroup options Options
  16. Instantiation time options, see <http://lv2plug.in/ns/ext/options> for
  17. details.
  18. @{
  19. */
  20. #ifndef LV2_OPTIONS_H
  21. #define LV2_OPTIONS_H
  22. #include <stdint.h>
  23. #include "urid.h"
  24. #include "lv2.h"
  25. #define LV2_OPTIONS_URI "http://lv2plug.in/ns/ext/options" ///< http://lv2plug.in/ns/ext/options
  26. #define LV2_OPTIONS_PREFIX LV2_OPTIONS_URI "#" ///< http://lv2plug.in/ns/ext/options#
  27. #define LV2_OPTIONS__Option LV2_OPTIONS_PREFIX "Option" ///< http://lv2plug.in/ns/ext/options#Option
  28. #define LV2_OPTIONS__interface LV2_OPTIONS_PREFIX "interface" ///< http://lv2plug.in/ns/ext/options#interface
  29. #define LV2_OPTIONS__options LV2_OPTIONS_PREFIX "options" ///< http://lv2plug.in/ns/ext/options#options
  30. #define LV2_OPTIONS__requiredOption LV2_OPTIONS_PREFIX "requiredOption" ///< http://lv2plug.in/ns/ext/options#requiredOption
  31. #define LV2_OPTIONS__supportedOption LV2_OPTIONS_PREFIX "supportedOption" ///< http://lv2plug.in/ns/ext/options#supportedOption
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. /**
  36. The context of an Option, which defines the subject it applies to.
  37. */
  38. typedef enum {
  39. /**
  40. This option applies to the instance itself. The subject must be
  41. ignored.
  42. */
  43. LV2_OPTIONS_INSTANCE,
  44. /**
  45. This option applies to some named resource. The subject is a URI mapped
  46. to an integer (a LV2_URID, like the key)
  47. */
  48. LV2_OPTIONS_RESOURCE,
  49. /**
  50. This option applies to some blank node. The subject is a blank node
  51. identifier, which is valid only within the current local scope.
  52. */
  53. LV2_OPTIONS_BLANK,
  54. /**
  55. This option applies to a port on the instance. The subject is the
  56. port's index.
  57. */
  58. LV2_OPTIONS_PORT
  59. } LV2_Options_Context;
  60. /**
  61. An option.
  62. This is a property with a subject, also known as a triple or statement.
  63. This struct is useful anywhere a statement needs to be passed where no
  64. memory ownership issues are present (since the value is a const pointer).
  65. Options can be passed to an instance via the feature LV2_OPTIONS__options
  66. with data pointed to an array of options terminated by a zeroed option, or
  67. accessed/manipulated using LV2_Options_Interface.
  68. */
  69. typedef struct _LV2_Options_Option {
  70. LV2_Options_Context context; /**< Context (type of subject). */
  71. uint32_t subject; /**< Subject. */
  72. LV2_URID key; /**< Key (property). */
  73. uint32_t size; /**< Size of value in bytes. */
  74. LV2_URID type; /**< Type of value (datatype). */
  75. const void* value; /**< Pointer to value (object). */
  76. } LV2_Options_Option;
  77. /** A status code for option functions. */
  78. typedef enum {
  79. LV2_OPTIONS_SUCCESS = 0, /**< Completed successfully. */
  80. LV2_OPTIONS_ERR_UNKNOWN = 1, /**< Unknown error. */
  81. LV2_OPTIONS_ERR_BAD_SUBJECT = 1 << 1, /**< Invalid/unsupported subject. */
  82. LV2_OPTIONS_ERR_BAD_KEY = 1 << 2, /**< Invalid/unsupported key. */
  83. LV2_OPTIONS_ERR_BAD_VALUE = 1 << 3 /**< Invalid/unsupported value. */
  84. } LV2_Options_Status;
  85. /**
  86. Interface for dynamically setting options (LV2_OPTIONS__interface).
  87. */
  88. typedef struct _LV2_Options_Interface {
  89. /**
  90. Get the given options.
  91. Each element of the passed options array MUST have type, subject, and
  92. key set. All other fields (size, type, value) MUST be initialised to
  93. zero, and are set to the option value if such an option is found.
  94. This function is in the "instantiation" LV2 threading class, so no other
  95. instance functions may be called concurrently.
  96. @return Bitwise OR of LV2_Options_Status values.
  97. */
  98. uint32_t (*get)(LV2_Handle instance,
  99. LV2_Options_Option* options);
  100. /**
  101. Set the given options.
  102. This function is in the "instantiation" LV2 threading class, so no other
  103. instance functions may be called concurrently.
  104. @return Bitwise OR of LV2_Options_Status values.
  105. */
  106. uint32_t (*set)(LV2_Handle instance,
  107. const LV2_Options_Option* options);
  108. } LV2_Options_Interface;
  109. #ifdef __cplusplus
  110. } /* extern "C" */
  111. #endif
  112. #endif /* LV2_OPTIONS_H */
  113. /**
  114. @}
  115. */