jack1 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.

196 lines
5.7KB

  1. /*
  2. Copyright (C) 2001 Paul Davis
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU Lesser General Public License as published by
  5. the Free Software Foundation; either version 2.1 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. $Id$
  15. */
  16. #ifndef __jack_types_h__
  17. #define __jack_types_h__
  18. #include <limits.h> /* ULONG_MAX */
  19. /**
  20. * Type used to represent sample frame counts.
  21. */
  22. typedef unsigned long jack_nframes_t;
  23. /**
  24. * Maximum value that can be stored in jack_nframes_t
  25. */
  26. #define JACK_MAX_FRAMES ULONG_MAX;
  27. /**
  28. * Type used to represent the value of free running
  29. * monotonic clock with units of microseconds.
  30. */
  31. typedef unsigned long long jack_time_t;
  32. /**
  33. * jack_port_t is an opaque type. You may only access it using the API provided.
  34. */
  35. typedef struct _jack_port jack_port_t;
  36. /**
  37. * jack_client_t is an opaque type. You may only access it using the API provided.
  38. */
  39. typedef struct _jack_client jack_client_t;
  40. /**
  41. * Ports have unique ids. A port registration callback is the only
  42. * place you ever need to know their value.
  43. */
  44. typedef unsigned long jack_port_id_t;
  45. /**
  46. * Prototype for the client supplied function that is called
  47. * by the engine anytime there is work to be done.
  48. *
  49. * @pre nframes == jack_get_buffer_size()
  50. * @pre nframes == pow(2,x)
  51. *
  52. * @param nframes number of frames to process
  53. * @param arg pointer to a client supplied structure
  54. *
  55. * @return zero on success, non-zero on error
  56. */
  57. typedef int (*JackProcessCallback)(jack_nframes_t nframes, void *arg);
  58. /**
  59. * Prototype for the client supplied function that is called
  60. * whenever the processing graph is reordered.
  61. *
  62. * @param arg pointer to a client supplied structure
  63. *
  64. * @return zero on success, non-zero on error
  65. */
  66. typedef int (*JackGraphOrderCallback)(void *arg);
  67. /**
  68. * Prototype for the client supplied function that is called
  69. * whenever an xrun has occured.
  70. *
  71. * @param arg pointer to a client supplied structure
  72. *
  73. * @return zero on success, non-zero on error
  74. */
  75. typedef int (*JackXRunCallback)(void *arg);
  76. /**
  77. * Prototype for the client supplied function that is called
  78. * when the engine buffersize changes.
  79. *
  80. * Note! Use of this callback function is deprecated!
  81. *
  82. * @param nframes new engine buffer size
  83. * @param arg pointer to a client supplied structure
  84. *
  85. * @return zero on success, non-zero on error
  86. */
  87. typedef int (*JackBufferSizeCallback)(jack_nframes_t nframes, void *arg);
  88. /**
  89. * Prototype for the client supplied function that is called
  90. * when the engine sample rate changes.
  91. *
  92. * @param nframes new engine sample rate
  93. * @param arg pointer to a client supplied structure
  94. *
  95. * @return zero on success, non-zero on error
  96. */
  97. typedef int (*JackSampleRateCallback)(jack_nframes_t nframes, void *arg);
  98. /**
  99. * Prototype for the client supplied function that is called
  100. * whenever a port is registered or unregistered.
  101. *
  102. * @param arg pointer to a client supplied structure
  103. */
  104. typedef void (*JackPortRegistrationCallback)(jack_port_id_t port, int, void *arg);
  105. /**
  106. * Used for the type argument of jack_port_register().
  107. */
  108. #define JACK_DEFAULT_AUDIO_TYPE "32 bit float mono audio"
  109. /**
  110. * For convenience, use this typedef if you want to be able to change
  111. * between float and double. You may want to typedef sample_t to
  112. * jack_default_audio_sample_t in your application.
  113. */
  114. typedef float jack_default_audio_sample_t;
  115. /**
  116. * A port has a set of flags that are formed by AND-ing together the
  117. * desired values from the list below. The flags "JackPortIsInput" and
  118. * "JackPortIsOutput" are mutually exclusive and it is an error to use
  119. * them both.
  120. */
  121. enum JackPortFlags {
  122. /**
  123. * if JackPortIsInput is set, then the port can receive
  124. * data.
  125. */
  126. JackPortIsInput = 0x1,
  127. /**
  128. * if JackPortIsOutput is set, then data can be read from
  129. * the port.
  130. */
  131. JackPortIsOutput = 0x2,
  132. /**
  133. * if JackPortIsPhysical is set, then the port corresponds
  134. * to some kind of physical I/O connector.
  135. */
  136. JackPortIsPhysical = 0x4,
  137. /**
  138. * if JackPortCanMonitor is set, then a call to
  139. * jack_port_request_monitor() makes sense.
  140. *
  141. * Precisely what this means is dependent on the client. A typical
  142. * result of it being called with TRUE as the second argument is
  143. * that data that would be available from an output port (with
  144. * JackPortIsPhysical set) is sent to a physical output connector
  145. * as well, so that it can be heard/seen/whatever.
  146. *
  147. * Clients that do not control physical interfaces
  148. * should never create ports with this bit set.
  149. */
  150. JackPortCanMonitor = 0x8,
  151. /**
  152. * JackPortIsTerminal means:
  153. *
  154. * for an input port: the data received by the port
  155. * will not be passed on or made
  156. * available at any other port
  157. *
  158. * for an output port: the data available at the port
  159. * does not originate from any other port
  160. *
  161. * Audio synthesizers, i/o h/w interface clients, HDR
  162. * systems are examples of things that would set this
  163. * flag for their ports.
  164. */
  165. JackPortIsTerminal = 0x10
  166. };
  167. #endif /* __jack_types_h__ */