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.

211 lines
6.3KB

  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 <inttypes.h>
  19. typedef char shm_name_t[32];
  20. /**
  21. * Type used to represent sample frame counts.
  22. */
  23. typedef uint32_t jack_nframes_t;
  24. /**
  25. * Maximum value that can be stored in jack_nframes_t
  26. */
  27. #define JACK_MAX_FRAMES (4294967295U) /* This should be UINT32_MAX, but
  28. C++ has a problem with that. */
  29. /**
  30. * Type used to represent the value of free running
  31. * monotonic clock with units of microseconds.
  32. */
  33. /* JOQ: this is trouble. APPLE POWERPC should use a compatible
  34. * typedef, explicitly converting from double, if necessary.
  35. * Otherwise applications cannot safely print a jack_time_t. */
  36. #if defined(__APPLE__) && defined(__POWERPC__)
  37. typedef double jack_time_t;
  38. #else
  39. typedef uint64_t jack_time_t;
  40. #endif
  41. /**
  42. * jack_port_t is an opaque type. You may only access it using the
  43. * API provided.
  44. */
  45. typedef struct _jack_port jack_port_t;
  46. /**
  47. * jack_client_t is an opaque type. You may only access it using the
  48. * API provided.
  49. */
  50. typedef struct _jack_client jack_client_t;
  51. /**
  52. * Ports have unique ids. A port registration callback is the only
  53. * place you ever need to know their value.
  54. */
  55. typedef uint32_t jack_port_id_t;
  56. /**
  57. * Prototype for the client supplied function that is called
  58. * by the engine anytime there is work to be done.
  59. *
  60. * @pre nframes == jack_get_buffer_size()
  61. * @pre nframes == pow(2,x)
  62. *
  63. * @param nframes number of frames to process
  64. * @param arg pointer to a client supplied structure
  65. *
  66. * @return zero on success, non-zero on error
  67. */
  68. typedef int (*JackProcessCallback)(jack_nframes_t nframes, void *arg);
  69. /**
  70. * Prototype for the client supplied function that is called
  71. * whenever the processing graph is reordered.
  72. *
  73. * @param arg pointer to a client supplied structure
  74. *
  75. * @return zero on success, non-zero on error
  76. */
  77. typedef int (*JackGraphOrderCallback)(void *arg);
  78. /**
  79. * Prototype for the client supplied function that is called
  80. * whenever an xrun has occured.
  81. *
  82. * @param arg pointer to a client supplied structure
  83. *
  84. * @return zero on success, non-zero on error
  85. */
  86. typedef int (*JackXRunCallback)(void *arg);
  87. /**
  88. * Prototype for the @a bufsize_callback that is invoked whenever the
  89. * JACK engine buffer size changes. Although this function is called
  90. * in the JACK process thread, the normal process cycle is suspended
  91. * during its operation, causing a gap in the audio flow. So, the @a
  92. * bufsize_callback can allocate storage, touch memory not previously
  93. * referenced, and perform other operations that are not realtime
  94. * safe.
  95. *
  96. * @param nframes buffer size
  97. * @param arg pointer supplied by jack_set_buffer_size_callback().
  98. *
  99. * @return zero on success, non-zero on error
  100. */
  101. typedef int (*JackBufferSizeCallback)(jack_nframes_t nframes, void *arg);
  102. /**
  103. * Prototype for the client supplied function that is called
  104. * when the engine sample rate changes.
  105. *
  106. * @param nframes new engine sample rate
  107. * @param arg pointer to a client supplied structure
  108. *
  109. * @return zero on success, non-zero on error
  110. */
  111. typedef int (*JackSampleRateCallback)(jack_nframes_t nframes, void *arg);
  112. /**
  113. * Prototype for the client supplied function that is called
  114. * whenever a port is registered or unregistered.
  115. *
  116. * @param arg pointer to a client supplied structure
  117. */
  118. typedef void (*JackPortRegistrationCallback)(jack_port_id_t port, int, void *arg);
  119. /**
  120. * Used for the type argument of jack_port_register().
  121. */
  122. #define JACK_DEFAULT_AUDIO_TYPE "32 bit float mono audio"
  123. /**
  124. * For convenience, use this typedef if you want to be able to change
  125. * between float and double. You may want to typedef sample_t to
  126. * jack_default_audio_sample_t in your application.
  127. */
  128. typedef float jack_default_audio_sample_t;
  129. /**
  130. * A port has a set of flags that are formed by AND-ing together the
  131. * desired values from the list below. The flags "JackPortIsInput" and
  132. * "JackPortIsOutput" are mutually exclusive and it is an error to use
  133. * them both.
  134. */
  135. enum JackPortFlags {
  136. /**
  137. * if JackPortIsInput is set, then the port can receive
  138. * data.
  139. */
  140. JackPortIsInput = 0x1,
  141. /**
  142. * if JackPortIsOutput is set, then data can be read from
  143. * the port.
  144. */
  145. JackPortIsOutput = 0x2,
  146. /**
  147. * if JackPortIsPhysical is set, then the port corresponds
  148. * to some kind of physical I/O connector.
  149. */
  150. JackPortIsPhysical = 0x4,
  151. /**
  152. * if JackPortCanMonitor is set, then a call to
  153. * jack_port_request_monitor() makes sense.
  154. *
  155. * Precisely what this means is dependent on the client. A typical
  156. * result of it being called with TRUE as the second argument is
  157. * that data that would be available from an output port (with
  158. * JackPortIsPhysical set) is sent to a physical output connector
  159. * as well, so that it can be heard/seen/whatever.
  160. *
  161. * Clients that do not control physical interfaces
  162. * should never create ports with this bit set.
  163. */
  164. JackPortCanMonitor = 0x8,
  165. /**
  166. * JackPortIsTerminal means:
  167. *
  168. * for an input port: the data received by the port
  169. * will not be passed on or made
  170. * available at any other port
  171. *
  172. * for an output port: the data available at the port
  173. * does not originate from any other port
  174. *
  175. * Audio synthesizers, i/o h/w interface clients, HDR
  176. * systems are examples of things that would set this
  177. * flag for their ports.
  178. */
  179. JackPortIsTerminal = 0x10
  180. };
  181. #endif /* __jack_types_h__ */