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.
17 * @author Simon Dieterle
18 * @author Andreas Fuchs
19 * @author Christian Grothoff
22 * API to access an audio microphone; provides access to hardware microphones
24 * @defgroup microphone Microphone library
25 * Provides access to hardware microphones.
28 #ifndef GNUNET_MICROPHONE_SERVICE_H
29 #define GNUNET_MICROPHONE_SERVICE_H
34 #if 0 /* keep Emacsens' auto-indent happy */
39 #include "gnunet_util_lib.h"
42 * Process recorded audio data.
45 * @param data_size number of bytes in @a data
46 * @param data audio data to play
48 typedef void (*GNUNET_MICROPHONE_RecordedDataCallback)(void *cls,
53 * Enable a microphone.
56 * @param rdc function to call with recorded data
57 * @param rdc_cls closure for @a dc
58 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
60 typedef int (*GNUNET_MICROPHONE_EnableCallback)(void *cls,
61 GNUNET_MICROPHONE_RecordedDataCallback rdc,
65 * Function that disables a microphone.
69 typedef void (*GNUNET_MICROPHONE_DisableCallback)(void *cls);
72 * Function to destroy a microphone.
76 typedef void (*GNUNET_MICROPHONE_DestroyCallback)(void *cls);
80 * A microphone is a device that can capture or otherwise produce audio data.
82 struct GNUNET_MICROPHONE_Handle
86 * Turn on the microphone.
88 GNUNET_MICROPHONE_EnableCallback enable_microphone;
91 * Turn the microphone off.
93 GNUNET_MICROPHONE_DisableCallback disable_microphone;
96 * Destroy the microphone. Called by #GNUNET_MICROPHONE_destroy.
98 GNUNET_MICROPHONE_DestroyCallback destroy_microphone;
101 * Closure for the callbacks.
109 * Create a microphone that corresponds to the microphone hardware
112 * @param cfg configuration to use
113 * @return NULL on error
115 struct GNUNET_MICROPHONE_Handle *
116 GNUNET_MICROPHONE_create_from_hardware (const struct GNUNET_CONFIGURATION_Handle *cfg);
120 * Destroy a microphone.
122 * @param microphone microphone to destroy
125 GNUNET_MICROPHONE_destroy (struct GNUNET_MICROPHONE_Handle *microphone);
128 #if 0 /* keep Emacsens' auto-indent happy */
137 /** @} */ /* end of group */
139 /* end of gnunet_microphone_lib.h */