Warning: That file was not part of the compilation database. It may have many parsing errors.

1/*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3#ifndef foocanberrahfoo
4#define foocanberrahfoo
5
6/***
7 This file is part of libcanberra.
8
9 Copyright 2008 Lennart Poettering
10
11 libcanberra is free software; you can redistribute it and/or modify
12 it under the terms of the GNU Lesser General Public License as
13 published by the Free Software Foundation, either version 2.1 of the
14 License, or (at your option) any later version.
15
16 libcanberra is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public
22 License along with libcanberra. If not, see
23 <http://www.gnu.org/licenses/>.
24***/
25
26#include <sys/types.h>
27#include <sys/param.h>
28#include <inttypes.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#ifndef __GNUC__
35/* Make sure __attribute__ works on non-gcc systems. Yes, might be a bit ugly */
36#define __attribute__(x)
37#endif
38
39/**
40 * CA_MAJOR:
41 *
42 * Evaluates to the major version number of libcanberra.
43 */
44#define CA_MAJOR (0)
45
46/**
47 * CA_MINOR:
48 *
49 * Evaluates to the minor version number of libcanberra.
50 */
51#define CA_MINOR (30)
52
53/**
54 * CA_CHECK_VERSION:
55 *
56 * Evaluates to TRUE when the library version is newer than the
57 * specified parameters.
58 */
59#define CA_CHECK_VERSION(major,minor) \
60 ((CA_MAJOR > (major)) || \
61 (CA_MAJOR == (major) && CA_MINOR >= (minor)))
62
63/**
64 * CA_PROP_MEDIA_NAME:
65 *
66 * A name describing the media being played. Localized if possible and applicable.
67 */
68#define CA_PROP_MEDIA_NAME "media.name"
69
70/**
71 * CA_PROP_MEDIA_TITLE:
72 *
73 * A (song) title describing the media being played. Localized if possible and applicable.
74 */
75#define CA_PROP_MEDIA_TITLE "media.title"
76
77/**
78 * CA_PROP_MEDIA_ARTIST:
79 *
80 * The artist of this media. Localized if possible and applicable.
81 */
82#define CA_PROP_MEDIA_ARTIST "media.artist"
83
84/**
85 * CA_PROP_MEDIA_LANGUAGE:
86 *
87 * The language this media is in, in some standard POSIX locale string, such as "de_DE".
88 */
89#define CA_PROP_MEDIA_LANGUAGE "media.language"
90
91/**
92 * CA_PROP_MEDIA_FILENAME:
93 *
94 * The file name this media was or can be loaded from.
95 */
96#define CA_PROP_MEDIA_FILENAME "media.filename"
97
98/**
99 * CA_PROP_MEDIA_ICON:
100 *
101 * An icon for this media in binary PNG format.
102 */
103#define CA_PROP_MEDIA_ICON "media.icon"
104
105/**
106 * CA_PROP_MEDIA_ICON_NAME:
107 *
108 * An icon name as defined in the XDG icon naming specifcation.
109 */
110#define CA_PROP_MEDIA_ICON_NAME "media.icon_name"
111
112/**
113 * CA_PROP_MEDIA_ROLE:
114 *
115 * The "role" this media is played in. For event sounds the string
116 * "event". For other cases strings like "music", "video", "game", ...
117 */
118#define CA_PROP_MEDIA_ROLE "media.role"
119
120/**
121 * CA_PROP_EVENT_ID:
122 *
123 * A textual id for an event sound, as mandated by the XDG sound naming specification.
124 */
125#define CA_PROP_EVENT_ID "event.id"
126
127/**
128 * CA_PROP_EVENT_DESCRIPTION:
129 *
130 * A descriptive string for the sound event. Localized if possible and applicable.
131 */
132#define CA_PROP_EVENT_DESCRIPTION "event.description"
133
134/**
135 * CA_PROP_EVENT_MOUSE_X:
136 *
137 * If this sound event was triggered by a mouse input event, the X
138 * position of the mouse cursor on the screen, formatted as string.
139 */
140#define CA_PROP_EVENT_MOUSE_X "event.mouse.x"
141
142/**
143 * CA_PROP_EVENT_MOUSE_Y:
144 *
145 * If this sound event was triggered by a mouse input event, the Y
146 * position of the mouse cursor on the screen, formatted as string.
147 */
148#define CA_PROP_EVENT_MOUSE_Y "event.mouse.y"
149
150/**
151 * CA_PROP_EVENT_MOUSE_HPOS:
152 *
153 * If this sound event was triggered by a mouse input event, the X
154 * position of the mouse cursor as fractional value between 0 and 1,
155 * formatted as string, 0 reflecting the left side of the screen, 1
156 * the right side.
157 */
158#define CA_PROP_EVENT_MOUSE_HPOS "event.mouse.hpos"
159
160/**
161 * CA_PROP_EVENT_MOUSE_VPOS:
162 *
163 * If this sound event was triggered by a mouse input event, the Y
164 * position of the mouse cursor as fractional value between 0 and 1,
165 * formatted as string, 0 reflecting the top end of the screen, 1
166 * the bottom end.
167 */
168#define CA_PROP_EVENT_MOUSE_VPOS "event.mouse.vpos"
169
170/**
171 * CA_PROP_EVENT_MOUSE_BUTTON:
172 *
173 * If this sound event was triggered by a mouse input event, the
174 * number of the mouse button that triggered it, formatted as string. 1
175 * for left mouse button, 3 for right, 2 for middle.
176 */
177#define CA_PROP_EVENT_MOUSE_BUTTON "event.mouse.button"
178
179/**
180 * CA_PROP_WINDOW_NAME:
181 *
182 * If this sound event was triggered by a window on the screen, the
183 * name of this window as human readable string.
184 */
185#define CA_PROP_WINDOW_NAME "window.name"
186
187/**
188 * CA_PROP_WINDOW_ID:
189 *
190 * If this sound event was triggered by a window on the screen, some
191 * identification string for this window, so that the sound system can
192 * recognize specific windows.
193 */
194#define CA_PROP_WINDOW_ID "window.id"
195
196/**
197 * CA_PROP_WINDOW_ICON:
198 *
199 * If this sound event was triggered by a window on the screen, binary
200 * icon data in PNG format for this window.
201 */
202#define CA_PROP_WINDOW_ICON "window.icon"
203
204/**
205 * CA_PROP_WINDOW_ICON_NAME:
206 *
207 * If this sound event was triggered by a window on the screen, an
208 * icon name for this window, as defined in the XDG icon naming
209 * specification.
210 */
211#define CA_PROP_WINDOW_ICON_NAME "window.icon_name"
212
213/**
214 * CA_PROP_WINDOW_X:
215 *
216 * If this sound event was triggered by a window on the screen, the X
217 * position of the window measured from the top left corner of the
218 * screen to the top left corner of the window.
219 *
220 * Since: 0.17
221 */
222#define CA_PROP_WINDOW_X "window.x"
223
224/**
225 * CA_PROP_WINDOW_Y:
226 *
227 * If this sound event was triggered by a window on the screen, the y
228 * position of the window measured from the top left corner of the
229 * screen to the top left corner of the window.
230 *
231 * Since: 0.17
232 */
233#define CA_PROP_WINDOW_Y "window.y"
234
235/**
236 * CA_PROP_WINDOW_WIDTH:
237 *
238 * If this sound event was triggered by a window on the screen, the
239 * pixel width of the window.
240 *
241 * Since: 0.17
242 */
243#define CA_PROP_WINDOW_WIDTH "window.width"
244
245/**
246 * CA_PROP_WINDOW_HEIGHT:
247 *
248 * If this sound event was triggered by a window on the screen, the
249 * pixel height of the window.
250 *
251 * Since: 0.17
252 */
253#define CA_PROP_WINDOW_HEIGHT "window.height"
254
255/**
256 * CA_PROP_WINDOW_HPOS:
257 *
258 * If this sound event was triggered by a window on the screen, the X
259 * position of the center of the window as fractional value between 0
260 * and 1, formatted as string, 0 reflecting the left side of the
261 * screen, 1 the right side.
262 *
263 * Since: 0.17
264 */
265#define CA_PROP_WINDOW_HPOS "window.hpos"
266
267/**
268 * CA_PROP_WINDOW_VPOS:
269 *
270 * If this sound event was triggered by a window on the screen, the Y
271 * position of the center of the window as fractional value between 0
272 * and 1, formatted as string, 0 reflecting the top side of the
273 * screen, 1 the bottom side.
274 *
275 * Since: 0.17
276 */
277#define CA_PROP_WINDOW_VPOS "window.vpos"
278
279/**
280 * CA_PROP_WINDOW_DESKTOP:
281 *
282 * If this sound event was triggered by a window on the screen and the
283 * windowing system supports multiple desktops, a comma seperated list
284 * of indexes of the desktops this window is visible on. If this
285 * property is an empty string, it is visible on all desktops
286 * (i.e. 'sticky'). The first desktop is 0. (e.g. "0,2,3")
287 *
288 * Since: 0.18
289 */
290#define CA_PROP_WINDOW_DESKTOP "window.desktop"
291
292/**
293 * CA_PROP_WINDOW_X11_DISPLAY:
294 *
295 * If this sound event was triggered by a window on the screen and the
296 * windowing system is X11, the X display name of the window (e.g. ":0").
297 */
298#define CA_PROP_WINDOW_X11_DISPLAY "window.x11.display"
299
300/**
301 * CA_PROP_WINDOW_X11_SCREEN:
302 *
303 * If this sound event was triggered by a window on the screen and the
304 * windowing system is X11, the X screen id of the window formatted as
305 * string (e.g. "0").
306 */
307#define CA_PROP_WINDOW_X11_SCREEN "window.x11.screen"
308
309/**
310 * CA_PROP_WINDOW_X11_MONITOR:
311 *
312 * If this sound event was triggered by a window on the screen and the
313 * windowing system is X11, the X monitor id of the window formatted as
314 * string (e.g. "0").
315 */
316#define CA_PROP_WINDOW_X11_MONITOR "window.x11.monitor"
317
318/**
319 * CA_PROP_WINDOW_X11_XID:
320 *
321 * If this sound event was triggered by a window on the screen and the
322 * windowing system is X11, the XID of the window formatted as string.
323 */
324#define CA_PROP_WINDOW_X11_XID "window.x11.xid"
325
326/**
327 * CA_PROP_APPLICATION_NAME:
328 *
329 * The name of the application this sound event was triggered by as
330 * human readable string. (e.g. "GNU Emacs") Localized if possible and
331 * applicable.
332 */
333#define CA_PROP_APPLICATION_NAME "application.name"
334
335/**
336 * CA_PROP_APPLICATION_ID:
337 *
338 * An identifier for the program this sound event was triggered
339 * by. (e.g. "org.gnu.emacs").
340 */
341#define CA_PROP_APPLICATION_ID "application.id"
342
343/**
344 * CA_PROP_APPLICATION_VERSION:
345 *
346 * A version number for the program this sound event was triggered
347 * by. (e.g. "22.2")
348 */
349#define CA_PROP_APPLICATION_VERSION "application.version"
350
351/**
352 * CA_PROP_APPLICATION_ICON:
353 *
354 * Binary icon data in PNG format for the application this sound event
355 * is triggered by.
356 */
357#define CA_PROP_APPLICATION_ICON "application.icon"
358
359/**
360 * CA_PROP_APPLICATION_ICON_NAME:
361 *
362 * An icon name for the application this sound event is triggered by,
363 * as defined in the XDG icon naming specification.
364 */
365#define CA_PROP_APPLICATION_ICON_NAME "application.icon_name"
366
367/**
368 * CA_PROP_APPLICATION_LANGUAGE:
369 *
370 * The locale string the application that is triggering this sound
371 * event is running in. A POSIX locale string such as de_DE@euro.
372 */
373#define CA_PROP_APPLICATION_LANGUAGE "application.language"
374
375/**
376 * CA_PROP_APPLICATION_PROCESS_ID:
377 *
378 * The unix PID of the process that is triggering this sound event, formatted as string.
379 */
380#define CA_PROP_APPLICATION_PROCESS_ID "application.process.id"
381
382/**
383 * CA_PROP_APPLICATION_PROCESS_BINARY:
384 *
385 * The path to the process binary of the process that is triggering this sound event.
386 */
387#define CA_PROP_APPLICATION_PROCESS_BINARY "application.process.binary"
388
389/**
390 * CA_PROP_APPLICATION_PROCESS_USER:
391 *
392 * The user that owns the process that is triggering this sound event.
393 */
394#define CA_PROP_APPLICATION_PROCESS_USER "application.process.user"
395
396/**
397 * CA_PROP_APPLICATION_PROCESS_HOST:
398 *
399 * The host name of the host the process that is triggering this sound event runs on.
400 */
401#define CA_PROP_APPLICATION_PROCESS_HOST "application.process.host"
402
403/**
404 * CA_PROP_CANBERRA_CACHE_CONTROL:
405 *
406 * A special property that can be used to control the automatic sound
407 * caching of sounds in the sound server. One of "permanent",
408 * "volatile", "never". "permanent" will cause this sample to be
409 * cached in the server permanently. This is useful for very
410 * frequently used sound events such as those used for input
411 * feedback. "volatile" may be used for cacheing sounds in the sound
412 * server temporarily. They will expire after some time or on cache
413 * pressure. Finally, "never" may be used for sounds that should never
414 * be cached, because they are only generated very seldomly or even
415 * only once at most (such as desktop login sounds).
416 *
417 * If this property is not explicitly passed to ca_context_play() it
418 * will default to "never". If it is not explicitly passed to
419 * ca_context_cache() it will default to "permanent".
420 *
421 * If the list of properties is handed on to the sound server this
422 * property is stripped from it.
423 */
424#define CA_PROP_CANBERRA_CACHE_CONTROL "canberra.cache-control"
425
426/**
427 * CA_PROP_CANBERRA_VOLUME:
428 *
429 * A special property that can be used to control the volume this
430 * sound event is played in if the backend supports it. A floating
431 * point value for the decibel multiplier for the sound. 0 dB relates
432 * to zero gain, and is the default volume these sounds are played in.
433 *
434 * If the list of properties is handed on to the sound server this
435 * property is stripped from it.
436 */
437#define CA_PROP_CANBERRA_VOLUME "canberra.volume"
438
439/**
440 * CA_PROP_CANBERRA_XDG_THEME_NAME:
441 *
442 * A special property that can be used to control the XDG sound theme that
443 * is used for this sample.
444 *
445 * If the list of properties is handed on to the sound server this
446 * property is stripped from it.
447 */
448#define CA_PROP_CANBERRA_XDG_THEME_NAME "canberra.xdg-theme.name"
449
450/**
451 * CA_PROP_CANBERRA_XDG_THEME_OUTPUT_PROFILE:
452 *
453 * A special property that can be used to control the XDG sound theme
454 * output profile that is used for this sample.
455 *
456 * If the list of properties is handed on to the sound server this
457 * property is stripped from it.
458 */
459#define CA_PROP_CANBERRA_XDG_THEME_OUTPUT_PROFILE "canberra.xdg-theme.output-profile"
460
461/**
462 * CA_PROP_CANBERRA_ENABLE:
463 *
464 * A special property that can be used to control whether any sounds
465 * are played at all. If this property is "1" or unset sounds are
466 * played as normal. However, if it is "0" all calls to
467 * ca_context_play() will fail with CA_ERROR_DISABLED.
468 *
469 * If the list of properties is handed on to the sound server this
470 * property is stripped from it.
471 */
472#define CA_PROP_CANBERRA_ENABLE "canberra.enable"
473
474/**
475 * CA_PROP_CANBERRA_FORCE_CHANNEL:
476 *
477 * A special property that can be used to control on which channel a
478 * sound is played. The value should be one of mono, front-left,
479 * front-right, front-center, rear-left, rear-right, rear-center, lfe,
480 * front-left-of-center, front-right-of-center, side-left, side-right,
481 * top-center, top-front-left, top-front-right, top-front-center,
482 * top-rear-left, top-rear-right, top-rear-center. This property is
483 * only honoured by some backends, other backends may choose to ignore
484 * it completely.
485 *
486 * If the list of properties is handed on to the sound server this
487 * property is stripped from it.
488 *
489 * Since: 0.13
490 */
491#define CA_PROP_CANBERRA_FORCE_CHANNEL "canberra.force_channel"
492
493/**
494 * ca_context:
495 *
496 * A libcanberra context object.
497 */
498typedef struct ca_context ca_context;
499
500/**
501 * ca_finish_callback_t:
502 * @c: The libcanberra context this callback is called for
503 * @id: The numerical id passed to the ca_context_play_full() when starting the event sound playback.
504 * @error_code: A numerical error code describing the reason this callback is called. If CA_SUCCESS is passed in the playback of the event sound was successfully completed.
505 * @userdata: Some arbitrary user data the caller of ca_context_play_full() passed in.
506 *
507 * Playback completion event callback. The context this callback is
508 * called in is undefined, it might or might not be called from a
509 * background thread, and from any stack frame. The code implementing
510 * this function may not call any libcanberra API call from this
511 * callback -- this might result in a deadlock. Instead it may only be
512 * used to asynchronously signal some kind of notification object
513 * (semaphore, message queue, ...).
514 */
515typedef void (*ca_finish_callback_t)(ca_context *c, uint32_t id, int error_code, void *userdata);
516
517/**
518 * Error codes:
519 * @CA_SUCCESS: Success
520 *
521 * Error codes
522 */
523enum {
524 CA_SUCCESS = 0,
525 CA_ERROR_NOTSUPPORTED = -1,
526 CA_ERROR_INVALID = -2,
527 CA_ERROR_STATE = -3,
528 CA_ERROR_OOM = -4,
529 CA_ERROR_NODRIVER = -5,
530 CA_ERROR_SYSTEM = -6,
531 CA_ERROR_CORRUPT = -7,
532 CA_ERROR_TOOBIG = -8,
533 CA_ERROR_NOTFOUND = -9,
534 CA_ERROR_DESTROYED = -10,
535 CA_ERROR_CANCELED = -11,
536 CA_ERROR_NOTAVAILABLE = -12,
537 CA_ERROR_ACCESS = -13,
538 CA_ERROR_IO = -14,
539 CA_ERROR_INTERNAL = -15,
540 CA_ERROR_DISABLED = -16,
541 CA_ERROR_FORKED = -17,
542 CA_ERROR_DISCONNECTED = -18,
543 _CA_ERROR_MAX = -19
544};
545
546/**
547 * ca_proplist:
548 *
549 * A canberra property list object. Basically a hashtable.
550 */
551typedef struct ca_proplist ca_proplist;
552
553int ca_proplist_create(ca_proplist **p);
554int ca_proplist_destroy(ca_proplist *p);
555int ca_proplist_sets(ca_proplist *p, const char *key, const char *value);
556int ca_proplist_setf(ca_proplist *p, const char *key, const char *format, ...) __attribute__((format(printf, 3, 4)));
557int ca_proplist_set(ca_proplist *p, const char *key, const void *data, size_t nbytes);
558
559int ca_context_create(ca_context **c);
560int ca_context_set_driver(ca_context *c, const char *driver);
561int ca_context_change_device(ca_context *c, const char *device);
562int ca_context_open(ca_context *c);
563int ca_context_destroy(ca_context *c);
564int ca_context_change_props(ca_context *c, ...) __attribute__((sentinel));
565int ca_context_change_props_full(ca_context *c, ca_proplist *p);
566int ca_context_play_full(ca_context *c, uint32_t id, ca_proplist *p, ca_finish_callback_t cb, void *userdata);
567int ca_context_play(ca_context *c, uint32_t id, ...) __attribute__((sentinel));
568int ca_context_cache_full(ca_context *c, ca_proplist *p);
569int ca_context_cache(ca_context *c, ...) __attribute__((sentinel));
570int ca_context_cancel(ca_context *c, uint32_t id);
571int ca_context_playing(ca_context *c, uint32_t id, int *playing);
572
573const char *ca_strerror(int code);
574
575#ifdef __cplusplus
576}
577#endif
578
579#endif
580

Warning: That file was not part of the compilation database. It may have many parsing errors.