GNUnet 0.21.1

Access hardware audio speakers. More...

Collaboration diagram for Speaker service:

Data Structures

struct  GNUNET_SPEAKER_Handle
 A speaker is a device that can play or record audio data. More...
 

Typedefs

typedef int(* GNUNET_SPEAKER_EnableCallback) (void *cls)
 Function that enables a speaker. More...
 
typedef void(* GNUNET_SPEAKER_DisableCallback) (void *cls)
 Function that disables a speaker. More...
 
typedef void(* GNUNET_SPEAKER_DestroyCallback) (void *cls)
 Function to destroy a speaker. More...
 
typedef void(* GNUNET_SPEAKER_PlayCallback) (void *cls, size_t data_size, const void *data)
 Function to cause a speaker to play audio data. More...
 

Functions

struct GNUNET_SPEAKER_HandleGNUNET_SPEAKER_create_from_hardware (const struct GNUNET_CONFIGURATION_Handle *cfg)
 Create a speaker that corresponds to the speaker hardware of our system. More...
 
void GNUNET_SPEAKER_destroy (struct GNUNET_SPEAKER_Handle *speaker)
 Destroy a speaker. More...
 

Detailed Description

Access hardware audio speakers.

Typedef Documentation

◆ GNUNET_SPEAKER_EnableCallback

typedef int(* GNUNET_SPEAKER_EnableCallback) (void *cls)

Function that enables a speaker.

Parameters
clsclosure
Returns
GNUNET_OK on success, GNUNET_SYSERR on error

Definition at line 56 of file gnunet_speaker_lib.h.

◆ GNUNET_SPEAKER_DisableCallback

typedef void(* GNUNET_SPEAKER_DisableCallback) (void *cls)

Function that disables a speaker.

Parameters
clsclosure

Definition at line 63 of file gnunet_speaker_lib.h.

◆ GNUNET_SPEAKER_DestroyCallback

typedef void(* GNUNET_SPEAKER_DestroyCallback) (void *cls)

Function to destroy a speaker.

Parameters
clsclosure

Definition at line 70 of file gnunet_speaker_lib.h.

◆ GNUNET_SPEAKER_PlayCallback

typedef void(* GNUNET_SPEAKER_PlayCallback) (void *cls, size_t data_size, const void *data)

Function to cause a speaker to play audio data.

Parameters
clsclosure
data_sizenumber of bytes in data
dataaudio data to play, format is opaque to the API but should be OPUS.

Definition at line 80 of file gnunet_speaker_lib.h.

Function Documentation

◆ GNUNET_SPEAKER_create_from_hardware()

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.

Parameters
cfgconfiguration to use
Returns
NULL on error

Definition at line 158 of file speaker.c.

160{
162 struct Speaker *spe;
163
164 spe = GNUNET_new (struct Speaker);
165 spe->cfg = cfg;
167 speaker->cls = spe;
169 speaker->play = &play;
172 return speaker;
173}
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:109
static struct GNUNET_SPEAKER_Handle * speaker
Handle to the speaker.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static void disable(void *cls)
Function that disables a speaker.
Definition: speaker.c:86
static int enable(void *cls)
Function that enables a speaker.
Definition: speaker.c:57
static void destroy(void *cls)
Function to destroy a speaker.
Definition: speaker.c:108
static void play(void *cls, size_t data_size, const void *data)
Function to cause a speaker to play audio data.
Definition: speaker.c:126
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.
Internal data structures for the speaker.
Definition: speaker.c:37
const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: speaker.c:41

References cfg, Speaker::cfg, GNUNET_SPEAKER_Handle::cls, destroy(), GNUNET_SPEAKER_Handle::destroy_speaker, disable(), GNUNET_SPEAKER_Handle::disable_speaker, enable(), GNUNET_SPEAKER_Handle::enable_speaker, GNUNET_new, play(), GNUNET_SPEAKER_Handle::play, and speaker.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_SPEAKER_destroy()

void GNUNET_SPEAKER_destroy ( struct GNUNET_SPEAKER_Handle speaker)

Destroy a speaker.

Parameters
speakerspeaker to destroy

Definition at line 182 of file speaker.c.

183{
186}
#define GNUNET_free(ptr)
Wrapper around free.

References GNUNET_SPEAKER_Handle::cls, GNUNET_SPEAKER_Handle::destroy_speaker, GNUNET_free, and speaker.

Referenced by do_shutdown(), and do_stop_task().

Here is the caller graph for this function: