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.

153 lines
5.0KB

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