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.

69 lines
1.7KB

  1. /*
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; either version 2 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  13. */
  14. #include <stdio.h>
  15. #ifndef WIN32
  16. #include <unistd.h>
  17. #endif
  18. #include <stdlib.h>
  19. #include <string.h>
  20. #include <jack/jack.h>
  21. #define TRUE 1
  22. #define FALSE 0
  23. int
  24. main (int argc, char *argv[])
  25. {
  26. jack_client_t *client;
  27. char *my_name = strrchr(argv[0], '/');
  28. if (my_name == 0) {
  29. my_name = argv[0];
  30. } else {
  31. my_name ++;
  32. }
  33. if (argc != 2) {
  34. fprintf (stderr, "Usage: %s client\n", my_name);
  35. return 1;
  36. }
  37. if ((client = jack_client_open ("input monitoring", JackNullOption, NULL)) == 0) {
  38. fprintf (stderr, "JACK server not running?\n");
  39. return 1;
  40. }
  41. if (jack_port_request_monitor_by_name (client, argv[1], TRUE)) {
  42. fprintf (stderr, "could not enable monitoring for %s\n", argv[1]);
  43. jack_client_close (client);
  44. return 1;
  45. }
  46. #ifdef WIN32
  47. Sleep (30*1000);
  48. #else
  49. sleep (30);
  50. #endif
  51. if (jack_port_request_monitor_by_name (client, argv[1], FALSE)) {
  52. fprintf (stderr, "could not disable monitoring for %s\n", argv[1]);
  53. }
  54. jack_client_close (client);
  55. exit (0);
  56. }