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.

62 lines
1.6KB

  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. #include <unistd.h>
  16. #include <stdlib.h>
  17. #include <string.h>
  18. #include <jack/jack.h>
  19. #define TRUE 1
  20. #define FALSE 0
  21. int
  22. main (int argc, char *argv[])
  23. {
  24. jack_client_t *client;
  25. char *my_name = strrchr(argv[0], '/');
  26. if (my_name == 0) {
  27. my_name = argv[0];
  28. } else {
  29. my_name ++;
  30. }
  31. if (argc != 2) {
  32. fprintf (stderr, "Usage: %s client\n", my_name);
  33. return 1;
  34. }
  35. if ((client = jack_client_open ("input monitoring", JackNullOption, NULL)) == 0) {
  36. fprintf (stderr, "jack server not running?\n");
  37. return 1;
  38. }
  39. if (jack_port_request_monitor_by_name (client, argv[1], TRUE)) {
  40. fprintf (stderr, "could not enable monitoring for %s\n", argv[1]);
  41. jack_client_close (client);
  42. return 1;
  43. }
  44. sleep (30);
  45. if (jack_port_request_monitor_by_name (client, argv[1], FALSE)) {
  46. fprintf (stderr, "could not disable monitoring for %s\n", argv[1]);
  47. }
  48. jack_client_close (client);
  49. exit (0);
  50. }