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.

uri-map.h 3.8KB

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