LV2 Extensions
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.

115 lines
3.9KB

  1. /*
  2. LV2 External UI extension
  3. Copyright 2020 Filipe Coelho <falktx@falktx.com>
  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.
  7. THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  10. ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  12. ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  13. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14. */
  15. /**
  16. @file lv2_external_ui.h
  17. C header for the LV2 External UI extension <http://kxstudio.sf.net/ns/lv2ext/external-ui>.
  18. */
  19. #ifndef LV2_EXTERNAL_UI_H
  20. #define LV2_EXTERNAL_UI_H
  21. #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
  22. #define LV2_EXTERNAL_UI_URI "http://kxstudio.sf.net/ns/lv2ext/external-ui"
  23. #define LV2_EXTERNAL_UI_PREFIX LV2_EXTERNAL_UI_URI "#"
  24. #define LV2_EXTERNAL_UI__Host LV2_EXTERNAL_UI_PREFIX "Host"
  25. #define LV2_EXTERNAL_UI__Widget LV2_EXTERNAL_UI_PREFIX "Widget"
  26. /** This extension used to be defined by a lv2plug.in URI */
  27. #define LV2_EXTERNAL_UI_DEPRECATED_URI "http://lv2plug.in/ns/extensions/ui#external"
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /**
  32. * When LV2_EXTERNAL_UI__Widget UI is instantiated, the returned
  33. * LV2UI_Widget handle must be cast to pointer to LV2_External_UI_Widget.
  34. * UI is created in invisible state.
  35. */
  36. typedef struct _LV2_External_UI_Widget {
  37. /**
  38. * Host calls this function regulary. UI library implementing the
  39. * callback may do IPC or redraw the UI.
  40. *
  41. * @param _this_ the UI context
  42. */
  43. void (*run)(struct _LV2_External_UI_Widget * _this_);
  44. /**
  45. * Host calls this function to make the plugin UI visible.
  46. *
  47. * @param _this_ the UI context
  48. */
  49. void (*show)(struct _LV2_External_UI_Widget * _this_);
  50. /**
  51. * Host calls this function to make the plugin UI invisible again.
  52. *
  53. * @param _this_ the UI context
  54. */
  55. void (*hide)(struct _LV2_External_UI_Widget * _this_);
  56. } LV2_External_UI_Widget;
  57. #define LV2_EXTERNAL_UI_RUN(ptr) (ptr)->run(ptr)
  58. #define LV2_EXTERNAL_UI_SHOW(ptr) (ptr)->show(ptr)
  59. #define LV2_EXTERNAL_UI_HIDE(ptr) (ptr)->hide(ptr)
  60. /**
  61. * On UI instantiation, host must supply LV2_EXTERNAL_UI__Host feature.
  62. * LV2_Feature::data must be pointer to LV2_External_UI_Host.
  63. */
  64. typedef struct _LV2_External_UI_Host {
  65. /**
  66. * Callback that plugin UI will call when UI (GUI window) is closed by user.
  67. * This callback will be called during execution of LV2_External_UI_Widget::run()
  68. * (i.e. not from background thread).
  69. *
  70. * After this callback is called, UI is defunct. Host must call LV2UI_Descriptor::cleanup().
  71. * If host wants to make the UI visible again, the UI must be reinstantiated.
  72. *
  73. * @note When using the depreated URI LV2_EXTERNAL_UI_DEPRECATED_URI,
  74. * some hosts will not call LV2UI_Descriptor::cleanup() as they should,
  75. * and may call show() again without re-initialization.
  76. *
  77. * @param controller Host context associated with plugin UI, as
  78. * supplied to LV2UI_Descriptor::instantiate().
  79. */
  80. void (*ui_closed)(LV2UI_Controller controller);
  81. /**
  82. * Optional (may be NULL) "user friendly" identifier which the UI
  83. * may display to allow a user to easily associate this particular
  84. * UI instance with the correct plugin instance as it is represented
  85. * by the host (e.g. "track 1" or "channel 4").
  86. *
  87. * If supplied by host, the string will be referenced only during
  88. * LV2UI_Descriptor::instantiate()
  89. */
  90. const char * plugin_human_id;
  91. } LV2_External_UI_Host;
  92. #ifdef __cplusplus
  93. } /* extern "C" */
  94. #endif
  95. #endif /* LV2_EXTERNAL_UI_H */