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.

107 lines
3.9KB

  1. /*
  2. Copyright 2008-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 uri-map URI Map
  16. C API for the LV2 URI Map extension <http://lv2plug.in/ns/ext/uri-map>.
  17. This extension defines a simple mechanism for plugins to map URIs to
  18. integers, usually for performance reasons (e.g. processing events typed by
  19. URIs in real time). The expected use case is for plugins to map URIs to
  20. integers for things they 'understand' at instantiation time, and store those
  21. values for use in the audio thread without doing any string comparison.
  22. This allows the extensibility of RDF with the performance of integers (or
  23. centrally defined enumerations).
  24. @{
  25. */
  26. #ifndef LV2_URI_MAP_H
  27. #define LV2_URI_MAP_H
  28. #define LV2_URI_MAP_URI "http://lv2plug.in/ns/ext/uri-map" ///< http://lv2plug.in/ns/ext/uri-map
  29. #define LV2_URI_MAP_PREFIX LV2_URI_MAP_URI "#" ///< http://lv2plug.in/ns/ext/uri-map#
  30. #include <stdint.h>
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /**
  35. Opaque pointer to host data.
  36. */
  37. typedef void* LV2_URI_Map_Callback_Data;
  38. /**
  39. URI Map Feature.
  40. To support this feature the host must pass an LV2_Feature struct to the
  41. plugin's instantiate method with URI "http://lv2plug.in/ns/ext/uri-map"
  42. and data pointed to an instance of this struct.
  43. */
  44. typedef struct {
  45. /**
  46. Opaque pointer to host data.
  47. The plugin MUST pass this to any call to functions in this struct.
  48. Otherwise, it must not be interpreted in any way.
  49. */
  50. LV2_URI_Map_Callback_Data callback_data;
  51. /**
  52. Get the numeric ID of a URI from the host.
  53. @param callback_data Must be the callback_data member of this struct.
  54. @param map The 'context' of this URI. Certain extensions may define a
  55. URI that must be passed here with certain restrictions on the return
  56. value (e.g. limited range). This value may be NULL if the plugin needs
  57. an ID for a URI in general. Extensions SHOULD NOT define a context
  58. unless there is a specific need to do so, e.g. to restrict the range of
  59. the returned value.
  60. @param uri The URI to be mapped to an integer ID.
  61. This function is referentially transparent; any number of calls with the
  62. same arguments is guaranteed to return the same value over the life of a
  63. plugin instance (though the same URI may return different values with a
  64. different map parameter). However, this function is not necessarily very
  65. fast: plugins SHOULD cache any IDs they might need in performance
  66. critical situations.
  67. The return value 0 is reserved and indicates that an ID for that URI
  68. could not be created for whatever reason. Extensions MAY define more
  69. precisely what this means in a certain context, but in general plugins
  70. SHOULD handle this situation as gracefully as possible. However, hosts
  71. SHOULD NOT return 0 from this function in non-exceptional circumstances
  72. (e.g. the URI map SHOULD be dynamic). Hosts that statically support only
  73. a fixed set of URIs should not expect plugins to function correctly.
  74. */
  75. uint32_t (*uri_to_id)(LV2_URI_Map_Callback_Data callback_data,
  76. const char* map,
  77. const char* uri);
  78. } LV2_URI_Map_Feature;
  79. #ifdef __cplusplus
  80. } /* extern "C" */
  81. #endif
  82. #endif /* LV2_URI_MAP_H */
  83. /**
  84. @}
  85. */