Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>canberra</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<link rel="home" href="index.html" title="libcanberra Reference Manual">
<link rel="up" href="ch01.html" title="libcanberra">
<link rel="prev" href="ch01.html" title="libcanberra">
<link rel="next" href="libcanberra-canberra-gtk.html" title="canberra-gtk">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="ch01.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">libcanberra Reference Manual</th>
<td><a accesskey="n" href="libcanberra-canberra-gtk.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#libcanberra-canberra.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#libcanberra-canberra.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="libcanberra-canberra"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libcanberra-canberra.top_of_page"></a>canberra</span></h2>
<p>canberra — General libcanberra API</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="libcanberra-canberra.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-MEDIA-NAME:CAPS" title="CA_PROP_MEDIA_NAME">CA_PROP_MEDIA_NAME</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-MEDIA-TITLE:CAPS" title="CA_PROP_MEDIA_TITLE">CA_PROP_MEDIA_TITLE</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-MEDIA-ARTIST:CAPS" title="CA_PROP_MEDIA_ARTIST">CA_PROP_MEDIA_ARTIST</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-MEDIA-LANGUAGE:CAPS" title="CA_PROP_MEDIA_LANGUAGE">CA_PROP_MEDIA_LANGUAGE</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-MEDIA-FILENAME:CAPS" title="CA_PROP_MEDIA_FILENAME">CA_PROP_MEDIA_FILENAME</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-MEDIA-ICON:CAPS" title="CA_PROP_MEDIA_ICON">CA_PROP_MEDIA_ICON</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-MEDIA-ICON-NAME:CAPS" title="CA_PROP_MEDIA_ICON_NAME">CA_PROP_MEDIA_ICON_NAME</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-MEDIA-ROLE:CAPS" title="CA_PROP_MEDIA_ROLE">CA_PROP_MEDIA_ROLE</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-ID:CAPS" title="CA_PROP_EVENT_ID">CA_PROP_EVENT_ID</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-DESCRIPTION:CAPS" title="CA_PROP_EVENT_DESCRIPTION">CA_PROP_EVENT_DESCRIPTION</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-MOUSE-X:CAPS" title="CA_PROP_EVENT_MOUSE_X">CA_PROP_EVENT_MOUSE_X</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-MOUSE-Y:CAPS" title="CA_PROP_EVENT_MOUSE_Y">CA_PROP_EVENT_MOUSE_Y</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-MOUSE-HPOS:CAPS" title="CA_PROP_EVENT_MOUSE_HPOS">CA_PROP_EVENT_MOUSE_HPOS</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-MOUSE-VPOS:CAPS" title="CA_PROP_EVENT_MOUSE_VPOS">CA_PROP_EVENT_MOUSE_VPOS</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-MOUSE-BUTTON:CAPS" title="CA_PROP_EVENT_MOUSE_BUTTON">CA_PROP_EVENT_MOUSE_BUTTON</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-WINDOW-NAME:CAPS" title="CA_PROP_WINDOW_NAME">CA_PROP_WINDOW_NAME</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-WINDOW-ID:CAPS" title="CA_PROP_WINDOW_ID">CA_PROP_WINDOW_ID</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-WINDOW-ICON:CAPS" title="CA_PROP_WINDOW_ICON">CA_PROP_WINDOW_ICON</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-WINDOW-ICON-NAME:CAPS" title="CA_PROP_WINDOW_ICON_NAME">CA_PROP_WINDOW_ICON_NAME</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-WINDOW-X11-DISPLAY:CAPS" title="CA_PROP_WINDOW_X11_DISPLAY">CA_PROP_WINDOW_X11_DISPLAY</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-WINDOW-X11-SCREEN:CAPS" title="CA_PROP_WINDOW_X11_SCREEN">CA_PROP_WINDOW_X11_SCREEN</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-WINDOW-X11-MONITOR:CAPS" title="CA_PROP_WINDOW_X11_MONITOR">CA_PROP_WINDOW_X11_MONITOR</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-WINDOW-X11-XID:CAPS" title="CA_PROP_WINDOW_X11_XID">CA_PROP_WINDOW_X11_XID</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-NAME:CAPS" title="CA_PROP_APPLICATION_NAME">CA_PROP_APPLICATION_NAME</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-ID:CAPS" title="CA_PROP_APPLICATION_ID">CA_PROP_APPLICATION_ID</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-VERSION:CAPS" title="CA_PROP_APPLICATION_VERSION">CA_PROP_APPLICATION_VERSION</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-ICON:CAPS" title="CA_PROP_APPLICATION_ICON">CA_PROP_APPLICATION_ICON</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-ICON-NAME:CAPS" title="CA_PROP_APPLICATION_ICON_NAME">CA_PROP_APPLICATION_ICON_NAME</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-LANGUAGE:CAPS" title="CA_PROP_APPLICATION_LANGUAGE">CA_PROP_APPLICATION_LANGUAGE</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-PROCESS-ID:CAPS" title="CA_PROP_APPLICATION_PROCESS_ID">CA_PROP_APPLICATION_PROCESS_ID</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-PROCESS-BINARY:CAPS" title="CA_PROP_APPLICATION_PROCESS_BINARY">CA_PROP_APPLICATION_PROCESS_BINARY</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-PROCESS-USER:CAPS" title="CA_PROP_APPLICATION_PROCESS_USER">CA_PROP_APPLICATION_PROCESS_USER</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-PROCESS-HOST:CAPS" title="CA_PROP_APPLICATION_PROCESS_HOST">CA_PROP_APPLICATION_PROCESS_HOST</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-CANBERRA-CACHE-CONTROL:CAPS" title="CA_PROP_CANBERRA_CACHE_CONTROL">CA_PROP_CANBERRA_CACHE_CONTROL</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-CANBERRA-VOLUME:CAPS" title="CA_PROP_CANBERRA_VOLUME">CA_PROP_CANBERRA_VOLUME</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-CANBERRA-XDG-THEME-NAME:CAPS" title="CA_PROP_CANBERRA_XDG_THEME_NAME">CA_PROP_CANBERRA_XDG_THEME_NAME</a>
#define             <a class="link" href="libcanberra-canberra.html#CA-PROP-CANBERRA-XDG-THEME-OUTPUT-PROFILE:CAPS" title="CA_PROP_CANBERRA_XDG_THEME_OUTPUT_PROFILE">CA_PROP_CANBERRA_XDG_THEME_OUTPUT_PROFILE</a>

