2 This file is part of GNUnet
3 Copyright (C) 2013 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * @author Simon Dieterle
21 * @author Andreas Fuchs
22 * @author Christian Grothoff
25 * API to access an audio speaker; provides access to hardware speakers
27 * @defgroup speaker Speaker service
28 * Access hardware audio speakers.
31 #ifndef GNUNET_SPEAKER_SERVICE_H
32 #define GNUNET_SPEAKER_SERVICE_H
37 #if 0 /* keep Emacsens' auto-indent happy */
42 #include "gnunet_util_lib.h"
45 * Function that enables a speaker.
48 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
50 typedef int (*GNUNET_SPEAKER_EnableCallback)(void *cls);
53 * Function that disables a speaker.
57 typedef void (*GNUNET_SPEAKER_DisableCallback)(void *cls);
60 * Function to destroy a speaker.
64 typedef void (*GNUNET_SPEAKER_DestroyCallback)(void *cls);
67 * Function to cause a speaker to play audio data.
70 * @param data_size number of bytes in @a data
71 * @param data audio data to play, format is
72 * opaque to the API but should be OPUS.
74 typedef void (*GNUNET_SPEAKER_PlayCallback)(void *cls,
80 * A speaker is a device that can play or record audio data.
82 struct GNUNET_SPEAKER_Handle
86 * Turn on the speaker.
88 GNUNET_SPEAKER_EnableCallback enable_speaker;
93 GNUNET_SPEAKER_PlayCallback play;
96 * Turn the speaker off.
98 GNUNET_SPEAKER_DisableCallback disable_speaker;
101 * Destroy the speaker. Called by #GNUNET_SPEAKER_destroy.
103 GNUNET_SPEAKER_DestroyCallback destroy_speaker;
106 * Closure for the callbacks.
114 * Create a speaker that corresponds to the speaker hardware
117 * @param cfg configuration to use
118 * @return NULL on error
120 struct GNUNET_SPEAKER_Handle *
121 GNUNET_SPEAKER_create_from_hardware (const struct GNUNET_CONFIGURATION_Handle *cfg);
127 * @param speaker speaker to destroy
130 GNUNET_SPEAKER_destroy (struct GNUNET_SPEAKER_Handle *speaker);
133 #if 0 /* keep Emacsens' auto-indent happy */
142 /** @} */ /* end of group */
144 /* end of gnunet_speaker_lib.h */