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.

212 lines
6.4KB

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