typedef             <a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context">ca_context</a>;
<span class="returnvalue">void</span>                (<a class="link" href="libcanberra-canberra.html#ca-finish-callback-t" title="ca_finish_callback_t ()">*ca_finish_callback_t</a>)             (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code><span class="type">uint32_t</span> id</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> error_code</code></em>,
                                                         <em class="parameter"><code><span class="type">void</span> *userdata</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-context-create" title="ca_context_create ()">ca_context_create</a>                   (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> **c</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-context-destroy" title="ca_context_destroy ()">ca_context_destroy</a>                  (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-context-open" title="ca_context_open ()">ca_context_open</a>                     (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-context-set-driver" title="ca_context_set_driver ()">ca_context_set_driver</a>               (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *driver</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-context-change-device" title="ca_context_change_device ()">ca_context_change_device</a>            (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *device</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-context-change-props" title="ca_context_change_props ()">ca_context_change_props</a>             (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-context-change-props-full" title="ca_context_change_props_full ()">ca_context_change_props_full</a>        (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> *p</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-context-play" title="ca_context_play ()">ca_context_play</a>                     (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code><span class="type">uint32_t</span> id</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-context-play-full" title="ca_context_play_full ()">ca_context_play_full</a>                (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code><span class="type">uint32_t</span> id</code></em>,
                                                         <em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> *p</code></em>,
                                                         <em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-finish-callback-t" title="ca_finish_callback_t ()"><span class="type">ca_finish_callback_t</span></a> cb</code></em>,
                                                         <em class="parameter"><code><span class="type">void</span> *userdata</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-context-cancel" title="ca_context_cancel ()">ca_context_cancel</a>                   (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code><span class="type">uint32_t</span> id</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-context-cache" title="ca_context_cache ()">ca_context_cache</a>                    (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-context-cache-full" title="ca_context_cache_full ()">ca_context_cache_full</a>               (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> *p</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-context-playing" title="ca_context_playing ()">ca_context_playing</a>                  (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code><span class="type">uint32_t</span> id</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> *playing</code></em>);

const <span class="returnvalue">char</span> *        <a class="link" href="libcanberra-canberra.html#ca-strerror" title="ca_strerror ()">ca_strerror</a>                         (<em class="parameter"><code><span class="type">int</span> code</code></em>);

typedef             <a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist">ca_proplist</a>;
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-proplist-create" title="ca_proplist_create ()">ca_proplist_create</a>                  (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> **p</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-proplist-destroy" title="ca_proplist_destroy ()">ca_proplist_destroy</a>                 (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> *p</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-proplist-sets" title="ca_proplist_sets ()">ca_proplist_sets</a>                    (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> *p</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *key</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *value</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-proplist-setf" title="ca_proplist_setf ()">ca_proplist_setf</a>                    (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> *p</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *key</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="libcanberra-canberra.html#ca-proplist-set" title="ca_proplist_set ()">ca_proplist_set</a>                     (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> *p</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *key</code></em>,
                                                         <em class="parameter"><code>const <span class="type">void</span> *data</code></em>,
                                                         <em class="parameter"><code><span class="type">size_t</span> nbytes</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="libcanberra-canberra.description"></a><h2>Description</h2>
<p>
libcanberra defines a simple abstract interface for playing event sounds.
</p>
<p>
libcanberra relies on the XDG sound naming specification for
identifying event sounds. On Unix/Linux the right sound to play is
found via the mechanisms defined in the XDG sound themeing
specification. On other systems the XDG sound name is translated to
the native sound id for the operating system.
</p>
<p>
An event sound is triggered via libcanberra by calling the
<a class="link" href="libcanberra-canberra.html#ca-context-play" title="ca_context_play ()"><code class="function">ca_context_play()</code></a> function on a previously created ca_context
object. The <a class="link" href="libcanberra-canberra.html#ca-context-play" title="ca_context_play ()"><code class="function">ca_context_play()</code></a> takes a list of key-value pairs that
describe the event sound to generate as closely as possible. The
most important property is <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-ID:CAPS" title="CA_PROP_EVENT_ID"><code class="literal">CA_PROP_EVENT_ID</code></a> which defines the XDG
sound name for the sound to play.
</p>
<p>
libcanberra is not a generic event abstraction system. It's only
purpose is playing sounds -- however in a very elaborate way. As
much information about the context the sound is triggered from
shall be supplied to the sound system as possible, so that it can
replace the sound with some other kind of feedback for a11y
cases. Also this additional information can be used to enhance user
experience (e.g. by positioning sounds in space depending on the
place on the screen the sound was triggered from, and similar
uses).
</p>
<p>
The set of properties defined for event sounds is extensible and
shared with other audio systems, such as PulseAudio. Some of
the properties that may be set are specific to an application, to a
window, to an input event or to the media being played back.
</p>
<p>
The user can attach a set of properties to the context itself,
which is than automatically inherited by each sample being played
back. (<a class="link" href="libcanberra-canberra.html#ca-context-change-props" title="ca_context_change_props ()"><code class="function">ca_context_change_props()</code></a>).
</p>
<p>
Some of the properties can be filled in by libcanberra or one of
its backends automatically and thus need not be be filled in by the
application (such as <a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-PROCESS-ID:CAPS" title="CA_PROP_APPLICATION_PROCESS_ID"><code class="literal">CA_PROP_APPLICATION_PROCESS_ID</code></a> and
friends). However the application can always overwrite any of these
implicit properties.
</p>
<p>
libcanberra is thread-safe and OOM-safe (as far as the backend
allows this). It is not async-signal safe.
</p>
<p>
Most libcanberra functions return an integer that indicates success
when 0 (<code class="literal">CA_SUCCESS</code>) or an error when negative. In the latter case
<a class="link" href="libcanberra-canberra.html#ca-strerror" title="ca_strerror ()"><code class="function">ca_strerror()</code></a> can be used to convert this code into a human
readable string.
</p>
<p>
libcanberra property names need to be in 7bit ASCII, string
property values UTF8.
</p>
<p>
Optionally a libcanberra backend can support caching of sounds in a
sound system. If this functionality is used, the latencies for
event sound playback can be much smaller and fewer resources are
needed to start playback. If a backend does not support cacheing,
the respective functions will return an error code of
<code class="literal">CA_ERROR_NOTSUPPORTED</code>.
</p>
<p>
It is highly recommended that the application sets the
<a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-NAME:CAPS" title="CA_PROP_APPLICATION_NAME"><code class="literal">CA_PROP_APPLICATION_NAME</code></a>, <a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-ID:CAPS" title="CA_PROP_APPLICATION_ID"><code class="literal">CA_PROP_APPLICATION_ID</code></a>,
<a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-ICON-NAME:CAPS" title="CA_PROP_APPLICATION_ICON_NAME"><code class="literal">CA_PROP_APPLICATION_ICON_NAME</code></a>/<a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-ICON:CAPS" title="CA_PROP_APPLICATION_ICON"><code class="literal">CA_PROP_APPLICATION_ICON</code></a> properties
immediately after creating the ca_context, before calling
<a class="link" href="libcanberra-canberra.html#ca-context-open" title="ca_context_open ()"><code class="function">ca_context_open()</code></a> or <a class="link" href="libcanberra-canberra.html#ca-context-play" title="ca_context_play ()"><code class="function">ca_context_play()</code></a>.
</p>
<p>
Its is highly recommended to pass at least <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-ID:CAPS" title="CA_PROP_EVENT_ID"><code class="literal">CA_PROP_EVENT_ID</code></a>,
<a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-DESCRIPTION:CAPS" title="CA_PROP_EVENT_DESCRIPTION"><code class="literal">CA_PROP_EVENT_DESCRIPTION</code></a> to <a class="link" href="libcanberra-canberra.html#ca-context-play" title="ca_context_play ()"><code class="function">ca_context_play()</code></a> for each event
sound generated. For sound events based on mouse inputs events
<a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-MOUSE-X:CAPS" title="CA_PROP_EVENT_MOUSE_X"><code class="literal">CA_PROP_EVENT_MOUSE_X</code></a>, <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-MOUSE-Y:CAPS" title="CA_PROP_EVENT_MOUSE_Y"><code class="literal">CA_PROP_EVENT_MOUSE_Y</code></a>, <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-MOUSE-HPOS:CAPS" title="CA_PROP_EVENT_MOUSE_HPOS"><code class="literal">CA_PROP_EVENT_MOUSE_HPOS</code></a>,
<a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-MOUSE-VPOS:CAPS" title="CA_PROP_EVENT_MOUSE_VPOS"><code class="literal">CA_PROP_EVENT_MOUSE_VPOS</code></a>, <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-MOUSE-BUTTON:CAPS" title="CA_PROP_EVENT_MOUSE_BUTTON"><code class="literal">CA_PROP_EVENT_MOUSE_BUTTON</code></a> should be
passed. For sound events attached to a widget on the screen, the
<code class="literal">CA_PROP_WINDOW_xxx</code> properties should be set.
</p>
</div>
<div class="refsect1">
<a name="libcanberra-canberra.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="CA-PROP-MEDIA-NAME:CAPS"></a><h3>CA_PROP_MEDIA_NAME</h3>
<pre class="programlisting">#define CA_PROP_MEDIA_NAME                         "media.name"
</pre>
<p>
A name describing the media being played. Localized if possible and applicable.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-MEDIA-TITLE:CAPS"></a><h3>CA_PROP_MEDIA_TITLE</h3>
<pre class="programlisting">#define CA_PROP_MEDIA_TITLE                        "media.title"
</pre>
<p>
A (song) title describing the media being played. Localized if possible and applicable.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-MEDIA-ARTIST:CAPS"></a><h3>CA_PROP_MEDIA_ARTIST</h3>
<pre class="programlisting">#define CA_PROP_MEDIA_ARTIST                       "media.artist"
</pre>
<p>
The artist of this media. Localized if possible and applicable.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-MEDIA-LANGUAGE:CAPS"></a><h3>CA_PROP_MEDIA_LANGUAGE</h3>
<pre class="programlisting">#define CA_PROP_MEDIA_LANGUAGE                     "media.language"
</pre>
<p>
The language this media is in, in some standard POSIX locale string, such as "de_DE".
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-MEDIA-FILENAME:CAPS"></a><h3>CA_PROP_MEDIA_FILENAME</h3>
<pre class="programlisting">#define CA_PROP_MEDIA_FILENAME                     "media.filename"
</pre>
<p>
The file name this media was or can be loaded from.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-MEDIA-ICON:CAPS"></a><h3>CA_PROP_MEDIA_ICON</h3>
<pre class="programlisting">#define CA_PROP_MEDIA_ICON                         "media.icon"
</pre>
<p>
An icon for this media in binary PNG format.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-MEDIA-ICON-NAME:CAPS"></a><h3>CA_PROP_MEDIA_ICON_NAME</h3>
<pre class="programlisting">#define CA_PROP_MEDIA_ICON_NAME                    "media.icon_name"
</pre>
<p>
An icon name as defined in the XDG icon naming specifcation.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-MEDIA-ROLE:CAPS"></a><h3>CA_PROP_MEDIA_ROLE</h3>
<pre class="programlisting">#define CA_PROP_MEDIA_ROLE                         "media.role"
</pre>
<p>
The "role" this media is played in. For event sounds the string
"event". For other cases strings like "music", "video", "game", ...
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-EVENT-ID:CAPS"></a><h3>CA_PROP_EVENT_ID</h3>
<pre class="programlisting">#define CA_PROP_EVENT_ID                           "event.id"
</pre>
<p>
A textual id for an event sound, as mandated by the XDG sound naming specification.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-EVENT-DESCRIPTION:CAPS"></a><h3>CA_PROP_EVENT_DESCRIPTION</h3>
<pre class="programlisting">#define CA_PROP_EVENT_DESCRIPTION                  "event.description"
</pre>
<p>
A descriptive string for the sound event. Localized if possible and applicable.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-EVENT-MOUSE-X:CAPS"></a><h3>CA_PROP_EVENT_MOUSE_X</h3>
<pre class="programlisting">#define CA_PROP_EVENT_MOUSE_X                      "event.mouse.x"
</pre>
<p>
If this sound event was triggered by a mouse input event, the X
position of the mouse cursor on the screen, formatted as string.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-EVENT-MOUSE-Y:CAPS"></a><h3>CA_PROP_EVENT_MOUSE_Y</h3>
<pre class="programlisting">#define CA_PROP_EVENT_MOUSE_Y                      "event.mouse.y"
</pre>
<p>
If this sound event was triggered by a mouse input event, the Y
position of the mouse cursor on the screen, formatted as string.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-EVENT-MOUSE-HPOS:CAPS"></a><h3>CA_PROP_EVENT_MOUSE_HPOS</h3>
<pre class="programlisting">#define CA_PROP_EVENT_MOUSE_HPOS                   "event.mouse.hpos"
</pre>
<p>
If this sound event was triggered by a mouse input event, the X
position of the mouse cursor as fractional value between 0 and 1,
formatted as string, 0 reflecting the left side of the screen, 1
the right side.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-EVENT-MOUSE-VPOS:CAPS"></a><h3>CA_PROP_EVENT_MOUSE_VPOS</h3>
<pre class="programlisting">#define CA_PROP_EVENT_MOUSE_VPOS                   "event.mouse.vpos"
</pre>
<p>
If this sound event was triggered by a mouse input event, the Y
position of the mouse cursor as fractional value between 0 and 1,
formatted as string, 0 reflecting the top end of the screen, 1
the bottom end.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-EVENT-MOUSE-BUTTON:CAPS"></a><h3>CA_PROP_EVENT_MOUSE_BUTTON</h3>
<pre class="programlisting">#define CA_PROP_EVENT_MOUSE_BUTTON                 "event.mouse.button"
</pre>
<p>
If this sound event was triggered by a mouse input event, the
number of the mouse button that triggered it, formatted as string. 1
for left mouse button, 3 for right, 2 for middle.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-WINDOW-NAME:CAPS"></a><h3>CA_PROP_WINDOW_NAME</h3>
<pre class="programlisting">#define CA_PROP_WINDOW_NAME                        "window.name"
</pre>
<p>
If this sound event was triggered by a window on the screen, the
name of this window as human readable string.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-WINDOW-ID:CAPS"></a><h3>CA_PROP_WINDOW_ID</h3>
<pre class="programlisting">#define CA_PROP_WINDOW_ID                          "window.id"
</pre>
<p>
If this sound event was triggered by a window on the screen, some
identification string for this window, so that the sound system can
recognize specific windows.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-WINDOW-ICON:CAPS"></a><h3>CA_PROP_WINDOW_ICON</h3>
<pre class="programlisting">#define CA_PROP_WINDOW_ICON                        "window.icon"
</pre>
<p>
If this sound event was triggered by a window on the screen, binary
icon data in PNG format for this window.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-WINDOW-ICON-NAME:CAPS"></a><h3>CA_PROP_WINDOW_ICON_NAME</h3>
<pre class="programlisting">#define CA_PROP_WINDOW_ICON_NAME                   "window.icon_name"
</pre>
<p>
If this sound event was triggered by a window on the screen, an
icon name for this window, as defined in the XDG icon naming
specification.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-WINDOW-X11-DISPLAY:CAPS"></a><h3>CA_PROP_WINDOW_X11_DISPLAY</h3>
<pre class="programlisting">#define CA_PROP_WINDOW_X11_DISPLAY                 "window.x11.display"
</pre>
<p>
If this sound event was triggered by a window on the screen and the
windowing system is X11, the X display name of the window (e.g. ":0").
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-WINDOW-X11-SCREEN:CAPS"></a><h3>CA_PROP_WINDOW_X11_SCREEN</h3>
<pre class="programlisting">#define CA_PROP_WINDOW_X11_SCREEN                  "window.x11.screen"
</pre>
<p>
If this sound event was triggered by a window on the screen and the
windowing system is X11, the X screen id of the window formatted as
string (e.g. "0").
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-WINDOW-X11-MONITOR:CAPS"></a><h3>CA_PROP_WINDOW_X11_MONITOR</h3>
<pre class="programlisting">#define CA_PROP_WINDOW_X11_MONITOR                 "window.x11.monitor"
</pre>
<p>
If this sound event was triggered by a window on the screen and the
windowing system is X11, the X monitor id of the window formatted as
string (e.g. "0").
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-WINDOW-X11-XID:CAPS"></a><h3>CA_PROP_WINDOW_X11_XID</h3>
<pre class="programlisting">#define CA_PROP_WINDOW_X11_XID                     "window.x11.xid"
</pre>
<p>
If this sound event was triggered by a window on the screen and the
windowing system is X11, the XID of the window formatted as string.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-APPLICATION-NAME:CAPS"></a><h3>CA_PROP_APPLICATION_NAME</h3>
<pre class="programlisting">#define CA_PROP_APPLICATION_NAME                   "application.name"
</pre>
<p>
The name of the application this sound event was triggered by as
human readable string. (e.g. "GNU Emacs") Localized if possible and
applicable.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-APPLICATION-ID:CAPS"></a><h3>CA_PROP_APPLICATION_ID</h3>
<pre class="programlisting">#define CA_PROP_APPLICATION_ID                     "application.id"
</pre>
<p>
An identifier for the program this sound event was triggered
by. (e.g. "org.gnu.emacs").
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-APPLICATION-VERSION:CAPS"></a><h3>CA_PROP_APPLICATION_VERSION</h3>
<pre class="programlisting">#define CA_PROP_APPLICATION_VERSION                "application.version"
</pre>
<p>
A version number for the program this sound event was triggered
by. (e.g. "22.2")
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-APPLICATION-ICON:CAPS"></a><h3>CA_PROP_APPLICATION_ICON</h3>
<pre class="programlisting">#define CA_PROP_APPLICATION_ICON                   "application.icon"
</pre>
<p>
Binary icon data in PNG format for the application this sound event
is triggered by.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-APPLICATION-ICON-NAME:CAPS"></a><h3>CA_PROP_APPLICATION_ICON_NAME</h3>
<pre class="programlisting">#define CA_PROP_APPLICATION_ICON_NAME              "application.icon_name"
</pre>
<p>
An icon name for the application this sound event is triggered by,
as defined in the XDG icon naming specification.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-APPLICATION-LANGUAGE:CAPS"></a><h3>CA_PROP_APPLICATION_LANGUAGE</h3>
<pre class="programlisting">#define CA_PROP_APPLICATION_LANGUAGE               "application.language"
</pre>
<p>
The locale string the application that is triggering this sound
event is running in. A POSIX locale string such as de_DE<em class="parameter"><code>euro</code></em>.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-APPLICATION-PROCESS-ID:CAPS"></a><h3>CA_PROP_APPLICATION_PROCESS_ID</h3>
<pre class="programlisting">#define CA_PROP_APPLICATION_PROCESS_ID             "application.process.id"
</pre>
<p>
The unix PID of the process that is triggering this sound event, formatted as string.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-APPLICATION-PROCESS-BINARY:CAPS"></a><h3>CA_PROP_APPLICATION_PROCESS_BINARY</h3>
<pre class="programlisting">#define CA_PROP_APPLICATION_PROCESS_BINARY         "application.process.binary"
</pre>
<p>
The path to the process binary of the process that is triggering this sound event.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-APPLICATION-PROCESS-USER:CAPS"></a><h3>CA_PROP_APPLICATION_PROCESS_USER</h3>
<pre class="programlisting">#define CA_PROP_APPLICATION_PROCESS_USER           "application.process.user"
</pre>
<p>
The user that owns the process that is triggering this sound event.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-APPLICATION-PROCESS-HOST:CAPS"></a><h3>CA_PROP_APPLICATION_PROCESS_HOST</h3>
<pre class="programlisting">#define CA_PROP_APPLICATION_PROCESS_HOST           "application.process.host"
</pre>
<p>
The host name of the host the process that is triggering this sound event runs on.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-CANBERRA-CACHE-CONTROL:CAPS"></a><h3>CA_PROP_CANBERRA_CACHE_CONTROL</h3>
<pre class="programlisting">#define CA_PROP_CANBERRA_CACHE_CONTROL             "canberra.cache-control"
</pre>
<p>
A special property that can be used to control the automatic sound
caching of sounds in the sound server. One of "permanent",
"volatile", "never". "permanent" will cause this sample to be
cached in the server permanently. This is useful for very
frequently used sound events such as those used for input
feedback. "volatile" may be used for cacheing sounds in the sound
server temporarily. They will expire after some time or on cache
pressure. Finally, "never" may be used for sounds that should never
be cached, because they are only generated very seldomly or even
only once at most (such as desktop login sounds).
</p>
<p>
If this property is not explicitly passed to <a class="link" href="libcanberra-canberra.html#ca-context-play" title="ca_context_play ()"><code class="function">ca_context_play()</code></a> it
will default to "never". If it is not explicitly passed to
<a class="link" href="libcanberra-canberra.html#ca-context-cache" title="ca_context_cache ()"><code class="function">ca_context_cache()</code></a> it will default to "permanent".
</p>
<p>
If the list of properties is handed on to the sound server this
property is stripped from it.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-CANBERRA-VOLUME:CAPS"></a><h3>CA_PROP_CANBERRA_VOLUME</h3>
<pre class="programlisting">#define CA_PROP_CANBERRA_VOLUME                    "canberra.volume"
</pre>
<p>
A special property that can be used to control the volume this
sound event is played in if the backend supports it. A floating
point value for the decibel multiplier for the sound. 0 dB relates
to zero gain, and is the default volume these sounds are played in.
</p>
<p>
If the list of properties is handed on to the sound server this
property is stripped from it.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-CANBERRA-XDG-THEME-NAME:CAPS"></a><h3>CA_PROP_CANBERRA_XDG_THEME_NAME</h3>
<pre class="programlisting">#define CA_PROP_CANBERRA_XDG_THEME_NAME            "canberra.xdg-theme.name"
</pre>
<p>
A special property that can be used to control the XDG sound theme that
is used for this sample.
</p>
<p>
If the list of properties is handed on to the sound server this
property is stripped from it.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CA-PROP-CANBERRA-XDG-THEME-OUTPUT-PROFILE:CAPS"></a><h3>CA_PROP_CANBERRA_XDG_THEME_OUTPUT_PROFILE</h3>
<pre class="programlisting">#define CA_PROP_CANBERRA_XDG_THEME_OUTPUT_PROFILE  "canberra.xdg-theme.output-profile"
</pre>
<p>
A special property that can be used to control the XDG sound theme
output profile that is used for this sample.
</p>
<p>
If the list of properties is handed on to the sound server this
property is stripped from it.
</p>
</div>
<hr>
<div class="refsect2">
<a name="ca-context"></a><h3>ca_context</h3>
<pre class="programlisting">typedef struct ca_context ca_context;
</pre>
<p>
A libcanberra context object.
</p>
</div>
<hr>
<div class="refsect2">
<a name="ca-finish-callback-t"></a><h3>ca_finish_callback_t ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                (*ca_finish_callback_t)             (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code><span class="type">uint32_t</span> id</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> error_code</code></em>,
                                                         <em class="parameter"><code><span class="type">void</span> *userdata</code></em>);</pre>
<p>
Playback completion event callback. The context this callback is
called in is undefined, it might or might not be called from a
background thread, and from any stack frame. The code implementing
this function may not call any libcanberra API call from this
callback -- this might result in a deadlock. Instead it may only be
used to asynchronously signal some kind of notification object
(semaphore, message queue, ...).
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>The libcanberra context this callback is called for</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>id</code></em> :</span></p></td>
<td>The numerical id passed to the <a class="link" href="libcanberra-canberra.html#ca-context-play-full" title="ca_context_play_full ()"><code class="function">ca_context_play_full()</code></a> when starting the event sound playback.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error_code</code></em> :</span></p></td>
<td>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.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>userdata</code></em> :</span></p></td>
<td>Some arbitrary user data the caller of <a class="link" href="libcanberra-canberra.html#ca-context-play-full" title="ca_context_play_full ()"><code class="function">ca_context_play_full()</code></a> passed in.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-context-create"></a><h3>ca_context_create ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_context_create                   (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> **c</code></em>);</pre>
<p>
Create an (unconnected) context object. This call will not connect
to the sound system, calling this function might even suceed if no
working driver backend is available. To find out if one is
available call <a class="link" href="libcanberra-canberra.html#ca-context-open" title="ca_context_open ()"><code class="function">ca_context_open()</code></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>A pointer wheere to fill in the newly created context object.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-context-destroy"></a><h3>ca_context_destroy ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_context_destroy                  (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>);</pre>
<p>
Destroy a (connected or unconnected) context object.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>the context to destroy.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-context-open"></a><h3>ca_context_open ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_context_open                     (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>);</pre>
<p>
Connect the context to the sound system. This call is implicitly
called in <a class="link" href="libcanberra-canberra.html#ca-context-play" title="ca_context_play ()"><code class="function">ca_context_play()</code></a> or <a class="link" href="libcanberra-canberra.html#ca-context-cache" title="ca_context_cache ()"><code class="function">ca_context_cache()</code></a> if not called
explicitly. It is recommended to initialize application properties
with <a class="link" href="libcanberra-canberra.html#ca-context-change-props" title="ca_context_change_props ()"><code class="function">ca_context_change_props()</code></a> before calling this function.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>the context to connect.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-context-set-driver"></a><h3>ca_context_set_driver ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_context_set_driver               (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *driver</code></em>);</pre>
<p>
Specify the backend driver used. This function may not be called again after
<a class="link" href="libcanberra-canberra.html#ca-context-open" title="ca_context_open ()"><code class="function">ca_context_open()</code></a> suceeded. This function might suceed even when
the specified driver backend is not available. Use
<a class="link" href="libcanberra-canberra.html#ca-context-open" title="ca_context_open ()"><code class="function">ca_context_open()</code></a> to find out whether the backend is available.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>the context to change the backend driver for</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>driver</code></em> :</span></p></td>
<td>the backend driver to use (e.g. "alsa", "pulse", "null", ...)</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-context-change-device"></a><h3>ca_context_change_device ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_context_change_device            (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *device</code></em>);</pre>
<p>
Specify the backend device to use. This function may be called not be called after
<a class="link" href="libcanberra-canberra.html#ca-context-open" title="ca_context_open ()"><code class="function">ca_context_open()</code></a> suceeded. This function might suceed even when
the specified driver backend is not available. Use
<a class="link" href="libcanberra-canberra.html#ca-context-open" title="ca_context_open ()"><code class="function">ca_context_open()</code></a> to find out whether the backend is available
</p>
<p>
Depending on the backend use this might or might not cause all
currently playing event sounds to be moved to the new device..
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>the context to change the backend device for</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>device</code></em> :</span></p></td>
<td>the backend device to use, in a format that is specific to the backend.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-context-change-props"></a><h3>ca_context_change_props ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_context_change_props             (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
Write one or more string properties to the context object. Requires
final NULL sentinel. Properties set like this will be attached to
both the client object of the sound server and to all event sounds
played or cached. It is recommended to call this function at least
once before calling <a class="link" href="libcanberra-canberra.html#ca-context-open" title="ca_context_open ()"><code class="function">ca_context_open()</code></a>, so that the initial
application properties are set properly before the initial
connection to the sound system. This function can be called both
before and after the <a class="link" href="libcanberra-canberra.html#ca-context-open" title="ca_context_open ()"><code class="function">ca_context_open()</code></a> call. Properties that have
already been set before will be overwritten.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>the context to set the properties on.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td>the list of string pairs for the properties. Needs to be a NULL terminated list.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-context-change-props-full"></a><h3>ca_context_change_props_full ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_context_change_props_full        (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> *p</code></em>);</pre>
<p>
Similar to <a class="link" href="libcanberra-canberra.html#ca-context-change-props" title="ca_context_change_props ()"><code class="function">ca_context_change_props()</code></a>, but takes a ca_proplist
instead of a variable list of properties. Can be used to set binary
properties such as <a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-ICON:CAPS" title="CA_PROP_APPLICATION_ICON"><code class="literal">CA_PROP_APPLICATION_ICON</code></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>the context to set the properties on.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>p</code></em> :</span></p></td>
<td>the property list to set.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-context-play"></a><h3>ca_context_play ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_context_play                     (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code><span class="type">uint32_t</span> id</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
Play one event sound. id can be any numeric value which later can
be used to cancel an event sound that is currently being
played. You may use the same id twice or more times if you want to
cancel multiple event sounds with a single <a class="link" href="libcanberra-canberra.html#ca-context-cancel" title="ca_context_cancel ()"><code class="function">ca_context_cancel()</code></a> call
at once. It is recommended to pass 0 for the id if the event sound
shall never be canceled. If the requested sound is not cached in
the server yet this call might result in the sample being uploaded
temporarily or permanently (this may be controlled with <a class="link" href="libcanberra-canberra.html#CA-PROP-CANBERRA-CACHE-CONTROL:CAPS" title="CA_PROP_CANBERRA_CACHE_CONTROL"><code class="literal">CA_PROP_CANBERRA_CACHE_CONTROL</code></a>). This function will start playback
in the background. It will not wait until playback
completed. Depending on the backend used a sound that is started
shortly before your application terminates might or might not continue to
play after your application terminated. If you want to make sure
that all sounds finish to play you need to wait synchronously for
the callback function of <a class="link" href="libcanberra-canberra.html#ca-context-play-full" title="ca_context_play_full ()"><code class="function">ca_context_play_full()</code></a> to be called before you
terminate your application.
</p>
<p>
The sample to play is identified by the <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-ID:CAPS" title="CA_PROP_EVENT_ID"><code class="literal">CA_PROP_EVENT_ID</code></a>
property. If it is already cached in the server the cached version
is played. The properties passed in this call are merged with the
properties supplied when the sample was cached (if applicable)
and the context properties as set with <a class="link" href="libcanberra-canberra.html#ca-context-change-props" title="ca_context_change_props ()"><code class="function">ca_context_change_props()</code></a>.
</p>
<p>
If <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-ID:CAPS" title="CA_PROP_EVENT_ID"><code class="literal">CA_PROP_EVENT_ID</code></a> is not defined the sound file passed in the
<a class="link" href="libcanberra-canberra.html#CA-PROP-MEDIA-FILENAME:CAPS" title="CA_PROP_MEDIA_FILENAME"><code class="literal">CA_PROP_MEDIA_FILENAME</code></a> is played.
</p>
<p>
On Linux/Unix the right sound to play is determined according to
<a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-ID:CAPS" title="CA_PROP_EVENT_ID"><code class="literal">CA_PROP_EVENT_ID</code></a>,
<a class="link" href="libcanberra-canberra.html#CA-PROP-APPLICATION-LANGUAGE:CAPS" title="CA_PROP_APPLICATION_LANGUAGE"><code class="literal">CA_PROP_APPLICATION_LANGUAGE</code></a>/<a class="link" href="libcanberra-canberra.html#CA-PROP-MEDIA-LANGUAGE:CAPS" title="CA_PROP_MEDIA_LANGUAGE"><code class="literal">CA_PROP_MEDIA_LANGUAGE</code></a>, the system
locale, <a class="link" href="libcanberra-canberra.html#CA-PROP-CANBERRA-XDG-THEME-NAME:CAPS" title="CA_PROP_CANBERRA_XDG_THEME_NAME"><code class="literal">CA_PROP_CANBERRA_XDG_THEME_NAME</code></a> and
<a class="link" href="libcanberra-canberra.html#CA-PROP-CANBERRA-XDG-THEME-OUTPUT-PROFILE:CAPS" title="CA_PROP_CANBERRA_XDG_THEME_OUTPUT_PROFILE"><code class="literal">CA_PROP_CANBERRA_XDG_THEME_OUTPUT_PROFILE</code></a>, following the XDG Sound
Theming Specification. On non-Unix systems the native event sound
that matches the XDG sound name in <a class="link" href="libcanberra-canberra.html#CA-PROP-EVENT-ID:CAPS" title="CA_PROP_EVENT_ID"><code class="literal">CA_PROP_EVENT_ID</code></a> is played.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>the context to play the event sound on</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>id</code></em> :</span></p></td>
<td>an integer id this sound can later be identified with when calling <a class="link" href="libcanberra-canberra.html#ca-context-cancel" title="ca_context_cancel ()"><code class="function">ca_context_cancel()</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td>additional properties for this sound event.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-context-play-full"></a><h3>ca_context_play_full ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_context_play_full                (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code><span class="type">uint32_t</span> id</code></em>,
                                                         <em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> *p</code></em>,
                                                         <em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-finish-callback-t" title="ca_finish_callback_t ()"><span class="type">ca_finish_callback_t</span></a> cb</code></em>,
                                                         <em class="parameter"><code><span class="type">void</span> *userdata</code></em>);</pre>
<p>
Play one event sound, and call the specified callback function when
completed. See ca_finish_callback_t for the semantics the callback
is called in. Also see <a class="link" href="libcanberra-canberra.html#ca-context-play" title="ca_context_play ()"><code class="function">ca_context_play()</code></a>.
</p>
<p>
It is guaranteed that the callback is called exactly once if
<a class="link" href="libcanberra-canberra.html#ca-context-play-full" title="ca_context_play_full ()"><code class="function">ca_context_play_full()</code></a> returns CA_SUCCESS. You thus may safely pass
allocated memory to the callback and assume that it is freed
properly.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>the context to play the event sound on</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>id</code></em> :</span></p></td>
<td>an integer id this sound can be later be identified with when calling <a class="link" href="libcanberra-canberra.html#ca-context-cancel" title="ca_context_cancel ()"><code class="function">ca_context_cancel()</code></a> or when the callback is called.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>p</code></em> :</span></p></td>
<td>A property list of properties for this event sound</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cb</code></em> :</span></p></td>
<td>A callback to call when this sound event sucessfully finished playing or when an error occured during playback.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-context-cancel"></a><h3>ca_context_cancel ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_context_cancel                   (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code><span class="type">uint32_t</span> id</code></em>);</pre>
<p>
Cancel one or more event sounds that have been started via
<a class="link" href="libcanberra-canberra.html#ca-context-play" title="ca_context_play ()"><code class="function">ca_context_play()</code></a>. If the sound was started with
<a class="link" href="libcanberra-canberra.html#ca-context-play-full" title="ca_context_play_full ()"><code class="function">ca_context_play_full()</code></a> and a callback function was passed this
might cause this function to be called with <code class="literal">CA_ERROR_CANCELED</code> as
error code.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>the context to cancel the sounds on</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>id</code></em> :</span></p></td>
<td>the id that identify the sounds to cancel.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-context-cache"></a><h3>ca_context_cache ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_context_cache                    (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
Upload the specified sample into the audio server and attach the
specified properties to it. This function will only return after
the sample upload was finished.
</p>
<p>
The sound to cache is found with the same algorithm that is used to
find the sounds for <a class="link" href="libcanberra-canberra.html#ca-context-play" title="ca_context_play ()"><code class="function">ca_context_play()</code></a>.
</p>
<p>
If the backend doesn't support caching sound samples this function
will return <code class="literal">CA_ERROR_NOTSUPPORTED</code>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>The context to use for uploading.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td>The properties for this event sound. Terminated with NULL.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-context-cache-full"></a><h3>ca_context_cache_full ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_context_cache_full               (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> *p</code></em>);</pre>
<p>
Upload the specified sample into the server and attach the
specified properties to it. Similar to <a class="link" href="libcanberra-canberra.html#ca-context-cache" title="ca_context_cache ()"><code class="function">ca_context_cache()</code></a> but takes
a ca_proplist instead of a variable number of arguments.
</p>
<p>
If the backend doesn't support caching sound samples this function
will return CA_ERROR_NOTSUPPORTED.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>The context to use for uploading.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>p</code></em> :</span></p></td>
<td>The property list for this event sound.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-context-playing"></a><h3>ca_context_playing ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_context_playing                  (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-context" title="ca_context"><span class="type">ca_context</span></a> *c</code></em>,
                                                         <em class="parameter"><code><span class="type">uint32_t</span> id</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> *playing</code></em>);</pre>
<p>
Check if at least one sound with the specified id is still
playing. Returns 0 in *playing if no sound with this id is playing
anymore or non-zero if there is at least one playing.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>the context to check if sound is still playing</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>id</code></em> :</span></p></td>
<td>the id that identify the sounds to check</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>playing</code></em> :</span></p></td>
<td>a pointer to a boolean that will be updated with the play status</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 0.16</p>
</div>
<hr>
<div class="refsect2">
<a name="ca-strerror"></a><h3>ca_strerror ()</h3>
<pre class="programlisting">const <span class="returnvalue">char</span> *        ca_strerror                         (<em class="parameter"><code><span class="type">int</span> code</code></em>);</pre>
<p>
Converts a numerical error code as returned by most libcanberra API functions into a human readable error string.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>code</code></em> :</span></p></td>
<td>Numerical error code as returned by a libcanberra API function</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a human readable error string.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-proplist"></a><h3>ca_proplist</h3>
<pre class="programlisting">typedef struct ca_proplist ca_proplist;
</pre>
<p>
A canberra property list object. Basically a hashtable.
</p>
</div>
<hr>
<div class="refsect2">
<a name="ca-proplist-create"></a><h3>ca_proplist_create ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_proplist_create                  (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> **p</code></em>);</pre>
<p>
Allocate a new empty property list.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>p</code></em> :</span></p></td>
<td>A pointer where to fill in a pointer for the new property list.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-proplist-destroy"></a><h3>ca_proplist_destroy ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_proplist_destroy                 (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> *p</code></em>);</pre>
<p>
Destroys a property list that was created with <a class="link" href="libcanberra-canberra.html#ca-proplist-create" title="ca_proplist_create ()"><code class="function">ca_proplist_create()</code></a> earlier.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>p</code></em> :</span></p></td>
<td>The property list to destroy</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-proplist-sets"></a><h3>ca_proplist_sets ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_proplist_sets                    (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> *p</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *key</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *value</code></em>);</pre>
<p>
Add a new string key/value pair to the property list.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>p</code></em> :</span></p></td>
<td>The property list to add this key/value pair to</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
<td>The key for this key/value pair</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
<td>The value for this key/value pair</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-proplist-setf"></a><h3>ca_proplist_setf ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_proplist_setf                    (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> *p</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *key</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
Much like <a class="link" href="libcanberra-canberra.html#ca-proplist-sets" title="ca_proplist_sets ()"><code class="function">ca_proplist_sets()</code></a>: add a new string key/value pair to
the property list. Takes a standard C format string plus arguments
and formats a string of it.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>p</code></em> :</span></p></td>
<td>The property list to add this key/value pair to</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
<td>The key for this key/value pair</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
<td>The format string for the value for this key/value pair</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td>The parameters for the format string</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ca-proplist-set"></a><h3>ca_proplist_set ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 ca_proplist_set                     (<em class="parameter"><code><a class="link" href="libcanberra-canberra.html#ca-proplist" title="ca_proplist"><span class="type">ca_proplist</span></a> *p</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *key</code></em>,
                                                         <em class="parameter"><code>const <span class="type">void</span> *data</code></em>,
                                                         <em class="parameter"><code><span class="type">size_t</span> nbytes</code></em>);</pre>
<p>
Add a new binary key/value pair to the property list.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>p</code></em> :</span></p></td>
<td>The property list to add this key/value pair to</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
<td>The key for this key/value pair</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
<td>The binary value for this key value pair</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>nbytes</code></em> :</span></p></td>
<td>The size of thebinary value for this key value pair.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, negative error code on error.</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>