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 microphone; provides access to hardware microphones
27 * @defgroup microphone Microphone library
28 * Provides access to hardware microphones.
31 #ifndef GNUNET_MICROPHONE_SERVICE_H
32 #define GNUNET_MICROPHONE_SERVICE_H
37 #if 0 /* keep Emacsens' auto-indent happy */
42 #include "gnunet_util_lib.h"
45 * Process recorded audio data.
48 * @param data_size number of bytes in @a data
49 * @param data audio data to play
51 typedef void (*GNUNET_MICROPHONE_RecordedDataCallback)(void *cls,
56 * Enable a microphone.
59 * @param rdc function to call with recorded data
60 * @param rdc_cls closure for @a dc
61 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
63 typedef int (*GNUNET_MICROPHONE_EnableCallback)(void *cls,
64 GNUNET_MICROPHONE_RecordedDataCallback rdc,
68 * Function that disables a microphone.
72 typedef void (*GNUNET_MICROPHONE_DisableCallback)(void *cls);
75 * Function to destroy a microphone.
79 typedef void (*GNUNET_MICROPHONE_DestroyCallback)(void *cls);
83 * A microphone is a device that can capture or otherwise produce audio data.
85 struct GNUNET_MICROPHONE_Handle
89 * Turn on the microphone.
91 GNUNET_MICROPHONE_EnableCallback enable_microphone;
94 * Turn the microphone off.
96 GNUNET_MICROPHONE_DisableCallback disable_microphone;
99 * Destroy the microphone. Called by #GNUNET_MICROPHONE_destroy.
101 GNUNET_MICROPHONE_DestroyCallback destroy_microphone;
104 * Closure for the callbacks.
112 * Create a microphone that corresponds to the microphone hardware
115 * @param cfg configuration to use
116 * @return NULL on error
118 struct GNUNET_MICROPHONE_Handle *
119 GNUNET_MICROPHONE_create_from_hardware (const struct GNUNET_CONFIGURATION_Handle *cfg);
123 * Destroy a microphone.
125 * @param microphone microphone to destroy
128 GNUNET_MICROPHONE_destroy (struct GNUNET_MICROPHONE_Handle *microphone);
131 #if 0 /* keep Emacsens' auto-indent happy */
140 /** @} */ /* end of group */
142 /* end of gnunet_microphone_lib.h */