jack2 codebase
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.

271 lines
7.3KB

  1. /*
  2. JACK control API
  3. Copyright (C) 2008 Nedko Arnaudov
  4. Copyright (C) 2008 Grame
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; version 2 of the License.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. */
  16. #ifndef __JackControlAPI__
  17. #define __JackControlAPI__
  18. #include "jslist.h"
  19. #include "JackCompilerDeps.h"
  20. /** Parameter types, intentionally similar to jack_driver_param_type_t */
  21. typedef enum
  22. {
  23. JackParamInt = 1, /**< @brief value type is a signed integer */
  24. JackParamUInt, /**< @brief value type is an unsigned integer */
  25. JackParamChar, /**< @brief value type is a char */
  26. JackParamString, /**< @brief value type is a string with max size of ::JACK_PARAM_STRING_MAX+1 chars */
  27. JackParamBool, /**< @brief value type is a boolean */
  28. } jackctl_param_type_t;
  29. /** Driver types, intentionally similar to jack_driver_type_t */
  30. typedef enum
  31. {
  32. JackMaster = 1, /**< @brief master driver */
  33. JackSlave, /**< @brief slave driver */
  34. } jackctl_driver_type_t;
  35. /** @brief Max value that jackctl_param_type_t type can have */
  36. #define JACK_PARAM_MAX (JackParamBool + 1)
  37. /** @brief Max length of string parameter value, excluding terminating nul char */
  38. #define JACK_PARAM_STRING_MAX 127
  39. /** @brief Type for parameter value */
  40. /* intentionally similar to jack_driver_param_value_t */
  41. union jackctl_parameter_value
  42. {
  43. uint32_t ui; /**< @brief member used for ::JackParamUInt */
  44. int32_t i; /**< @brief member used for ::JackParamInt */
  45. char c; /**< @brief member used for ::JackParamChar */
  46. char str[JACK_PARAM_STRING_MAX + 1]; /**< @brief member used for ::JackParamString */
  47. bool b; /**< @brief member used for ::JackParamBool */
  48. };
  49. /** opaque type for server object */
  50. typedef struct jackctl_server jackctl_server_t;
  51. /** opaque type for driver object */
  52. typedef struct jackctl_driver jackctl_driver_t;
  53. /** opaque type for internal client object */
  54. typedef struct jackctl_internal jackctl_internal_t;
  55. /** opaque type for parameter object */
  56. typedef struct jackctl_parameter jackctl_parameter_t;
  57. /** opaque type for sigmask object */
  58. typedef struct jackctl_sigmask jackctl_sigmask_t;
  59. #ifdef __cplusplus
  60. extern "C" {
  61. #endif
  62. #if 0
  63. } /* Adjust editor indent */
  64. #endif
  65. SERVER_EXPORT jackctl_sigmask_t *
  66. jackctl_setup_signals(
  67. unsigned int flags);
  68. SERVER_EXPORT void
  69. jackctl_wait_signals(
  70. jackctl_sigmask_t * signals);
  71. SERVER_EXPORT jackctl_server_t *
  72. jackctl_server_create(
  73. bool (* on_device_acquire)(const char * device_name),
  74. void (* on_device_release)(const char * device_name));
  75. SERVER_EXPORT jackctl_server_t *
  76. jackctl_server_create2(
  77. bool (* on_device_acquire)(const char * device_name),
  78. void (* on_device_release)(const char * device_name),
  79. void (* on_device_reservation_loop)(void));
  80. SERVER_EXPORT void
  81. jackctl_server_destroy(
  82. jackctl_server_t * server);
  83. SERVER_EXPORT const JSList *
  84. jackctl_server_get_drivers_list(
  85. jackctl_server_t * server);
  86. SERVER_EXPORT bool
  87. jackctl_server_open(
  88. jackctl_server_t * server,
  89. jackctl_driver_t * driver);
  90. SERVER_EXPORT bool
  91. jackctl_server_start(
  92. jackctl_server_t * server);
  93. SERVER_EXPORT bool
  94. jackctl_server_stop(
  95. jackctl_server_t * server);
  96. SERVER_EXPORT bool
  97. jackctl_server_close(
  98. jackctl_server_t * server);
  99. SERVER_EXPORT const JSList *
  100. jackctl_server_get_parameters(
  101. jackctl_server_t * server);
  102. SERVER_EXPORT const char *
  103. jackctl_driver_get_name(
  104. jackctl_driver_t * driver);
  105. SERVER_EXPORT jackctl_driver_type_t
  106. jackctl_driver_get_type(
  107. jackctl_driver_t * driver);
  108. SERVER_EXPORT const JSList *
  109. jackctl_driver_get_parameters(
  110. jackctl_driver_t * driver);
  111. SERVER_EXPORT const char *
  112. jackctl_parameter_get_name(
  113. jackctl_parameter_t * parameter);
  114. SERVER_EXPORT const char *
  115. jackctl_parameter_get_short_description(
  116. jackctl_parameter_t * parameter);
  117. SERVER_EXPORT const char *
  118. jackctl_parameter_get_long_description(
  119. jackctl_parameter_t * parameter);
  120. SERVER_EXPORT jackctl_param_type_t
  121. jackctl_parameter_get_type(
  122. jackctl_parameter_t * parameter);
  123. SERVER_EXPORT char
  124. jackctl_parameter_get_id(
  125. jackctl_parameter_t * parameter);
  126. SERVER_EXPORT bool
  127. jackctl_parameter_is_set(
  128. jackctl_parameter_t * parameter);
  129. SERVER_EXPORT bool
  130. jackctl_parameter_reset(
  131. jackctl_parameter_t * parameter);
  132. SERVER_EXPORT union jackctl_parameter_value
  133. jackctl_parameter_get_value(
  134. jackctl_parameter_t * parameter);
  135. SERVER_EXPORT bool
  136. jackctl_parameter_set_value(
  137. jackctl_parameter_t * parameter,
  138. const union jackctl_parameter_value * value_ptr);
  139. SERVER_EXPORT union jackctl_parameter_value
  140. jackctl_parameter_get_default_value(
  141. jackctl_parameter_t * parameter);
  142. SERVER_EXPORT union jackctl_parameter_value
  143. jackctl_parameter_get_default_value(
  144. jackctl_parameter *parameter_ptr);
  145. SERVER_EXPORT bool
  146. jackctl_parameter_has_range_constraint(
  147. jackctl_parameter_t * parameter_ptr);
  148. SERVER_EXPORT bool
  149. jackctl_parameter_has_enum_constraint(
  150. jackctl_parameter_t * parameter_ptr);
  151. SERVER_EXPORT uint32_t
  152. jackctl_parameter_get_enum_constraints_count(
  153. jackctl_parameter_t * parameter_ptr);
  154. SERVER_EXPORT union jackctl_parameter_value
  155. jackctl_parameter_get_enum_constraint_value(
  156. jackctl_parameter_t * parameter_ptr,
  157. uint32_t index);
  158. SERVER_EXPORT const char *
  159. jackctl_parameter_get_enum_constraint_description(
  160. jackctl_parameter_t * parameter_ptr,
  161. uint32_t index);
  162. SERVER_EXPORT void
  163. jackctl_parameter_get_range_constraint(
  164. jackctl_parameter_t * parameter_ptr,
  165. union jackctl_parameter_value * min_ptr,
  166. union jackctl_parameter_value * max_ptr);
  167. SERVER_EXPORT bool
  168. jackctl_parameter_constraint_is_strict(
  169. jackctl_parameter_t * parameter_ptr);
  170. SERVER_EXPORT bool
  171. jackctl_parameter_constraint_is_fake_value(
  172. jackctl_parameter_t * parameter_ptr);
  173. SERVER_EXPORT const JSList *
  174. jackctl_server_get_internals_list(
  175. jackctl_server *server_ptr);
  176. SERVER_EXPORT const char *
  177. jackctl_internal_get_name(
  178. jackctl_internal *internal_ptr);
  179. SERVER_EXPORT const JSList *
  180. jackctl_internal_get_parameters(
  181. jackctl_internal *internal_ptr);
  182. SERVER_EXPORT bool jackctl_server_load_internal(
  183. jackctl_server * server,
  184. jackctl_internal * internal);
  185. SERVER_EXPORT bool jackctl_server_unload_internal(
  186. jackctl_server * server,
  187. jackctl_internal * internal);
  188. SERVER_EXPORT bool jackctl_server_load_session_file(
  189. jackctl_server * server_ptr,
  190. const char * file);
  191. SERVER_EXPORT bool jackctl_server_add_slave(jackctl_server_t * server,
  192. jackctl_driver_t * driver);
  193. SERVER_EXPORT bool jackctl_server_remove_slave(jackctl_server_t * server,
  194. jackctl_driver_t * driver);
  195. SERVER_EXPORT bool
  196. jackctl_server_switch_master(jackctl_server_t * server,
  197. jackctl_driver_t * driver);
  198. SERVER_EXPORT int
  199. jackctl_parse_driver_params(jackctl_driver * driver_ptr, int argc, char* argv[]);
  200. #if 0
  201. { /* Adjust editor indent */
  202. #endif
  203. #ifdef __cplusplus
  204. } /* extern "C" */
  205. #endif
  206. #endif