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.

147 lines
4.1KB

  1. /*
  2. Copyright (C) 2003 Robert Ham <rah@bash.sh>
  3. Copyright (C) 2005 Torben Hohn <torbenh@gmx.de>
  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, or
  7. (at your option) any later version.
  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 __NETJACK_H__
  17. #define __NETJACK_H__
  18. #include <unistd.h>
  19. #include <jack/types.h>
  20. //#include <jack/driver.h>
  21. #include <jack/jack.h>
  22. #include <jack/transport.h>
  23. #include "jack/jslist.h"
  24. //#include <netinet/in.h>
  25. #ifdef __cplusplus
  26. extern "C"
  27. {
  28. #endif
  29. typedef struct _netjack_driver_state netjack_driver_state_t;
  30. struct _netjack_driver_state {
  31. jack_nframes_t net_period_up;
  32. jack_nframes_t net_period_down;
  33. jack_nframes_t sample_rate;
  34. jack_nframes_t bitdepth;
  35. jack_nframes_t period_size;
  36. jack_time_t period_usecs;
  37. int dont_htonl_floats;
  38. int always_deadline;
  39. jack_nframes_t codec_latency;
  40. unsigned int listen_port;
  41. unsigned int capture_channels;
  42. unsigned int playback_channels;
  43. unsigned int capture_channels_audio;
  44. unsigned int playback_channels_audio;
  45. unsigned int capture_channels_midi;
  46. unsigned int playback_channels_midi;
  47. JSList *capture_ports;
  48. JSList *playback_ports;
  49. JSList *playback_srcs;
  50. JSList *capture_srcs;
  51. jack_client_t *client;
  52. #ifdef WIN32
  53. SOCKET sockfd;
  54. SOCKET outsockfd;
  55. #else
  56. int sockfd;
  57. int outsockfd;
  58. #endif
  59. struct sockaddr_in syncsource_address;
  60. int reply_port;
  61. int srcaddress_valid;
  62. int sync_state;
  63. unsigned int handle_transport_sync;
  64. unsigned int *rx_buf;
  65. unsigned int rx_bufsize;
  66. //unsigned int tx_bufsize;
  67. unsigned int mtu;
  68. unsigned int latency;
  69. unsigned int redundancy;
  70. jack_nframes_t expected_framecnt;
  71. int expected_framecnt_valid;
  72. unsigned int num_lost_packets;
  73. jack_time_t next_deadline;
  74. jack_time_t deadline_offset;
  75. int next_deadline_valid;
  76. int packet_data_valid;
  77. int resync_threshold;
  78. int running_free;
  79. int deadline_goodness;
  80. jack_time_t time_to_deadline;
  81. unsigned int use_autoconfig;
  82. unsigned int resample_factor;
  83. unsigned int resample_factor_up;
  84. int jitter_val;
  85. };
  86. int netjack_wait( netjack_driver_state_t *netj );
  87. void netjack_send_silence( netjack_driver_state_t *netj, int syncstate );
  88. void netjack_read( netjack_driver_state_t *netj, jack_nframes_t nframes ) ;
  89. void netjack_write( netjack_driver_state_t *netj, jack_nframes_t nframes, int syncstate );
  90. void netjack_attach( netjack_driver_state_t *netj );
  91. void netjack_detach( netjack_driver_state_t *netj );
  92. netjack_driver_state_t *netjack_init (netjack_driver_state_t *netj,
  93. jack_client_t * client,
  94. const char *name,
  95. unsigned int capture_ports,
  96. unsigned int playback_ports,
  97. unsigned int capture_ports_midi,
  98. unsigned int playback_ports_midi,
  99. jack_nframes_t sample_rate,
  100. jack_nframes_t period_size,
  101. unsigned int listen_port,
  102. unsigned int transport_sync,
  103. unsigned int resample_factor,
  104. unsigned int resample_factor_up,
  105. unsigned int bitdepth,
  106. unsigned int use_autoconfig,
  107. unsigned int latency,
  108. unsigned int redundancy,
  109. int dont_htonl_floats,
  110. int always_deadline,
  111. int jitter_val );
  112. void netjack_release( netjack_driver_state_t *netj );
  113. int netjack_startup( netjack_driver_state_t *netj );
  114. #ifdef __cplusplus
  115. }
  116. #endif
  117. #endif