2 This file is part of GNUnet
3 (C) 2013 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file include/gnunet_speaker_lib.h
23 * @brief API to access an audio speaker; provides access to hardware speakers
24 * @author Simon Dieterle
25 * @author Andreas Fuchs
26 * @author Christian Grothoff
28 #ifndef GNUNET_SPEAKER_SERVICE_H
29 #define GNUNET_SPEAKER_SERVICE_H
34 #if 0 /* keep Emacsens' auto-indent happy */
40 * Function that enables a speaker.
44 typedef void (*GNUNET_SPEAKER_EnableCallback)(void *cls);
47 * Function that disables a speaker.
51 typedef void (*GNUNET_SPEAKER_DisableCallback)(void *cls);
54 * Function to destroy a speaker.
58 typedef void (*GNUNET_SPEAKER_DestroyCallback)(void *cls);
61 * Function to cause a speaker to play audio data.
64 * @param data_size number of bytes in @a data
65 * @param data audio data to play, format is
66 * opaque to the API but should be OPUS.
68 typedef void (*GNUNET_SPEAKER_PlayCallback)(void *cls,
74 * A speaker is a device that can play or record audio data.
76 struct GNUNET_SPEAKER_Handle
80 * Turn on the speaker.
82 GNUNET_SPEAKER_EnableCallback enable_speaker;
87 GNUNET_SPEAKER_PlayCallback play;
90 * Turn the speaker off.
92 GNUNET_SPEAKER_DisableCallback disable_speaker;
95 * Destroy the speaker. Called by #GNUNET_SPEAKER_destroy.
97 GNUNET_SPEAKER_DestroyCallback destroy_speaker;
100 * Closure for the callbacks.
108 * Create a speaker that corresponds to the speaker hardware
111 * @param cfg configuration to use
112 * @return NULL on error
114 struct GNUNET_SPEAKER_Handle *
115 GNUNET_SPEAKER_create_from_hardware (const struct GNUNET_CONFIGURATION_Handle *cfg);
121 * @param speaker speaker to destroy
124 GNUNET_SPEAKER_destroy (struct GNUNET_SPEAKER_Handle *speaker);
127 #if 0 /* keep Emacsens' auto-indent happy */
135 /* end of gnunet_speaker_lib.h */