aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_speaker_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-02 19:06:07 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-02 19:06:07 +0000
commitec9740ca2ca84525842e6743b45ceb9cb2a3ea95 (patch)
tree5382b500ec7e5e66197d697c40a69bf4b0cb890f /src/include/gnunet_speaker_lib.h
parent705d8a8c1efe6cd7f0d9a452e8bb89cd7923fe99 (diff)
downloadgnunet-ec9740ca2ca84525842e6743b45ceb9cb2a3ea95.tar.gz
gnunet-ec9740ca2ca84525842e6743b45ceb9cb2a3ea95.zip
-split off microphone/speaker APIs
Diffstat (limited to 'src/include/gnunet_speaker_lib.h')
-rw-r--r--src/include/gnunet_speaker_lib.h135
1 files changed, 135 insertions, 0 deletions
diff --git a/src/include/gnunet_speaker_lib.h b/src/include/gnunet_speaker_lib.h
new file mode 100644
index 000000000..567b984e0
--- /dev/null
+++ b/src/include/gnunet_speaker_lib.h
@@ -0,0 +1,135 @@
1/*
2 This file is part of GNUnet
3 (C) 2013 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19 */
20
21/**
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
27 */
28#ifndef GNUNET_SPEAKER_SERVICE_H
29#define GNUNET_SPEAKER_SERVICE_H
30
31#ifdef __cplusplus
32extern "C"
33{
34#if 0 /* keep Emacsens' auto-indent happy */
35}
36#endif
37#endif
38
39/**
40 * Function that enables a speaker.
41 *
42 * @param cls clsoure
43 */
44typedef void (*GNUNET_SPEAKER_EnableCallback)(void *cls);
45
46/**
47 * Function that disables a speaker.
48 *
49 * @param cls clsoure
50 */
51typedef void (*GNUNET_SPEAKER_DisableCallback)(void *cls);
52
53/**
54 * Function to destroy a speaker.
55 *
56 * @param cls clsoure
57 */
58typedef void (*GNUNET_SPEAKER_DestroyCallback)(void *cls);
59
60/**
61 * Function to cause a speaker to play audio data.
62 *
63 * @param cls clsoure
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.
67 */
68typedef void (*GNUNET_SPEAKER_PlayCallback)(void *cls,
69 size_t data_size,
70 const void *data);
71
72
73/**
74 * A speaker is a device that can play or record audio data.
75 */
76struct GNUNET_SPEAKER_Handle
77{
78
79 /**
80 * Turn on the speaker.
81 */
82 GNUNET_SPEAKER_EnableCallback enable_speaker;
83
84 /**
85 * Play audio.
86 */
87 GNUNET_SPEAKER_PlayCallback play;
88
89 /**
90 * Turn the speaker off.
91 */
92 GNUNET_SPEAKER_DisableCallback disable_speaker;
93
94 /**
95 * Destroy the speaker. Called by #GNUNET_SPEAKER_destroy.
96 */
97 GNUNET_SPEAKER_DestroyCallback destroy_speaker;
98
99 /**
100 * Closure for the callbacks.
101 */
102 void *cls;
103
104};
105
106
107/**
108 * Create a speaker that corresponds to the speaker hardware
109 * of our system.
110 *
111 * @param cfg configuration to use
112 * @return NULL on error
113 */
114struct GNUNET_SPEAKER_Handle *
115GNUNET_SPEAKER_create_from_hardware (const struct GNUNET_CONFIGURATION_Handle *cfg);
116
117
118/**
119 * Destroy a speaker.
120 *
121 * @param speaker speaker to destroy
122 */
123void
124GNUNET_SPEAKER_destroy (struct GNUNET_SPEAKER_Handle *speaker);
125
126
127#if 0 /* keep Emacsens' auto-indent happy */
128{
129#endif
130#ifdef __cplusplus
131}
132#endif
133
134#endif
135/* end of gnunet_speaker_lib.h */