1 module pulse.def;
2 
3 import core.sys.posix.sys.select;
4 
5 import pulse.sample;
6 
7 extern (C):
8 
9 /***
10   This file is part of PulseAudio.
11 
12   Copyright 2004-2006 Lennart Poettering
13   Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
14 
15   PulseAudio is free software; you can redistribute it and/or modify
16   it under the terms of the GNU Lesser General Public License as
17   published by the Free Software Foundation; either version 2.1 of the
18   License, or (at your option) any later version.
19 
20   PulseAudio is distributed in the hope that it will be useful, but
21   WITHOUT ANY WARRANTY; without even the implied warranty of
22   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23   Lesser General Public License for more details.
24 
25   You should have received a copy of the GNU Lesser General Public
26   License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
27 ***/
28 
29 /** \file
30  * Global definitions */
31 
32 /** The state of a connection context */
33 enum pa_context_state
34 {
35     PA_CONTEXT_UNCONNECTED = 0, /**< The context hasn't been connected yet */
36     PA_CONTEXT_CONNECTING = 1, /**< A connection is being established */
37     PA_CONTEXT_AUTHORIZING = 2, /**< The client is authorizing itself to the daemon */
38     PA_CONTEXT_SETTING_NAME = 3, /**< The client is passing its application name to the daemon */
39     PA_CONTEXT_READY = 4, /**< The connection is established, the context is ready to execute operations */
40     PA_CONTEXT_FAILED = 5, /**< The connection failed or was disconnected */
41     PA_CONTEXT_TERMINATED = 6 /**< The connection was terminated cleanly */
42 }
43 
44 alias pa_context_state_t = pa_context_state;
45 
46 /** Return non-zero if the passed state is one of the connected states. \since 0.9.11 */
47 int PA_CONTEXT_IS_GOOD (pa_context_state_t x);
48 
49 /** \cond fulldocs */
50 enum PA_CONTEXT_UNCONNECTED = pa_context_state_t.PA_CONTEXT_UNCONNECTED;
51 enum PA_CONTEXT_CONNECTING = pa_context_state_t.PA_CONTEXT_CONNECTING;
52 enum PA_CONTEXT_AUTHORIZING = pa_context_state_t.PA_CONTEXT_AUTHORIZING;
53 enum PA_CONTEXT_SETTING_NAME = pa_context_state_t.PA_CONTEXT_SETTING_NAME;
54 enum PA_CONTEXT_READY = pa_context_state_t.PA_CONTEXT_READY;
55 enum PA_CONTEXT_FAILED = pa_context_state_t.PA_CONTEXT_FAILED;
56 enum PA_CONTEXT_TERMINATED = pa_context_state_t.PA_CONTEXT_TERMINATED;
57 // enum PA_CONTEXT_IS_GOOD = PA_CONTEXT_IS_GOOD;
58 /** \endcond */
59 
60 /** The state of a stream */
61 enum pa_stream_state
62 {
63     PA_STREAM_UNCONNECTED = 0, /**< The stream is not yet connected to any sink or source */
64     PA_STREAM_CREATING = 1, /**< The stream is being created */
65     PA_STREAM_READY = 2, /**< The stream is established, you may pass audio data to it now */
66     PA_STREAM_FAILED = 3, /**< An error occurred that made the stream invalid */
67     PA_STREAM_TERMINATED = 4 /**< The stream has been terminated cleanly */
68 }
69 
70 alias pa_stream_state_t = pa_stream_state;
71 
72 /** Return non-zero if the passed state is one of the connected states. \since 0.9.11 */
73 int PA_STREAM_IS_GOOD (pa_stream_state_t x);
74 
75 /** \cond fulldocs */
76 enum PA_STREAM_UNCONNECTED = pa_stream_state_t.PA_STREAM_UNCONNECTED;
77 enum PA_STREAM_CREATING = pa_stream_state_t.PA_STREAM_CREATING;
78 enum PA_STREAM_READY = pa_stream_state_t.PA_STREAM_READY;
79 enum PA_STREAM_FAILED = pa_stream_state_t.PA_STREAM_FAILED;
80 enum PA_STREAM_TERMINATED = pa_stream_state_t.PA_STREAM_TERMINATED;
81 // enum PA_STREAM_IS_GOOD = PA_STREAM_IS_GOOD;
82 /** \endcond */
83 
84 /** The state of an operation */
85 enum pa_operation_state
86 {
87     PA_OPERATION_RUNNING = 0,
88     /**< The operation is still running */
89     PA_OPERATION_DONE = 1,
90     /**< The operation has completed */
91     PA_OPERATION_CANCELLED = 2
92     /**< The operation has been cancelled. Operations may get cancelled by the
93      * application, or as a result of the context getting disconnected while the
94      * operation is pending. */
95 }
96 
97 alias pa_operation_state_t = pa_operation_state;
98 
99 /** \cond fulldocs */
100 enum PA_OPERATION_RUNNING = pa_operation_state_t.PA_OPERATION_RUNNING;
101 enum PA_OPERATION_DONE = pa_operation_state_t.PA_OPERATION_DONE;
102 enum PA_OPERATION_CANCELED = pa_operation_state_t.PA_OPERATION_CANCELLED;
103 enum PA_OPERATION_CANCELLED = pa_operation_state_t.PA_OPERATION_CANCELLED;
104 /** \endcond */
105 
106 /** An invalid index */
107 enum PA_INVALID_INDEX = cast(uint) -1;
108 
109 /** Some special flags for contexts. */
110 enum pa_context_flags
111 {
112     PA_CONTEXT_NOFLAGS = 0x0000U,
113     /**< Flag to pass when no specific options are needed (used to avoid casting)  \since 0.9.19 */
114     PA_CONTEXT_NOAUTOSPAWN = 0x0001U,
115     /**< Disabled autospawning of the PulseAudio daemon if required */
116     PA_CONTEXT_NOFAIL = 0x0002U
117     /**< Don't fail if the daemon is not available when pa_context_connect() is
118      * called, instead enter PA_CONTEXT_CONNECTING state and wait for the daemon
119      * to appear.  \since 0.9.15 */
120 }
121 
122 alias pa_context_flags_t = pa_context_flags;
123 
124 /** \cond fulldocs */
125 /* Allow clients to check with #ifdef for those flags */
126 enum PA_CONTEXT_NOAUTOSPAWN = pa_context_flags_t.PA_CONTEXT_NOAUTOSPAWN;
127 enum PA_CONTEXT_NOFAIL = pa_context_flags_t.PA_CONTEXT_NOFAIL;
128 /** \endcond */
129 
130 /** Direction bitfield - while we currently do not expose anything bidirectional,
131   one should test against the bit instead of the value (e.g.\ if (d & PA_DIRECTION_OUTPUT)),
132   because we might add bidirectional stuff in the future. \since 2.0
133 */
134 enum pa_direction
135 {
136     PA_DIRECTION_OUTPUT = 0x0001U, /**< Output direction */
137     PA_DIRECTION_INPUT = 0x0002U /**< Input direction */
138 }
139 
140 alias pa_direction_t = pa_direction;
141 
142 /** \cond fulldocs */
143 enum PA_DIRECTION_OUTPUT = pa_direction_t.PA_DIRECTION_OUTPUT;
144 enum PA_DIRECTION_INPUT = pa_direction_t.PA_DIRECTION_INPUT;
145 /** \endcond */
146 
147 /** The type of device we are dealing with */
148 enum pa_device_type
149 {
150     PA_DEVICE_TYPE_SINK = 0, /**< Playback device */
151     PA_DEVICE_TYPE_SOURCE = 1 /**< Recording device */
152 }
153 
154 alias pa_device_type_t = pa_device_type;
155 
156 /** \cond fulldocs */
157 enum PA_DEVICE_TYPE_SINK = pa_device_type_t.PA_DEVICE_TYPE_SINK;
158 enum PA_DEVICE_TYPE_SOURCE = pa_device_type_t.PA_DEVICE_TYPE_SOURCE;
159 /** \endcond */
160 
161 /** The direction of a pa_stream object */
162 enum pa_stream_direction
163 {
164     PA_STREAM_NODIRECTION = 0, /**< Invalid direction */
165     PA_STREAM_PLAYBACK = 1, /**< Playback stream */
166     PA_STREAM_RECORD = 2, /**< Record stream */
167     PA_STREAM_UPLOAD = 3 /**< Sample upload stream */
168 }
169 
170 alias pa_stream_direction_t = pa_stream_direction;
171 
172 /** \cond fulldocs */
173 enum PA_STREAM_NODIRECTION = pa_stream_direction_t.PA_STREAM_NODIRECTION;
174 enum PA_STREAM_PLAYBACK = pa_stream_direction_t.PA_STREAM_PLAYBACK;
175 enum PA_STREAM_RECORD = pa_stream_direction_t.PA_STREAM_RECORD;
176 enum PA_STREAM_UPLOAD = pa_stream_direction_t.PA_STREAM_UPLOAD;
177 /** \endcond */
178 
179 /** Some special flags for stream connections. */
180 enum pa_stream_flags
181 {
182     PA_STREAM_NOFLAGS = 0x0000U,
183     /**< Flag to pass when no specific options are needed (used to avoid casting)  \since 0.9.19 */
184 
185     PA_STREAM_START_CORKED = 0x0001U,
186     /**< Create the stream corked, requiring an explicit
187      * pa_stream_cork() call to uncork it. */
188 
189     PA_STREAM_INTERPOLATE_TIMING = 0x0002U,
190     /**< Interpolate the latency for this stream. When enabled,
191      * pa_stream_get_latency() and pa_stream_get_time() will try to
192      * estimate the current record/playback time based on the local
193      * time that passed since the last timing info update.  Using this
194      * option has the advantage of not requiring a whole roundtrip
195      * when the current playback/recording time is needed. Consider
196      * using this option when requesting latency information
197      * frequently. This is especially useful on long latency network
198      * connections. It makes a lot of sense to combine this option
199      * with PA_STREAM_AUTO_TIMING_UPDATE. */
200 
201     PA_STREAM_NOT_MONOTONIC = 0x0004U,
202     /**< Don't force the time to increase monotonically. If this
203      * option is enabled, pa_stream_get_time() will not necessarily
204      * return always monotonically increasing time values on each
205      * call. This may confuse applications which cannot deal with time
206      * going 'backwards', but has the advantage that bad transport
207      * latency estimations that caused the time to jump ahead can
208      * be corrected quickly, without the need to wait. (Please note
209      * that this flag was named PA_STREAM_NOT_MONOTONOUS in releases
210      * prior to 0.9.11. The old name is still defined too, for
211      * compatibility reasons. */
212 
213     PA_STREAM_AUTO_TIMING_UPDATE = 0x0008U,
214     /**< If set timing update requests are issued periodically
215      * automatically. Combined with PA_STREAM_INTERPOLATE_TIMING you
216      * will be able to query the current time and latency with
217      * pa_stream_get_time() and pa_stream_get_latency() at all times
218      * without a packet round trip.*/
219 
220     PA_STREAM_NO_REMAP_CHANNELS = 0x0010U,
221     /**< Don't remap channels by their name, instead map them simply
222      * by their index. Implies PA_STREAM_NO_REMIX_CHANNELS. Only
223      * supported when the server is at least PA 0.9.8. It is ignored
224      * on older servers.\since 0.9.8 */
225 
226     PA_STREAM_NO_REMIX_CHANNELS = 0x0020U,
227     /**< When remapping channels by name, don't upmix or downmix them
228      * to related channels. Copy them into matching channels of the
229      * device 1:1. Only supported when the server is at least PA
230      * 0.9.8. It is ignored on older servers. \since 0.9.8 */
231 
232     PA_STREAM_FIX_FORMAT = 0x0040U,
233     /**< Use the sample format of the sink/device this stream is being
234      * connected to, and possibly ignore the format the sample spec
235      * contains -- but you still have to pass a valid value in it as a
236      * hint to PulseAudio what would suit your stream best. If this is
237      * used you should query the used sample format after creating the
238      * stream by using pa_stream_get_sample_spec(). Also, if you
239      * specified manual buffer metrics it is recommended to update
240      * them with pa_stream_set_buffer_attr() to compensate for the
241      * changed frame sizes. Only supported when the server is at least
242      * PA 0.9.8. It is ignored on older servers.
243      *
244      * When creating streams with pa_stream_new_extended(), this flag has no
245      * effect. If you specify a format with PCM encoding, and you want the
246      * server to choose the sample format, then you should leave the sample
247      * format unspecified in the pa_format_info object. This also means that
248      * you can't use pa_format_info_from_sample_spec(), because that function
249      * always sets the sample format.
250      *
251      * \since 0.9.8 */
252 
253     PA_STREAM_FIX_RATE = 0x0080U,
254     /**< Use the sample rate of the sink, and possibly ignore the rate
255      * the sample spec contains. Usage similar to
256      * PA_STREAM_FIX_FORMAT. Only supported when the server is at least
257      * PA 0.9.8. It is ignored on older servers.
258      *
259      * When creating streams with pa_stream_new_extended(), this flag has no
260      * effect. If you specify a format with PCM encoding, and you want the
261      * server to choose the sample rate, then you should leave the rate
262      * unspecified in the pa_format_info object. This also means that you can't
263      * use pa_format_info_from_sample_spec(), because that function always sets
264      * the sample rate.
265      *
266      * \since 0.9.8 */
267 
268     PA_STREAM_FIX_CHANNELS = 0x0100,
269     /**< Use the number of channels and the channel map of the sink,
270      * and possibly ignore the number of channels and the map the
271      * sample spec and the passed channel map contain. Usage similar
272      * to PA_STREAM_FIX_FORMAT. Only supported when the server is at
273      * least PA 0.9.8. It is ignored on older servers.
274      *
275      * When creating streams with pa_stream_new_extended(), this flag has no
276      * effect. If you specify a format with PCM encoding, and you want the
277      * server to choose the channel count and/or channel map, then you should
278      * leave the channels and/or the channel map unspecified in the
279      * pa_format_info object. This also means that you can't use
280      * pa_format_info_from_sample_spec(), because that function always sets
281      * the channel count (but if you only want to leave the channel map
282      * unspecified, then pa_format_info_from_sample_spec() works, because it
283      * accepts a NULL channel map).
284      *
285      * \since 0.9.8 */
286 
287     PA_STREAM_DONT_MOVE = 0x0200U,
288     /**< Don't allow moving of this stream to another
289      * sink/device. Useful if you use any of the PA_STREAM_FIX_ flags
290      * and want to make sure that resampling never takes place --
291      * which might happen if the stream is moved to another
292      * sink/source with a different sample spec/channel map. Only
293      * supported when the server is at least PA 0.9.8. It is ignored
294      * on older servers. \since 0.9.8 */
295 
296     PA_STREAM_VARIABLE_RATE = 0x0400U,
297     /**< Allow dynamic changing of the sampling rate during playback
298      * with pa_stream_update_sample_rate(). Only supported when the
299      * server is at least PA 0.9.8. It is ignored on older
300      * servers. \since 0.9.8 */
301 
302     PA_STREAM_PEAK_DETECT = 0x0800U,
303     /**< Find peaks instead of resampling. \since 0.9.11 */
304 
305     PA_STREAM_START_MUTED = 0x1000U,
306     /**< Create in muted state. If neither PA_STREAM_START_UNMUTED nor
307      * PA_STREAM_START_MUTED are set, it is left to the server to decide
308      * whether to create the stream in muted or in unmuted
309      * state. \since 0.9.11 */
310 
311     PA_STREAM_ADJUST_LATENCY = 0x2000U,
312     /**< Try to adjust the latency of the sink/source based on the
313      * requested buffer metrics and adjust buffer metrics
314      * accordingly. Also see pa_buffer_attr. This option may not be
315      * specified at the same time as PA_STREAM_EARLY_REQUESTS. \since
316      * 0.9.11 */
317 
318     PA_STREAM_EARLY_REQUESTS = 0x4000U,
319     /**< Enable compatibility mode for legacy clients that rely on a
320      * "classic" hardware device fragment-style playback model. If
321      * this option is set, the minreq value of the buffer metrics gets
322      * a new meaning: instead of just specifying that no requests
323      * asking for less new data than this value will be made to the
324      * client it will also guarantee that requests are generated as
325      * early as this limit is reached. This flag should only be set in
326      * very few situations where compatibility with a fragment-based
327      * playback model needs to be kept and the client applications
328      * cannot deal with data requests that are delayed to the latest
329      * moment possible. (Usually these are programs that use usleep()
330      * or a similar call in their playback loops instead of sleeping
331      * on the device itself.) Also see pa_buffer_attr. This option may
332      * not be specified at the same time as
333      * PA_STREAM_ADJUST_LATENCY. \since 0.9.12 */
334 
335     PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND = 0x8000U,
336     /**< If set this stream won't be taken into account when it is
337      * checked whether the device this stream is connected to should
338      * auto-suspend. \since 0.9.15 */
339 
340     PA_STREAM_START_UNMUTED = 0x10000U,
341     /**< Create in unmuted state. If neither PA_STREAM_START_UNMUTED
342      * nor PA_STREAM_START_MUTED are set it is left to the server to decide
343      * whether to create the stream in muted or in unmuted
344      * state. \since 0.9.15 */
345 
346     PA_STREAM_FAIL_ON_SUSPEND = 0x20000U,
347     /**< If the sink/source this stream is connected to is suspended
348      * during the creation of this stream, cause it to fail. If the
349      * sink/source is being suspended during creation of this stream,
350      * make sure this stream is terminated. \since 0.9.15 */
351 
352     PA_STREAM_RELATIVE_VOLUME = 0x40000U,
353     /**< If a volume is passed when this stream is created, consider
354      * it relative to the sink's current volume, never as absolute
355      * device volume. If this is not specified the volume will be
356      * consider absolute when the sink is in flat volume mode,
357      * relative otherwise. \since 0.9.20 */
358 
359     PA_STREAM_PASSTHROUGH = 0x80000U
360     /**< Used to tag content that will be rendered by passthrough sinks.
361      * The data will be left as is and not reformatted, resampled.
362      * \since 1.0 */
363 }
364 
365 alias pa_stream_flags_t = pa_stream_flags;
366 
367 /** \cond fulldocs */
368 
369 /* English is an evil language */
370 enum PA_STREAM_NOT_MONOTONOUS = pa_stream_flags_t.PA_STREAM_NOT_MONOTONIC;
371 
372 /* Allow clients to check with #ifdef for those flags */
373 enum PA_STREAM_START_CORKED = pa_stream_flags_t.PA_STREAM_START_CORKED;
374 enum PA_STREAM_INTERPOLATE_TIMING = pa_stream_flags_t.PA_STREAM_INTERPOLATE_TIMING;
375 enum PA_STREAM_NOT_MONOTONIC = pa_stream_flags_t.PA_STREAM_NOT_MONOTONIC;
376 enum PA_STREAM_AUTO_TIMING_UPDATE = pa_stream_flags_t.PA_STREAM_AUTO_TIMING_UPDATE;
377 enum PA_STREAM_NO_REMAP_CHANNELS = pa_stream_flags_t.PA_STREAM_NO_REMAP_CHANNELS;
378 enum PA_STREAM_NO_REMIX_CHANNELS = pa_stream_flags_t.PA_STREAM_NO_REMIX_CHANNELS;
379 enum PA_STREAM_FIX_FORMAT = pa_stream_flags_t.PA_STREAM_FIX_FORMAT;
380 enum PA_STREAM_FIX_RATE = pa_stream_flags_t.PA_STREAM_FIX_RATE;
381 enum PA_STREAM_FIX_CHANNELS = pa_stream_flags_t.PA_STREAM_FIX_CHANNELS;
382 enum PA_STREAM_DONT_MOVE = pa_stream_flags_t.PA_STREAM_DONT_MOVE;
383 enum PA_STREAM_VARIABLE_RATE = pa_stream_flags_t.PA_STREAM_VARIABLE_RATE;
384 enum PA_STREAM_PEAK_DETECT = pa_stream_flags_t.PA_STREAM_PEAK_DETECT;
385 enum PA_STREAM_START_MUTED = pa_stream_flags_t.PA_STREAM_START_MUTED;
386 enum PA_STREAM_ADJUST_LATENCY = pa_stream_flags_t.PA_STREAM_ADJUST_LATENCY;
387 enum PA_STREAM_EARLY_REQUESTS = pa_stream_flags_t.PA_STREAM_EARLY_REQUESTS;
388 enum PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND = pa_stream_flags_t.PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND;
389 enum PA_STREAM_START_UNMUTED = pa_stream_flags_t.PA_STREAM_START_UNMUTED;
390 enum PA_STREAM_FAIL_ON_SUSPEND = pa_stream_flags_t.PA_STREAM_FAIL_ON_SUSPEND;
391 enum PA_STREAM_RELATIVE_VOLUME = pa_stream_flags_t.PA_STREAM_RELATIVE_VOLUME;
392 enum PA_STREAM_PASSTHROUGH = pa_stream_flags_t.PA_STREAM_PASSTHROUGH;
393 
394 /** \endcond */
395 
396 /** Playback and record buffer metrics */
397 struct pa_buffer_attr
398 {
399     uint maxlength;
400     /**< Maximum length of the buffer in bytes. Setting this to (uint32_t) -1
401      * will initialize this to the maximum value supported by server,
402      * which is recommended.
403      *
404      * In strict low-latency playback scenarios you might want to set this to
405      * a lower value, likely together with the PA_STREAM_ADJUST_LATENCY flag.
406      * If you do so, you ensure that the latency doesn't grow beyond what is
407      * acceptable for the use case, at the cost of getting more underruns if
408      * the latency is lower than what the server can reliably handle. */
409 
410     uint tlength;
411     /**< Playback only: target length of the buffer. The server tries
412      * to assure that at least tlength bytes are always available in
413      * the per-stream server-side playback buffer. The server will
414      * only send requests for more data as long as the buffer has
415      * less than this number of bytes of data.
416      *
417      * It is recommended to set this to (uint32_t) -1, which will
418      * initialize this to a value that is deemed sensible by the
419      * server. However, this value will default to something like 2s;
420      * for applications that have specific latency requirements
421      * this value should be set to the maximum latency that the
422      * application can deal with.
423      *
424      * When PA_STREAM_ADJUST_LATENCY is not set this value will
425      * influence only the per-stream playback buffer size. When
426      * PA_STREAM_ADJUST_LATENCY is set the overall latency of the sink
427      * plus the playback buffer size is configured to this value. Set
428      * PA_STREAM_ADJUST_LATENCY if you are interested in adjusting the
429      * overall latency. Don't set it if you are interested in
430      * configuring the server-side per-stream playback buffer
431      * size. */
432 
433     uint prebuf;
434     /**< Playback only: pre-buffering. The server does not start with
435      * playback before at least prebuf bytes are available in the
436      * buffer. It is recommended to set this to (uint32_t) -1, which
437      * will initialize this to the same value as tlength, whatever
438      * that may be.
439      *
440      * Initialize to 0 to enable manual start/stop control of the stream.
441      * This means that playback will not stop on underrun and playback
442      * will not start automatically, instead pa_stream_cork() needs to
443      * be called explicitly. If you set this value to 0 you should also
444      * set PA_STREAM_START_CORKED. Should underrun occur, the read index
445      * of the output buffer overtakes the write index, and hence the
446      * fill level of the buffer is negative.
447      *
448      * Start of playback can be forced using pa_stream_trigger() even
449      * though the prebuffer size hasn't been reached. If a buffer
450      * underrun occurs, this prebuffering will be again enabled. */
451 
452     uint minreq;
453     /**< Playback only: minimum request. The server does not request
454      * less than minreq bytes from the client, instead waits until the
455      * buffer is free enough to request more bytes at once. It is
456      * recommended to set this to (uint32_t) -1, which will initialize
457      * this to a value that is deemed sensible by the server. This
458      * should be set to a value that gives PulseAudio enough time to
459      * move the data from the per-stream playback buffer into the
460      * hardware playback buffer. */
461 
462     uint fragsize;
463     /**< Recording only: fragment size. The server sends data in
464      * blocks of fragsize bytes size. Large values diminish
465      * interactivity with other operations on the connection context
466      * but decrease control overhead. It is recommended to set this to
467      * (uint32_t) -1, which will initialize this to a value that is
468      * deemed sensible by the server. However, this value will default
469      * to something like 2s; For applications that have specific
470      * latency requirements this value should be set to the maximum
471      * latency that the application can deal with.
472      *
473      * If PA_STREAM_ADJUST_LATENCY is set the overall source latency
474      * will be adjusted according to this value. If it is not set the
475      * source latency is left unmodified. */
476 }
477 
478 /** Error values as used by pa_context_errno(). Use pa_strerror() to convert these values to human readable strings */
479 enum pa_error_code
480 {
481     PA_OK = 0, /**< No error */
482     PA_ERR_ACCESS = 1, /**< Access failure */
483     PA_ERR_COMMAND = 2, /**< Unknown command */
484     PA_ERR_INVALID = 3, /**< Invalid argument */
485     PA_ERR_EXIST = 4, /**< Entity exists */
486     PA_ERR_NOENTITY = 5, /**< No such entity */
487     PA_ERR_CONNECTIONREFUSED = 6, /**< Connection refused */
488     PA_ERR_PROTOCOL = 7, /**< Protocol error */
489     PA_ERR_TIMEOUT = 8, /**< Timeout */
490     PA_ERR_AUTHKEY = 9, /**< No authentication key */
491     PA_ERR_INTERNAL = 10, /**< Internal error */
492     PA_ERR_CONNECTIONTERMINATED = 11, /**< Connection terminated */
493     PA_ERR_KILLED = 12, /**< Entity killed */
494     PA_ERR_INVALIDSERVER = 13, /**< Invalid server */
495     PA_ERR_MODINITFAILED = 14, /**< Module initialization failed */
496     PA_ERR_BADSTATE = 15, /**< Bad state */
497     PA_ERR_NODATA = 16, /**< No data */
498     PA_ERR_VERSION = 17, /**< Incompatible protocol version */
499     PA_ERR_TOOLARGE = 18, /**< Data too large */
500     PA_ERR_NOTSUPPORTED = 19, /**< Operation not supported \since 0.9.5 */
501     PA_ERR_UNKNOWN = 20, /**< The error code was unknown to the client */
502     PA_ERR_NOEXTENSION = 21, /**< Extension does not exist. \since 0.9.12 */
503     PA_ERR_OBSOLETE = 22, /**< Obsolete functionality. \since 0.9.15 */
504     PA_ERR_NOTIMPLEMENTED = 23, /**< Missing implementation. \since 0.9.15 */
505     PA_ERR_FORKED = 24, /**< The caller forked without calling execve() and tried to reuse the context. \since 0.9.15 */
506     PA_ERR_IO = 25, /**< An IO error happened. \since 0.9.16 */
507     PA_ERR_BUSY = 26, /**< Device or resource busy. \since 0.9.17 */
508     PA_ERR_MAX = 27 /**< Not really an error but the first invalid error code */
509 }
510 
511 alias pa_error_code_t = pa_error_code;
512 
513 /** \cond fulldocs */
514 enum PA_OK = pa_error_code_t.PA_OK;
515 enum PA_ERR_ACCESS = pa_error_code_t.PA_ERR_ACCESS;
516 enum PA_ERR_COMMAND = pa_error_code_t.PA_ERR_COMMAND;
517 enum PA_ERR_INVALID = pa_error_code_t.PA_ERR_INVALID;
518 enum PA_ERR_EXIST = pa_error_code_t.PA_ERR_EXIST;
519 enum PA_ERR_NOENTITY = pa_error_code_t.PA_ERR_NOENTITY;
520 enum PA_ERR_CONNECTIONREFUSED = pa_error_code_t.PA_ERR_CONNECTIONREFUSED;
521 enum PA_ERR_PROTOCOL = pa_error_code_t.PA_ERR_PROTOCOL;
522 enum PA_ERR_TIMEOUT = pa_error_code_t.PA_ERR_TIMEOUT;
523 enum PA_ERR_AUTHKEY = pa_error_code_t.PA_ERR_AUTHKEY;
524 enum PA_ERR_INTERNAL = pa_error_code_t.PA_ERR_INTERNAL;
525 enum PA_ERR_CONNECTIONTERMINATED = pa_error_code_t.PA_ERR_CONNECTIONTERMINATED;
526 enum PA_ERR_KILLED = pa_error_code_t.PA_ERR_KILLED;
527 enum PA_ERR_INVALIDSERVER = pa_error_code_t.PA_ERR_INVALIDSERVER;
528 enum PA_ERR_MODINITFAILED = pa_error_code_t.PA_ERR_MODINITFAILED;
529 enum PA_ERR_BADSTATE = pa_error_code_t.PA_ERR_BADSTATE;
530 enum PA_ERR_NODATA = pa_error_code_t.PA_ERR_NODATA;
531 enum PA_ERR_VERSION = pa_error_code_t.PA_ERR_VERSION;
532 enum PA_ERR_TOOLARGE = pa_error_code_t.PA_ERR_TOOLARGE;
533 enum PA_ERR_NOTSUPPORTED = pa_error_code_t.PA_ERR_NOTSUPPORTED;
534 enum PA_ERR_UNKNOWN = pa_error_code_t.PA_ERR_UNKNOWN;
535 enum PA_ERR_NOEXTENSION = pa_error_code_t.PA_ERR_NOEXTENSION;
536 enum PA_ERR_OBSOLETE = pa_error_code_t.PA_ERR_OBSOLETE;
537 enum PA_ERR_NOTIMPLEMENTED = pa_error_code_t.PA_ERR_NOTIMPLEMENTED;
538 enum PA_ERR_FORKED = pa_error_code_t.PA_ERR_FORKED;
539 enum PA_ERR_MAX = pa_error_code_t.PA_ERR_MAX;
540 /** \endcond */
541 
542 /** Subscription event mask, as used by pa_context_subscribe() */
543 enum pa_subscription_mask
544 {
545     PA_SUBSCRIPTION_MASK_NULL = 0x0000U,
546     /**< No events */
547 
548     PA_SUBSCRIPTION_MASK_SINK = 0x0001U,
549     /**< Sink events */
550 
551     PA_SUBSCRIPTION_MASK_SOURCE = 0x0002U,
552     /**< Source events */
553 
554     PA_SUBSCRIPTION_MASK_SINK_INPUT = 0x0004U,
555     /**< Sink input events */
556 
557     PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT = 0x0008U,
558     /**< Source output events */
559 
560     PA_SUBSCRIPTION_MASK_MODULE = 0x0010U,
561     /**< Module events */
562 
563     PA_SUBSCRIPTION_MASK_CLIENT = 0x0020U,
564     /**< Client events */
565 
566     PA_SUBSCRIPTION_MASK_SAMPLE_CACHE = 0x0040U,
567     /**< Sample cache events */
568 
569     PA_SUBSCRIPTION_MASK_SERVER = 0x0080U,
570     /**< Other global server changes. */
571 
572     /** \cond fulldocs */
573     PA_SUBSCRIPTION_MASK_AUTOLOAD = 0x0100U,
574     /**< \deprecated Autoload table events. */
575     /** \endcond */
576 
577     PA_SUBSCRIPTION_MASK_CARD = 0x0200U,
578     /**< Card events. \since 0.9.15 */
579 
580     PA_SUBSCRIPTION_MASK_ALL = 0x02ffU
581     /**< Catch all events */
582 }
583 
584 alias pa_subscription_mask_t = pa_subscription_mask;
585 
586 /** Subscription event types, as used by pa_context_subscribe() */
587 enum pa_subscription_event_type
588 {
589     PA_SUBSCRIPTION_EVENT_SINK = 0x0000U,
590     /**< Event type: Sink */
591 
592     PA_SUBSCRIPTION_EVENT_SOURCE = 0x0001U,
593     /**< Event type: Source */
594 
595     PA_SUBSCRIPTION_EVENT_SINK_INPUT = 0x0002U,
596     /**< Event type: Sink input */
597 
598     PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT = 0x0003U,
599     /**< Event type: Source output */
600 
601     PA_SUBSCRIPTION_EVENT_MODULE = 0x0004U,
602     /**< Event type: Module */
603 
604     PA_SUBSCRIPTION_EVENT_CLIENT = 0x0005U,
605     /**< Event type: Client */
606 
607     PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE = 0x0006U,
608     /**< Event type: Sample cache item */
609 
610     PA_SUBSCRIPTION_EVENT_SERVER = 0x0007U,
611     /**< Event type: Global server change, only occurring with PA_SUBSCRIPTION_EVENT_CHANGE. */
612 
613     /** \cond fulldocs */
614     PA_SUBSCRIPTION_EVENT_AUTOLOAD = 0x0008U,
615     /**< \deprecated Event type: Autoload table changes. */
616     /** \endcond */
617 
618     PA_SUBSCRIPTION_EVENT_CARD = 0x0009U,
619     /**< Event type: Card \since 0.9.15 */
620 
621     PA_SUBSCRIPTION_EVENT_FACILITY_MASK = 0x000FU,
622     /**< A mask to extract the event type from an event value */
623 
624     PA_SUBSCRIPTION_EVENT_NEW = 0x0000U,
625     /**< A new object was created */
626 
627     PA_SUBSCRIPTION_EVENT_CHANGE = 0x0010U,
628     /**< A property of the object was modified */
629 
630     PA_SUBSCRIPTION_EVENT_REMOVE = 0x0020U,
631     /**< An object was removed */
632 
633     PA_SUBSCRIPTION_EVENT_TYPE_MASK = 0x0030U
634     /**< A mask to extract the event operation from an event value */
635 }
636 
637 alias pa_subscription_event_type_t = pa_subscription_event_type;
638 
639 /** Return one if an event type t matches an event mask bitfield */
640 extern (D) auto pa_subscription_match_flags(T0, T1)(auto ref T0 m, auto ref T1 t)
641 {
642     return !!(m & (1 << (t & pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_FACILITY_MASK)));
643 }
644 
645 /** \cond fulldocs */
646 enum PA_SUBSCRIPTION_MASK_NULL = pa_subscription_mask_t.PA_SUBSCRIPTION_MASK_NULL;
647 enum PA_SUBSCRIPTION_MASK_SINK = pa_subscription_mask_t.PA_SUBSCRIPTION_MASK_SINK;
648 enum PA_SUBSCRIPTION_MASK_SOURCE = pa_subscription_mask_t.PA_SUBSCRIPTION_MASK_SOURCE;
649 enum PA_SUBSCRIPTION_MASK_SINK_INPUT = pa_subscription_mask_t.PA_SUBSCRIPTION_MASK_SINK_INPUT;
650 enum PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT = pa_subscription_mask_t.PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT;
651 enum PA_SUBSCRIPTION_MASK_MODULE = pa_subscription_mask_t.PA_SUBSCRIPTION_MASK_MODULE;
652 enum PA_SUBSCRIPTION_MASK_CLIENT = pa_subscription_mask_t.PA_SUBSCRIPTION_MASK_CLIENT;
653 enum PA_SUBSCRIPTION_MASK_SAMPLE_CACHE = pa_subscription_mask_t.PA_SUBSCRIPTION_MASK_SAMPLE_CACHE;
654 enum PA_SUBSCRIPTION_MASK_SERVER = pa_subscription_mask_t.PA_SUBSCRIPTION_MASK_SERVER;
655 enum PA_SUBSCRIPTION_MASK_AUTOLOAD = pa_subscription_mask_t.PA_SUBSCRIPTION_MASK_AUTOLOAD;
656 enum PA_SUBSCRIPTION_MASK_CARD = pa_subscription_mask_t.PA_SUBSCRIPTION_MASK_CARD;
657 enum PA_SUBSCRIPTION_MASK_ALL = pa_subscription_mask_t.PA_SUBSCRIPTION_MASK_ALL;
658 enum PA_SUBSCRIPTION_EVENT_SINK = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_SINK;
659 enum PA_SUBSCRIPTION_EVENT_SOURCE = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_SOURCE;
660 enum PA_SUBSCRIPTION_EVENT_SINK_INPUT = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_SINK_INPUT;
661 enum PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT;
662 enum PA_SUBSCRIPTION_EVENT_MODULE = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_MODULE;
663 enum PA_SUBSCRIPTION_EVENT_CLIENT = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_CLIENT;
664 enum PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE;
665 enum PA_SUBSCRIPTION_EVENT_SERVER = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_SERVER;
666 enum PA_SUBSCRIPTION_EVENT_AUTOLOAD = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_AUTOLOAD;
667 enum PA_SUBSCRIPTION_EVENT_CARD = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_CARD;
668 enum PA_SUBSCRIPTION_EVENT_FACILITY_MASK = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_FACILITY_MASK;
669 enum PA_SUBSCRIPTION_EVENT_NEW = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_NEW;
670 enum PA_SUBSCRIPTION_EVENT_CHANGE = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_CHANGE;
671 enum PA_SUBSCRIPTION_EVENT_REMOVE = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_REMOVE;
672 enum PA_SUBSCRIPTION_EVENT_TYPE_MASK = pa_subscription_event_type_t.PA_SUBSCRIPTION_EVENT_TYPE_MASK;
673 /** \endcond */
674 
675 /** A structure for all kinds of timing information of a stream. See
676  * pa_stream_update_timing_info() and pa_stream_get_timing_info(). The
677  * total output latency a sample that is written with
678  * pa_stream_write() takes to be played may be estimated by
679  * sink_usec+buffer_usec+transport_usec (where buffer_usec is defined
680  * as pa_bytes_to_usec(write_index-read_index)). The output buffer
681  * which buffer_usec relates to may be manipulated freely (with
682  * pa_stream_write()'s seek argument, pa_stream_flush() and friends),
683  * the buffers sink_usec and source_usec relate to are first-in
684  * first-out (FIFO) buffers which cannot be flushed or manipulated in
685  * any way. The total input latency a sample that is recorded takes to
686  * be delivered to the application is:
687  * source_usec+buffer_usec+transport_usec-sink_usec. (Take care of
688  * sign issues!) When connected to a monitor source sink_usec contains
689  * the latency of the owning sink. The two latency estimations
690  * described here are implemented in pa_stream_get_latency().
691  *
692  * All time values are in the sound card clock domain, unless noted
693  * otherwise. The sound card clock usually runs at a slightly different
694  * rate than the system clock.
695  *
696  * Please note that this structure can be extended as part of evolutionary
697  * API updates at any time in any new release.
698  * */
699 struct pa_timing_info
700 {
701     timeval timestamp;
702     /**< The system clock time when this timing info structure was
703      * current. */
704 
705     int synchronized_clocks;
706     /**< Non-zero if the local and the remote machine have
707      * synchronized clocks. If synchronized clocks are detected
708      * transport_usec becomes much more reliable. However, the code
709      * that detects synchronized clocks is very limited and unreliable
710      * itself. */
711 
712     pa_usec_t sink_usec;
713     /**< Time in usecs a sample takes to be played on the sink. For
714      * playback streams and record streams connected to a monitor
715      * source. */
716 
717     pa_usec_t source_usec;
718     /**< Time in usecs a sample takes from being recorded to being
719      * delivered to the application. Only for record streams. */
720 
721     pa_usec_t transport_usec;
722     /**< Estimated time in usecs a sample takes to be transferred
723      * to/from the daemon. For both playback and record streams. */
724 
725     int playing;
726     /**< Non-zero when the stream is currently not underrun and data
727      * is being passed on to the device. Only for playback
728      * streams. This field does not say whether the data is actually
729      * already being played. To determine this check whether
730      * since_underrun (converted to usec) is larger than sink_usec.*/
731 
732     int write_index_corrupt;
733     /**< Non-zero if write_index is not up-to-date because a local
734      * write command that corrupted it has been issued in the time
735      * since this latency info was current . Only write commands with
736      * SEEK_RELATIVE_ON_READ and SEEK_RELATIVE_END can corrupt
737      * write_index. */
738 
739     long write_index;
740     /**< Current write index into the playback buffer in bytes. Think
741      * twice before using this for seeking purposes: it might be out
742      * of date at the time you want to use it. Consider using
743      * PA_SEEK_RELATIVE instead. */
744 
745     int read_index_corrupt;
746     /**< Non-zero if read_index is not up-to-date because a local
747      * pause or flush request that corrupted it has been issued in the
748      * time since this latency info was current. */
749 
750     long read_index;
751     /**< Current read index into the playback buffer in bytes. Think
752      * twice before using this for seeking purposes: it might be out
753      * of date at the time you want to use it. Consider using
754      * PA_SEEK_RELATIVE_ON_READ instead. */
755 
756     pa_usec_t configured_sink_usec;
757     /**< The configured latency for the sink. \since 0.9.11 */
758 
759     pa_usec_t configured_source_usec;
760     /**< The configured latency for the source. \since 0.9.11 */
761 
762     long since_underrun;
763     /**< Bytes that were handed to the sink since the last underrun
764      * happened, or since playback started again after the last
765      * underrun. playing will tell you which case it is. \since
766      * 0.9.11 */
767 }
768 
769 /** A structure for the spawn api. This may be used to integrate auto
770  * spawned daemons into your application. For more information see
771  * pa_context_connect(). When spawning a new child process the
772  * waitpid() is used on the child's PID. The spawn routine will not
773  * block or ignore SIGCHLD signals, since this cannot be done in a
774  * thread compatible way. You might have to do this in
775  * prefork/postfork. */
776 struct pa_spawn_api
777 {
778     void function () prefork;
779     /**< Is called just before the fork in the parent process. May be
780      * NULL. */
781 
782     void function () postfork;
783     /**< Is called immediately after the fork in the parent
784      * process. May be NULL.*/
785 
786     void function () atfork;
787     /**< Is called immediately after the fork in the child
788      * process. May be NULL. It is not safe to close all file
789      * descriptors in this function unconditionally, since a UNIX
790      * socket (created using socketpair()) is passed to the new
791      * process. */
792 }
793 
794 /** Seek type for pa_stream_write(). */
795 enum pa_seek_mode
796 {
797     PA_SEEK_RELATIVE = 0,
798     /**< Seek relative to the write index. */
799 
800     PA_SEEK_ABSOLUTE = 1,
801     /**< Seek relative to the start of the buffer queue. */
802 
803     PA_SEEK_RELATIVE_ON_READ = 2,
804     /**< Seek relative to the read index. */
805 
806     PA_SEEK_RELATIVE_END = 3
807     /**< Seek relative to the current end of the buffer queue. */
808 }
809 
810 alias pa_seek_mode_t = pa_seek_mode;
811 
812 /** \cond fulldocs */
813 enum PA_SEEK_RELATIVE = pa_seek_mode_t.PA_SEEK_RELATIVE;
814 enum PA_SEEK_ABSOLUTE = pa_seek_mode_t.PA_SEEK_ABSOLUTE;
815 enum PA_SEEK_RELATIVE_ON_READ = pa_seek_mode_t.PA_SEEK_RELATIVE_ON_READ;
816 enum PA_SEEK_RELATIVE_END = pa_seek_mode_t.PA_SEEK_RELATIVE_END;
817 /** \endcond */
818 
819 /** Special sink flags. */
820 enum pa_sink_flags
821 {
822     PA_SINK_NOFLAGS = 0x0000U,
823     /**< Flag to pass when no specific options are needed (used to avoid casting)  \since 0.9.19 */
824 
825     PA_SINK_HW_VOLUME_CTRL = 0x0001U,
826     /**< Supports hardware volume control. This is a dynamic flag and may
827      * change at runtime after the sink has initialized */
828 
829     PA_SINK_LATENCY = 0x0002U,
830     /**< Supports latency querying */
831 
832     PA_SINK_HARDWARE = 0x0004U,
833     /**< Is a hardware sink of some kind, in contrast to
834      * "virtual"/software sinks \since 0.9.3 */
835 
836     PA_SINK_NETWORK = 0x0008U,
837     /**< Is a networked sink of some kind. \since 0.9.7 */
838 
839     PA_SINK_HW_MUTE_CTRL = 0x0010U,
840     /**< Supports hardware mute control. This is a dynamic flag and may
841      * change at runtime after the sink has initialized \since 0.9.11 */
842 
843     PA_SINK_DECIBEL_VOLUME = 0x0020U,
844     /**< Volume can be translated to dB with pa_sw_volume_to_dB(). This is a
845      * dynamic flag and may change at runtime after the sink has initialized
846      * \since 0.9.11 */
847 
848     PA_SINK_FLAT_VOLUME = 0x0040U,
849     /**< This sink is in flat volume mode, i.e.\ always the maximum of
850      * the volume of all connected inputs. \since 0.9.15 */
851 
852     PA_SINK_DYNAMIC_LATENCY = 0x0080U,
853     /**< The latency can be adjusted dynamically depending on the
854      * needs of the connected streams. \since 0.9.15 */
855 
856     PA_SINK_SET_FORMATS = 0x0100U
857     /**< The sink allows setting what formats are supported by the connected
858      * hardware. The actual functionality to do this might be provided by an
859      * extension. \since 1.0 */
860 
861     /** \cond fulldocs */
862     /* PRIVATE: Server-side values -- do not try to use these at client-side.
863      * The server will filter out these flags anyway, so you should never see
864      * these flags in sinks. */
865 
866     /**< This sink shares the volume with the master sink (used by some filter
867      * sinks). */
868 
869     /**< The HW volume changes are syncronized with SW volume. */
870     /** \endcond */
871 }
872 
873 alias pa_sink_flags_t = pa_sink_flags;
874 
875 /** \cond fulldocs */
876 enum PA_SINK_HW_VOLUME_CTRL = pa_sink_flags_t.PA_SINK_HW_VOLUME_CTRL;
877 enum PA_SINK_LATENCY = pa_sink_flags_t.PA_SINK_LATENCY;
878 enum PA_SINK_HARDWARE = pa_sink_flags_t.PA_SINK_HARDWARE;
879 enum PA_SINK_NETWORK = pa_sink_flags_t.PA_SINK_NETWORK;
880 enum PA_SINK_HW_MUTE_CTRL = pa_sink_flags_t.PA_SINK_HW_MUTE_CTRL;
881 enum PA_SINK_DECIBEL_VOLUME = pa_sink_flags_t.PA_SINK_DECIBEL_VOLUME;
882 enum PA_SINK_FLAT_VOLUME = pa_sink_flags_t.PA_SINK_FLAT_VOLUME;
883 enum PA_SINK_DYNAMIC_LATENCY = pa_sink_flags_t.PA_SINK_DYNAMIC_LATENCY;
884 enum PA_SINK_SET_FORMATS = pa_sink_flags_t.PA_SINK_SET_FORMATS;
885 
886 /** \endcond */
887 
888 /** Sink state. \since 0.9.15 */
889 enum pa_sink_state
890 {
891     /* enum serialized in u8 */
892     PA_SINK_INVALID_STATE = -1,
893     /**< This state is used when the server does not support sink state introspection \since 0.9.15 */
894 
895     PA_SINK_RUNNING = 0,
896     /**< Running, sink is playing and used by at least one non-corked sink-input \since 0.9.15 */
897 
898     PA_SINK_IDLE = 1,
899     /**< When idle, the sink is playing but there is no non-corked sink-input attached to it \since 0.9.15 */
900 
901     PA_SINK_SUSPENDED = 2,
902     /**< When suspended, actual sink access can be closed, for instance \since 0.9.15 */
903 
904     /** \cond fulldocs */
905     /* PRIVATE: Server-side values -- DO NOT USE THIS ON THE CLIENT
906      * SIDE! These values are *not* considered part of the official PA
907      * API/ABI. If you use them your application might break when PA
908      * is upgraded. Also, please note that these values are not useful
909      * on the client side anyway. */
910 
911     PA_SINK_INIT = -2,
912     /**< Initialization state */
913 
914     PA_SINK_UNLINKED = -3
915     /**< The state when the sink is getting unregistered and removed from client access */
916     /** \endcond */
917 }
918 
919 alias pa_sink_state_t = pa_sink_state;
920 
921 /** Returns non-zero if sink is playing: running or idle. \since 0.9.15 */
922 int PA_SINK_IS_OPENED (pa_sink_state_t x);
923 
924 /** Returns non-zero if sink is running. \since 1.0 */
925 int PA_SINK_IS_RUNNING (pa_sink_state_t x);
926 
927 /** \cond fulldocs */
928 enum PA_SINK_INVALID_STATE = pa_sink_state_t.PA_SINK_INVALID_STATE;
929 enum PA_SINK_RUNNING = pa_sink_state_t.PA_SINK_RUNNING;
930 enum PA_SINK_IDLE = pa_sink_state_t.PA_SINK_IDLE;
931 enum PA_SINK_SUSPENDED = pa_sink_state_t.PA_SINK_SUSPENDED;
932 enum PA_SINK_INIT = pa_sink_state_t.PA_SINK_INIT;
933 enum PA_SINK_UNLINKED = pa_sink_state_t.PA_SINK_UNLINKED;
934 // enum PA_SINK_IS_OPENED = PA_SINK_IS_OPENED;
935 /** \endcond */
936 
937 /** Special source flags.  */
938 enum pa_source_flags
939 {
940     PA_SOURCE_NOFLAGS = 0x0000U,
941     /**< Flag to pass when no specific options are needed (used to avoid casting)  \since 0.9.19 */
942 
943     PA_SOURCE_HW_VOLUME_CTRL = 0x0001U,
944     /**< Supports hardware volume control. This is a dynamic flag and may
945      * change at runtime after the source has initialized */
946 
947     PA_SOURCE_LATENCY = 0x0002U,
948     /**< Supports latency querying */
949 
950     PA_SOURCE_HARDWARE = 0x0004U,
951     /**< Is a hardware source of some kind, in contrast to
952      * "virtual"/software source \since 0.9.3 */
953 
954     PA_SOURCE_NETWORK = 0x0008U,
955     /**< Is a networked source of some kind. \since 0.9.7 */
956 
957     PA_SOURCE_HW_MUTE_CTRL = 0x0010U,
958     /**< Supports hardware mute control. This is a dynamic flag and may
959      * change at runtime after the source has initialized \since 0.9.11 */
960 
961     PA_SOURCE_DECIBEL_VOLUME = 0x0020U,
962     /**< Volume can be translated to dB with pa_sw_volume_to_dB(). This is a
963      * dynamic flag and may change at runtime after the source has initialized
964      * \since 0.9.11 */
965 
966     PA_SOURCE_DYNAMIC_LATENCY = 0x0040U,
967     /**< The latency can be adjusted dynamically depending on the
968      * needs of the connected streams. \since 0.9.15 */
969 
970     PA_SOURCE_FLAT_VOLUME = 0x0080U
971     /**< This source is in flat volume mode, i.e.\ always the maximum of
972      * the volume of all connected outputs. \since 1.0 */
973 
974     /** \cond fulldocs */
975     /* PRIVATE: Server-side values -- do not try to use these at client-side.
976      * The server will filter out these flags anyway, so you should never see
977      * these flags in sources. */
978 
979     /**< This source shares the volume with the master source (used by some filter
980      * sources). */
981 
982     /**< The HW volume changes are syncronized with SW volume. */
983 }
984 
985 alias pa_source_flags_t = pa_source_flags;
986 
987 /** \cond fulldocs */
988 enum PA_SOURCE_HW_VOLUME_CTRL = pa_source_flags_t.PA_SOURCE_HW_VOLUME_CTRL;
989 enum PA_SOURCE_LATENCY = pa_source_flags_t.PA_SOURCE_LATENCY;
990 enum PA_SOURCE_HARDWARE = pa_source_flags_t.PA_SOURCE_HARDWARE;
991 enum PA_SOURCE_NETWORK = pa_source_flags_t.PA_SOURCE_NETWORK;
992 enum PA_SOURCE_HW_MUTE_CTRL = pa_source_flags_t.PA_SOURCE_HW_MUTE_CTRL;
993 enum PA_SOURCE_DECIBEL_VOLUME = pa_source_flags_t.PA_SOURCE_DECIBEL_VOLUME;
994 enum PA_SOURCE_DYNAMIC_LATENCY = pa_source_flags_t.PA_SOURCE_DYNAMIC_LATENCY;
995 enum PA_SOURCE_FLAT_VOLUME = pa_source_flags_t.PA_SOURCE_FLAT_VOLUME;
996 
997 /** \endcond */
998 
999 /** Source state. \since 0.9.15 */
1000 enum pa_source_state
1001 {
1002     PA_SOURCE_INVALID_STATE = -1,
1003     /**< This state is used when the server does not support source state introspection \since 0.9.15 */
1004 
1005     PA_SOURCE_RUNNING = 0,
1006     /**< Running, source is recording and used by at least one non-corked source-output \since 0.9.15 */
1007 
1008     PA_SOURCE_IDLE = 1,
1009     /**< When idle, the source is still recording but there is no non-corked source-output \since 0.9.15 */
1010 
1011     PA_SOURCE_SUSPENDED = 2,
1012     /**< When suspended, actual source access can be closed, for instance \since 0.9.15 */
1013 
1014     /** \cond fulldocs */
1015     /* PRIVATE: Server-side values -- DO NOT USE THIS ON THE CLIENT
1016      * SIDE! These values are *not* considered part of the official PA
1017      * API/ABI. If you use them your application might break when PA
1018      * is upgraded. Also, please note that these values are not useful
1019      * on the client side anyway. */
1020 
1021     PA_SOURCE_INIT = -2,
1022     /**< Initialization state */
1023 
1024     PA_SOURCE_UNLINKED = -3
1025     /**< The state when the source is getting unregistered and removed from client access */
1026     /** \endcond */
1027 }
1028 
1029 alias pa_source_state_t = pa_source_state;
1030 
1031 /** Returns non-zero if source is recording: running or idle. \since 0.9.15 */
1032 int PA_SOURCE_IS_OPENED (pa_source_state_t x);
1033 
1034 /** Returns non-zero if source is running \since 1.0 */
1035 int PA_SOURCE_IS_RUNNING (pa_source_state_t x);
1036 
1037 /** \cond fulldocs */
1038 enum PA_SOURCE_INVALID_STATE = pa_source_state_t.PA_SOURCE_INVALID_STATE;
1039 enum PA_SOURCE_RUNNING = pa_source_state_t.PA_SOURCE_RUNNING;
1040 enum PA_SOURCE_IDLE = pa_source_state_t.PA_SOURCE_IDLE;
1041 enum PA_SOURCE_SUSPENDED = pa_source_state_t.PA_SOURCE_SUSPENDED;
1042 enum PA_SOURCE_INIT = pa_source_state_t.PA_SOURCE_INIT;
1043 enum PA_SOURCE_UNLINKED = pa_source_state_t.PA_SOURCE_UNLINKED;
1044 // enum PA_SOURCE_IS_OPENED = PA_SOURCE_IS_OPENED;
1045 /** \endcond */
1046 
1047 /** A generic free() like callback prototype */
1048 alias pa_free_cb_t = void function (void* p);
1049 
1050 /** A stream policy/meta event requesting that an application should
1051  * cork a specific stream. See pa_stream_event_cb_t for more
1052  * information. \since 0.9.15 */
1053 enum PA_STREAM_EVENT_REQUEST_CORK = "request-cork";
1054 
1055 /** A stream policy/meta event requesting that an application should
1056  * cork a specific stream. See pa_stream_event_cb_t for more
1057  * information, \since 0.9.15 */
1058 enum PA_STREAM_EVENT_REQUEST_UNCORK = "request-uncork";
1059 
1060 /** A stream event notifying that the stream is going to be
1061  * disconnected because the underlying sink changed and no longer
1062  * supports the format that was originally negotiated. Clients need
1063  * to connect a new stream to renegotiate a format and continue
1064  * playback. \since 1.0 */
1065 enum PA_STREAM_EVENT_FORMAT_LOST = "format-lost";
1066 
1067 /** Port availability / jack detection status
1068  * \since 2.0 */
1069 enum pa_port_available
1070 {
1071     PA_PORT_AVAILABLE_UNKNOWN = 0, /**< This port does not support jack detection \since 2.0 */
1072     PA_PORT_AVAILABLE_NO = 1, /**< This port is not available, likely because the jack is not plugged in. \since 2.0 */
1073     PA_PORT_AVAILABLE_YES = 2 /**< This port is available, likely because the jack is plugged in. \since 2.0 */
1074 }
1075 
1076 alias pa_port_available_t = pa_port_available;
1077 
1078 /** \cond fulldocs */
1079 enum PA_PORT_AVAILABLE_UNKNOWN = pa_port_available_t.PA_PORT_AVAILABLE_UNKNOWN;
1080 enum PA_PORT_AVAILABLE_NO = pa_port_available_t.PA_PORT_AVAILABLE_NO;
1081 enum PA_PORT_AVAILABLE_YES = pa_port_available_t.PA_PORT_AVAILABLE_YES;
1082 
1083 /** \endcond */
1084 
1085 /** Port type. New types can be added in the future, so applications should
1086  * gracefully handle situations where a type identifier doesn't match any item
1087  * in this enumeration. \since 14.0 */
1088 enum pa_device_port_type
1089 {
1090     PA_DEVICE_PORT_TYPE_UNKNOWN = 0,
1091     PA_DEVICE_PORT_TYPE_AUX = 1,
1092     PA_DEVICE_PORT_TYPE_SPEAKER = 2,
1093     PA_DEVICE_PORT_TYPE_HEADPHONES = 3,
1094     PA_DEVICE_PORT_TYPE_LINE = 4,
1095     PA_DEVICE_PORT_TYPE_MIC = 5,
1096     PA_DEVICE_PORT_TYPE_HEADSET = 6,
1097     PA_DEVICE_PORT_TYPE_HANDSET = 7,
1098     PA_DEVICE_PORT_TYPE_EARPIECE = 8,
1099     PA_DEVICE_PORT_TYPE_SPDIF = 9,
1100     PA_DEVICE_PORT_TYPE_HDMI = 10,
1101     PA_DEVICE_PORT_TYPE_TV = 11,
1102     PA_DEVICE_PORT_TYPE_RADIO = 12,
1103     PA_DEVICE_PORT_TYPE_VIDEO = 13,
1104     PA_DEVICE_PORT_TYPE_USB = 14,
1105     PA_DEVICE_PORT_TYPE_BLUETOOTH = 15,
1106     PA_DEVICE_PORT_TYPE_PORTABLE = 16,
1107     PA_DEVICE_PORT_TYPE_HANDSFREE = 17,
1108     PA_DEVICE_PORT_TYPE_CAR = 18,
1109     PA_DEVICE_PORT_TYPE_HIFI = 19,
1110     PA_DEVICE_PORT_TYPE_PHONE = 20,
1111     PA_DEVICE_PORT_TYPE_NETWORK = 21,
1112     PA_DEVICE_PORT_TYPE_ANALOG = 22
1113 }
1114 
1115 alias pa_device_port_type_t = pa_device_port_type;
1116