GNUnet  0.20.0
gnunet_speaker_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2013 GNUnet e.V.
4 
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.
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  Affero General Public License for more details.
14 
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/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
36 #ifndef GNUNET_SPEAKER_SERVICE_H
37 #define GNUNET_SPEAKER_SERVICE_H
38 
39 #ifdef __cplusplus
40 extern "C"
41 {
42 #if 0 /* keep Emacsens' auto-indent happy */
43 }
44 #endif
45 #endif
46 
47 
48 #include "gnunet_util_lib.h"
49 
56 typedef int (*GNUNET_SPEAKER_EnableCallback)(void *cls);
57 
63 typedef void (*GNUNET_SPEAKER_DisableCallback)(void *cls);
64 
70 typedef void (*GNUNET_SPEAKER_DestroyCallback)(void *cls);
71 
80 typedef void (*GNUNET_SPEAKER_PlayCallback)(void *cls,
81  size_t data_size,
82  const void *data);
83 
84 
89 {
94 
99 
104 
109 
113  void *cls;
114 };
115 
116 
124 struct GNUNET_SPEAKER_Handle *
127 
128 
134 void
136 
137 
138 #if 0 /* keep Emacsens' auto-indent happy */
139 {
140 #endif
141 #ifdef __cplusplus
142 }
143 #endif
144 
145 #endif
146  /* end of group */
148  /* end of group addition */
150 
151 /* end of gnunet_speaker_lib.h */
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
static struct GNUNET_SPEAKER_Handle * speaker
Handle to the speaker.
uint32_t data
The data value.
void(* GNUNET_SPEAKER_DestroyCallback)(void *cls)
Function to destroy a speaker.
int(* GNUNET_SPEAKER_EnableCallback)(void *cls)
Function that enables a speaker.
struct GNUNET_SPEAKER_Handle * GNUNET_SPEAKER_create_from_hardware(const struct GNUNET_CONFIGURATION_Handle *cfg)
Create a speaker that corresponds to the speaker hardware of our system.
Definition: speaker.c:158
void(* GNUNET_SPEAKER_PlayCallback)(void *cls, size_t data_size, const void *data)
Function to cause a speaker to play audio data.
void GNUNET_SPEAKER_destroy(struct GNUNET_SPEAKER_Handle *speaker)
Destroy a speaker.
Definition: speaker.c:182
void(* GNUNET_SPEAKER_DisableCallback)(void *cls)
Function that disables a speaker.
A speaker is a device that can play or record audio data.
GNUNET_SPEAKER_DestroyCallback destroy_speaker
Destroy the speaker.
void * cls
Closure for the callbacks.
GNUNET_SPEAKER_PlayCallback play
Play audio.
GNUNET_SPEAKER_EnableCallback enable_speaker
Turn on the speaker.
GNUNET_SPEAKER_DisableCallback disable_speaker
Turn the speaker off.