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.

112 lines
3.9KB

  1. /* -*- Mode: C ; c-basic-offset: 4 -*- */
  2. /*
  3. Copyright (C) 2011 Nedko Arnaudov
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. */
  15. #ifndef PARAMS_H__A23EDE06_C1C9_4489_B253_FD1B26B66929__INCLUDED
  16. #define PARAMS_H__A23EDE06_C1C9_4489_B253_FD1B26B66929__INCLUDED
  17. #include "jack/control.h"
  18. #include "list.h"
  19. #define PARAM_ADDRESS_SIZE 3
  20. #define PTNODE_ENGINE "engine"
  21. #define PTNODE_DRIVER "driver"
  22. #define PTNODE_DRIVERS "drivers"
  23. #define PTNODE_INTERNALS "internals"
  24. struct jack_parameter_vtable
  25. {
  26. bool (* is_set)(void * obj);
  27. bool (* reset)(void * obj);
  28. union jackctl_parameter_value (* get_value)(void * obj);
  29. bool (* set_value)(void * obj, const union jackctl_parameter_value * value_ptr);
  30. union jackctl_parameter_value (* get_default_value)(void * obj);
  31. };
  32. #define JACK_CONSTRAINT_FLAG_VALID ((uint32_t)1) /**< if not set, there is no constraint */
  33. #define JACK_CONSTRAINT_FLAG_STRICT ((uint32_t)2) /**< if set, constraint is strict, i.e. supplying non-matching value will not work */
  34. #define JACK_CONSTRAINT_FLAG_FAKE_VALUE ((uint32_t)4) /**< if set, values have no user meaningful meaning */
  35. struct jack_parameter_enum
  36. {
  37. union jackctl_parameter_value value;
  38. const char * short_desc;
  39. };
  40. struct jack_parameter
  41. {
  42. void * obj;
  43. struct jack_parameter_vtable vtable;
  44. struct list_head siblings;
  45. bool ext;
  46. jackctl_param_type_t type;
  47. const char * name;
  48. const char * short_decr;
  49. const char * long_descr;
  50. uint32_t constraint_flags; /**< JACK_CONSTRAINT_FLAG_XXX */
  51. bool constraint_range; /**< if true, constraint is a range (min-max), otherwise it is an enumeration */
  52. union
  53. {
  54. struct
  55. {
  56. union jackctl_parameter_value min;
  57. union jackctl_parameter_value max;
  58. } range; /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is set */
  59. struct
  60. {
  61. uint32_t count;
  62. struct jack_parameter_enum * possible_values_array;
  63. } enumeration; /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is not set */
  64. } constraint;
  65. };
  66. typedef struct _jack_params { int unused; } * jack_params_handle;
  67. jack_params_handle jack_params_create(jackctl_server_t * server);
  68. void jack_params_destroy(jack_params_handle params);
  69. bool jack_params_set_driver(jack_params_handle params, const char * name);
  70. jackctl_driver_t * jack_params_get_driver(jack_params_handle params);
  71. bool jack_params_check_address(jack_params_handle params, const char * const * address, bool want_leaf);
  72. bool jack_params_is_leaf_container(jack_params_handle params, const char * const * address);
  73. bool
  74. jack_params_iterate_container(
  75. jack_params_handle params,
  76. const char * const * address,
  77. bool (* callback)(void * context, const char * name),
  78. void * context);
  79. bool
  80. jack_params_iterate_params(
  81. jack_params_handle params,
  82. const char * const * address,
  83. bool (* callback)(void * context, const struct jack_parameter * param_ptr),
  84. void * context);
  85. const struct jack_parameter * jack_params_get_parameter(jack_params_handle params, const char * const * address);
  86. void jack_params_add_parameter(jack_params_handle params, const char * const * address, bool end, struct jack_parameter * param_ptr);
  87. #endif /* #ifndef PARAMS_H__A23EDE06_C1C9_4489_B253_FD1B26B66929__INCLUDED */