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.

96 lines
3.2KB

  1. /*
  2. * Copyright (c) 2014 Hanspeter Portner (dev@open-music-kontrollers.ch)
  3. *
  4. * This software is provided 'as-is', without any express or implied
  5. * warranty. In no event will the authors be held liable for any damages
  6. * arising from the use of this software.
  7. *
  8. * Permission is granted to anyone to use this software for any purpose,
  9. * including commercial applications, and to alter it and redistribute it
  10. * freely, subject to the following restrictions:
  11. *
  12. * 1. The origin of this software must not be misrepresented; you must not
  13. * claim that you wrote the original software. If you use this software
  14. * in a product, an acknowledgment in the product documentation would be
  15. * appreciated but is not required.
  16. *
  17. * 2. Altered source versions must be plainly marked as such, and must not be
  18. * misrepresented as being the original software.
  19. *
  20. * 3. This notice may not be removed or altered from any source
  21. * distribution.
  22. */
  23. #ifndef __JACK_OSC_H
  24. #define __JACK_OSC_H
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif /* __cplusplus */
  28. #include <jack/jack.h>
  29. #include <jack/types.h>
  30. #include <jack/midiport.h>
  31. /*
  32. * It is not necessary to use this header since it contains transparent
  33. * macros referring to the Jack MIDI API, but developers are encouraged
  34. * to use this header (or at least the same definitions) to make their
  35. * code more clear.
  36. */
  37. /*
  38. * Use this as port type in jack_port_register to make it clear that
  39. * this MIDI port is used to route OSC messages.
  40. *
  41. * jack_port_t *osc_in;
  42. * osc_in = jack_port_register(client, "osc.in", JACK_DEFAULT_OSC_TYPE,
  43. * JackPortIsInput, 0);
  44. */
  45. #define JACK_DEFAULT_OSC_TYPE JACK_DEFAULT_MIDI_TYPE
  46. /*
  47. * Use this as value for metadata key JACKEY_EVENT_TYPES
  48. * (http://jackaudio.org/metadata/event-type) to mark/query/unmark a port
  49. * as OSC carrier in jack_{set,get,remove}_property.
  50. *
  51. * jack_uuid_t uuid_in = jack_port_uuid(osc_in);
  52. *
  53. * // set port event type to OSC
  54. * jack_set_property(client, uuid_in, JACKEY_EVENT_TYPES,
  55. * JACK_EVENT_TYPE__OSC, NULL);
  56. *
  57. * // query port event type
  58. * char *value = NULL;
  59. * char *type = NULL;
  60. * if( (jack_get_property(uuid, JACKEY_EVENT_TYPES, &value, &type) == 0)
  61. * && (strstr(value, JACK_EVENT_TYPE__OSC) != NULL) )
  62. * printf("This port routes OSC!\n");
  63. * jack_free(value);
  64. * jack_free(type);
  65. *
  66. * // clear port event type
  67. * jack_remove_property(client, uuid_in, JACKEY_EVENT_TYPES);
  68. */
  69. #define JACK_EVENT_TYPE__OSC "OSC"
  70. /*
  71. * The Jack OSC API is a direct map to the Jack MIDI API.
  72. */
  73. typedef jack_midi_data_t jack_osc_data_t;
  74. typedef jack_midi_event_t jack_osc_event_t;
  75. #define jack_osc_get_event_count jack_midi_get_event_count
  76. #define jack_osc_event_get jack_midi_event_get
  77. #define jack_osc_clear_buffer jack_midi_clear_buffer
  78. #define jack_osc_max_event_size jack_midi_max_event_size
  79. #define jack_osc_event_reserve jack_midi_event_reserve
  80. #define jack_osc_event_write jack_midi_event_write
  81. #define jack_osc_get_lost_event_count jack_midi_get_lost_event_count
  82. #ifdef __cplusplus
  83. }
  84. #endif /* __cplusplus */
  85. #endif /* __JACK_OSC_H */