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.

79 lines
2.5KB

  1. #pragma once
  2. #include "../plugin.h"
  3. #include "../string-sizes.h"
  4. /// @page Note Ports
  5. ///
  6. /// This extension provides a way for the plugin to describe its current note ports.
  7. /// If the plugin does not implement this extension, it won't have note input or output.
  8. /// The plugin is only allowed to change its note ports configuration while it is deactivated.
  9. static CLAP_CONSTEXPR const char CLAP_EXT_NOTE_PORTS[] = "clap.note-ports";
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. enum clap_note_dialect {
  14. // Uses clap_event_note and clap_event_note_expression.
  15. CLAP_NOTE_DIALECT_CLAP = 1 << 0,
  16. // Uses clap_event_midi, no polyphonic expression
  17. CLAP_NOTE_DIALECT_MIDI = 1 << 1,
  18. // Uses clap_event_midi, with polyphonic expression (MPE)
  19. CLAP_NOTE_DIALECT_MIDI_MPE = 1 << 2,
  20. // Uses clap_event_midi2
  21. CLAP_NOTE_DIALECT_MIDI2 = 1 << 3,
  22. };
  23. typedef struct clap_note_port_info {
  24. // id identifies a port and must be stable.
  25. // id may overlap between input and output ports.
  26. clap_id id;
  27. uint32_t supported_dialects; // bitfield, see clap_note_dialect
  28. uint32_t preferred_dialect; // one value of clap_note_dialect
  29. char name[CLAP_NAME_SIZE]; // displayable name, i18n?
  30. } clap_note_port_info_t;
  31. // The note ports scan has to be done while the plugin is deactivated.
  32. typedef struct clap_plugin_note_ports {
  33. // number of ports, for either input or output
  34. // [main-thread]
  35. uint32_t (*count)(const clap_plugin_t *plugin, bool is_input);
  36. // get info about about a note port.
  37. // [main-thread]
  38. bool (*get)(const clap_plugin_t *plugin,
  39. uint32_t index,
  40. bool is_input,
  41. clap_note_port_info_t *info);
  42. } clap_plugin_note_ports_t;
  43. enum {
  44. // The ports have changed, the host shall perform a full scan of the ports.
  45. // This flag can only be used if the plugin is not active.
  46. // If the plugin active, call host->request_restart() and then call rescan()
  47. // when the host calls deactivate()
  48. CLAP_NOTE_PORTS_RESCAN_ALL = 1 << 0,
  49. // The ports name did change, the host can scan them right away.
  50. CLAP_NOTE_PORTS_RESCAN_NAMES = 1 << 1,
  51. };
  52. typedef struct clap_host_note_ports {
  53. // Query which dialects the host supports
  54. // [main-thread]
  55. uint32_t (*supported_dialects)(const clap_host_t *host);
  56. // Rescan the full list of note ports according to the flags.
  57. // [main-thread]
  58. void (*rescan)(const clap_host_t *host, uint32_t flags);
  59. } clap_host_note_ports_t;
  60. #ifdef __cplusplus
  61. }
  62. #endif