GNUnet 0.22.2

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 160 of file speaker.c.

162{
164 struct Speaker *spe;
165
166 spe = GNUNET_new (struct Speaker);
167 spe->cfg = cfg;
169 speaker->cls = spe;
171 speaker->play = &play;
174 return speaker;
175}
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:108
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:88
static int enable(void *cls)
Function that enables a speaker.
Definition: speaker.c:58
static void destroy(void *cls)
Function to destroy a speaker.
Definition: speaker.c:110
static void play(void *cls, size_t data_size, const void *data)
Function to cause a speaker to play audio data.
Definition: speaker.c:128
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:38
const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: speaker.c:42

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 184 of file speaker.c.

185{
188}
#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: