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.

options.h 4.3KB

12 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. Copyright 2012 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. #ifndef LV2_OPTIONS_H
  15. #define LV2_OPTIONS_H
  16. #include <stdint.h>
  17. #include "urid.h"
  18. #include "lv2.h"
  19. #define LV2_OPTIONS_URI "http://lv2plug.in/ns/ext/options"
  20. #define LV2_OPTIONS_PREFIX LV2_OPTIONS_URI "#"
  21. #define LV2_OPTIONS__Option LV2_OPTIONS_PREFIX "Option"
  22. #define LV2_OPTIONS__interface LV2_OPTIONS_PREFIX "interface"
  23. #define LV2_OPTIONS__options LV2_OPTIONS_PREFIX "options"
  24. #define LV2_OPTIONS__requiredOption LV2_OPTIONS_PREFIX "requiredOption"
  25. #define LV2_OPTIONS__supportedOption LV2_OPTIONS_PREFIX "supportedOption"
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. /**
  30. The context of an Option, which defines the subject it applies to.
  31. */
  32. typedef enum {
  33. /**
  34. This option applies to the instance itself. The subject must be
  35. ignored.
  36. */
  37. LV2_OPTIONS_INSTANCE,
  38. /**
  39. This option applies to some named resource. The subject is a URI mapped
  40. to an integer (a LV2_URID, like the key)
  41. */
  42. LV2_OPTIONS_RESOURCE,
  43. /**
  44. This option applies to some blank node. The subject is a blank node
  45. identifier, which is valid only within the current local scope.
  46. */
  47. LV2_OPTIONS_BLANK,
  48. /**
  49. This option applies to a port on the instance. The subject is the
  50. port's index.
  51. */
  52. LV2_OPTIONS_PORT
  53. } LV2_Options_Context;
  54. /**
  55. An option.
  56. This is a property with a subject, also known as a triple or statement.
  57. This struct is useful anywhere a statement needs to be passed where no
  58. memory ownership issues are present (since the value is a const pointer).
  59. Options can be passed to an instance via the feature LV2_OPTIONS__options
  60. with data pointed to an array of options terminated by a zeroed option, or
  61. accessed/manipulated using LV2_Options_Interface.
  62. */
  63. typedef struct _LV2_Options_Option {
  64. LV2_Options_Context context; /**< Context (type of subject). */
  65. uint32_t subject; /**< Subject. */
  66. LV2_URID key; /**< Key (property). */
  67. uint32_t size; /**< Size of value in bytes. */
  68. LV2_URID type; /**< Type of value (datatype). */
  69. const void* value; /**< Pointer to value (object). */
  70. } LV2_Options_Option;
  71. /** A status code for option functions. */
  72. typedef enum {
  73. LV2_OPTIONS_SUCCESS = 0, /**< Completed successfully. */
  74. LV2_OPTIONS_ERR_UNKNOWN = 1, /**< Unknown error. */
  75. LV2_OPTIONS_ERR_BAD_SUBJECT = 1 << 1, /**< Invalid/unsupported subject. */
  76. LV2_OPTIONS_ERR_BAD_KEY = 1 << 2, /**< Invalid/unsupported key. */
  77. LV2_OPTIONS_ERR_BAD_VALUE = 1 << 3 /**< Invalid/unsupported value. */
  78. } LV2_Options_Status;
  79. /**
  80. Interface for dynamically setting options (LV2_OPTIONS__interface).
  81. */
  82. typedef struct _LV2_Options_Interface {
  83. /**
  84. Get the given options.
  85. Each element of the passed options array MUST have type, subject, and
  86. key set. All other fields (size, type, value) MUST be initialised to
  87. zero, and are set to the option value if such an option is found.
  88. This function is in the "instantiation" LV2 threading class, so no other
  89. instance functions may be called concurrently.
  90. @return Bitwise OR of LV2_Options_Status values.
  91. */
  92. uint32_t (*get)(LV2_Handle instance,
  93. LV2_Options_Option* options);
  94. /**
  95. Set the given options.
  96. This function is in the "instantiation" LV2 threading class, so no other
  97. instance functions may be called concurrently.
  98. @return Bitwise OR of LV2_Options_Status values.
  99. */
  100. uint32_t (*set)(LV2_Handle instance,
  101. const LV2_Options_Option* options);
  102. } LV2_Options_Interface;
  103. #ifdef __cplusplus
  104. } /* extern "C" */
  105. #endif
  106. #endif /* LV2_OPTIONS_H */