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.

119 lines
3.7KB

  1. /*
  2. Copyright (C) 2008 Grame
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  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. #include <stdio.h>
  16. #include <errno.h>
  17. #include <unistd.h>
  18. #include <stdlib.h>
  19. #include <string.h>
  20. #include <getopt.h>
  21. #include <jack/jack.h>
  22. #include <jack/control.h>
  23. jackctl_server_t * server;
  24. static void print_value(union jackctl_parameter_value value, jackctl_param_type_t type)
  25. {
  26. switch (type) {
  27. case JackParamInt:
  28. printf("parameter value = %d\n", value.i);
  29. break;
  30. case JackParamUInt:
  31. printf("parameter value = %u\n", value.ui);
  32. break;
  33. case JackParamChar:
  34. printf("parameter value = %c\n", value.c);
  35. break;
  36. case JackParamString:
  37. printf("parameter value = %s\n", value.str);
  38. break;
  39. case JackParamBool:
  40. printf("parameter value = %d\n", value.b);
  41. break;
  42. }
  43. }
  44. static void print_parameters(const JSList * node_ptr)
  45. {
  46. while (node_ptr != NULL) {
  47. jackctl_parameter_t * parameter = (jackctl_parameter_t *)node_ptr->data;
  48. printf("\nparameter name = %s\n", jackctl_parameter_get_name(parameter));
  49. printf("parameter id = %c\n", jackctl_parameter_get_id(parameter));
  50. printf("parameter short decs = %s\n", jackctl_parameter_get_short_description(parameter));
  51. printf("parameter long decs = %s\n", jackctl_parameter_get_long_description(parameter));
  52. print_value(jackctl_parameter_get_default_value(parameter), jackctl_parameter_get_type(parameter));
  53. node_ptr = jack_slist_next(node_ptr);
  54. }
  55. }
  56. static void print_driver(jackctl_driver_t * driver)
  57. {
  58. printf("\n--------------------------\n");
  59. printf("driver = %s\n", jackctl_driver_get_name(driver));
  60. printf("-------------------------- \n");
  61. print_parameters(jackctl_driver_get_parameters(driver));
  62. }
  63. static void print_internal(jackctl_internal_t * internal)
  64. {
  65. printf("\n-------------------------- \n");
  66. printf("internal = %s\n", jackctl_internal_get_name(internal));
  67. printf("-------------------------- \n");
  68. print_parameters(jackctl_internal_get_parameters(internal));
  69. }
  70. int main(int argc, char *argv[])
  71. {
  72. const JSList * drivers;
  73. const JSList * internals;
  74. const JSList * node_ptr;
  75. server = jackctl_server_create();
  76. printf("\n========================== \n");
  77. printf("List of drivers \n");
  78. printf("========================== \n");
  79. drivers = jackctl_server_get_drivers_list(server);
  80. node_ptr = drivers;
  81. while (node_ptr != NULL) {
  82. print_driver((jackctl_driver_t *)node_ptr->data);
  83. node_ptr = jack_slist_next(node_ptr);
  84. }
  85. printf("\n========================== \n");
  86. printf("List of internal clients \n");
  87. printf("========================== \n");
  88. internals = jackctl_server_get_internals_list(server);
  89. node_ptr = internals;
  90. while (node_ptr != NULL) {
  91. print_internal((jackctl_internal_t *)node_ptr->data);
  92. node_ptr = jack_slist_next(node_ptr);
  93. }
  94. jackctl_server_destroy(server);
  95. return 0;
  96. }