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.

157 lines
4.2KB

  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. #if HAVE_CELT
  25. #include <celt/celt.h>
  26. #endif
  27. //#include <netinet/in.h>
  28. #ifdef __cplusplus
  29. extern "C"
  30. {
  31. #endif
  32. struct _packet_cache;
  33. typedef struct _netjack_driver_state netjack_driver_state_t;
  34. struct _netjack_driver_state {
  35. jack_nframes_t net_period_up;
  36. jack_nframes_t net_period_down;
  37. jack_nframes_t sample_rate;
  38. jack_nframes_t bitdepth;
  39. jack_nframes_t period_size;
  40. jack_time_t period_usecs;
  41. int dont_htonl_floats;
  42. int always_deadline;
  43. jack_nframes_t codec_latency;
  44. unsigned int listen_port;
  45. unsigned int capture_channels;
  46. unsigned int playback_channels;
  47. unsigned int capture_channels_audio;
  48. unsigned int playback_channels_audio;
  49. unsigned int capture_channels_midi;
  50. unsigned int playback_channels_midi;
  51. JSList *capture_ports;
  52. JSList *playback_ports;
  53. JSList *playback_srcs;
  54. JSList *capture_srcs;
  55. jack_client_t *client;
  56. #ifdef WIN32
  57. SOCKET sockfd;
  58. SOCKET outsockfd;
  59. #else
  60. int sockfd;
  61. int outsockfd;
  62. #endif
  63. struct sockaddr_in syncsource_address;
  64. int reply_port;
  65. int srcaddress_valid;
  66. int sync_state;
  67. unsigned int handle_transport_sync;
  68. unsigned int *rx_buf;
  69. unsigned int rx_bufsize;
  70. //unsigned int tx_bufsize;
  71. unsigned int mtu;
  72. unsigned int latency;
  73. unsigned int redundancy;
  74. jack_nframes_t expected_framecnt;
  75. int expected_framecnt_valid;
  76. unsigned int num_lost_packets;
  77. jack_time_t next_deadline;
  78. jack_time_t deadline_offset;
  79. int next_deadline_valid;
  80. int packet_data_valid;
  81. int resync_threshold;
  82. int running_free;
  83. int deadline_goodness;
  84. jack_time_t time_to_deadline;
  85. unsigned int use_autoconfig;
  86. unsigned int resample_factor;
  87. unsigned int resample_factor_up;
  88. int jitter_val;
  89. struct _packet_cache * packcache;
  90. #if HAVE_CELT
  91. CELTMode *celt_mode;
  92. #endif
  93. };
  94. int netjack_wait( netjack_driver_state_t *netj );
  95. void netjack_send_silence( netjack_driver_state_t *netj, int syncstate );
  96. void netjack_read( netjack_driver_state_t *netj, jack_nframes_t nframes ) ;
  97. void netjack_write( netjack_driver_state_t *netj, jack_nframes_t nframes, int syncstate );
  98. void netjack_attach( netjack_driver_state_t *netj );
  99. void netjack_detach( netjack_driver_state_t *netj );
  100. netjack_driver_state_t *netjack_init (netjack_driver_state_t *netj,
  101. jack_client_t * client,
  102. const char *name,
  103. unsigned int capture_ports,
  104. unsigned int playback_ports,
  105. unsigned int capture_ports_midi,
  106. unsigned int playback_ports_midi,
  107. jack_nframes_t sample_rate,
  108. jack_nframes_t period_size,
  109. unsigned int listen_port,
  110. unsigned int transport_sync,
  111. unsigned int resample_factor,
  112. unsigned int resample_factor_up,
  113. unsigned int bitdepth,
  114. unsigned int use_autoconfig,
  115. unsigned int latency,
  116. unsigned int redundancy,
  117. int dont_htonl_floats,
  118. int always_deadline,
  119. int jitter_val );
  120. void netjack_release( netjack_driver_state_t *netj );
  121. int netjack_startup( netjack_driver_state_t *netj );
  122. #ifdef __cplusplus
  123. }
  124. #endif
  125. #endif