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
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., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @author Simon Dieterle
23 * @author Andreas Fuchs
24 * @author Christian Grothoff
27 * API to access an audio microphone; provides access to hardware microphones
29 * @defgroup microphone Microphone library
30 * Provides access to hardware microphones.
33 #ifndef GNUNET_MICROPHONE_SERVICE_H
34 #define GNUNET_MICROPHONE_SERVICE_H
39 #if 0 /* keep Emacsens' auto-indent happy */
44 #include "gnunet_util_lib.h"
47 * Process recorded audio data.
50 * @param data_size number of bytes in @a data
51 * @param data audio data to play
53 typedef void (*GNUNET_MICROPHONE_RecordedDataCallback)(void *cls,
58 * Enable a microphone.
61 * @param rdc function to call with recorded data
62 * @param rdc_cls closure for @a dc
63 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
65 typedef int (*GNUNET_MICROPHONE_EnableCallback)(void *cls,
66 GNUNET_MICROPHONE_RecordedDataCallback rdc,
70 * Function that disables a microphone.
74 typedef void (*GNUNET_MICROPHONE_DisableCallback)(void *cls);
77 * Function to destroy a microphone.
81 typedef void (*GNUNET_MICROPHONE_DestroyCallback)(void *cls);
85 * A microphone is a device that can capture or otherwise produce audio data.
87 struct GNUNET_MICROPHONE_Handle
91 * Turn on the microphone.
93 GNUNET_MICROPHONE_EnableCallback enable_microphone;
96 * Turn the microphone off.
98 GNUNET_MICROPHONE_DisableCallback disable_microphone;
101 * Destroy the microphone. Called by #GNUNET_MICROPHONE_destroy.
103 GNUNET_MICROPHONE_DestroyCallback destroy_microphone;
106 * Closure for the callbacks.
114 * Create a microphone that corresponds to the microphone hardware
117 * @param cfg configuration to use
118 * @return NULL on error
120 struct GNUNET_MICROPHONE_Handle *
121 GNUNET_MICROPHONE_create_from_hardware (const struct GNUNET_CONFIGURATION_Handle *cfg);
125 * Destroy a microphone.
127 * @param microphone microphone to destroy
130 GNUNET_MICROPHONE_destroy (struct GNUNET_MICROPHONE_Handle *microphone);
133 #if 0 /* keep Emacsens' auto-indent happy */
142 /** @} */ /* end of group */
144 /* end of gnunet_microphone_lib.h */