libcallaudio

libcallaudio — Call audio control library

Functions

Types and Values

Description

To use the library call call_audio_init(). After initializing the library you can send audio routing requests using the library functions. When your application finishes call call_audio_deinit() to free resources:

1
2
3
4
5
6
7
8
9
10
11
12
#include <libcallaudio.h>

int main(void)
{
   g_autoptr(GError) *err = NULL;
   if (call_audio_init(&err)) {
     g_error("%s", err->message);
   }
   ...
   call_audio_deinit();
   return 0;
}

Functions

CallAudioCallback ()

void
(*CallAudioCallback) (gboolean success,
                      GError *error,
                      gpointer data);

call_audio_init ()

gboolean
call_audio_init (GError **error);

Initialize libcallaudio. This must be called before any other functions.

Parameters

error

Error information

 

Returns

TRUE if successful, or FALSE on error.


call_audio_is_inited ()

gboolean
call_audio_is_inited (void);

Query whether libcallaudio has been initialized before. This can be used to ensure library calls will perform actual actions.

Returns

TRUE if libcallaudio has been initialized, FALSE otherwise.


call_audio_deinit ()

void
call_audio_deinit (void);

Uninitialize the library when no longer used. Usually called on program shutdown.


call_audio_select_mode ()

gboolean
call_audio_select_mode (CallAudioMode mode,
                        GError **error);

Select the audio mode to use. This function is synchronous, and will return only once the operation has been executed.

Parameters

mode

Audio mode to select

 

error

The error that will be set if the audio mode could not be selected.

 

Returns

TRUE if successful, or FALSE on error.


call_audio_select_mode_async ()

gboolean
call_audio_select_mode_async (CallAudioMode mode,
                              CallAudioCallback cb,
                              gpointer data);

Select the audio mode to use.

Parameters

mode

Audio mode to select

 

cb

Function to be called when operation completes

 

data

User data to be passed to the callback function after completion

 

call_audio_enable_speaker ()

gboolean
call_audio_enable_speaker (gboolean enable,
                           GError **error);

Enable or disable speaker output. This function is synchronous, and will return only once the operation has been executed.

Parameters

enable

Desired speaker state

 

error

The error that will be set if the audio mode could not be selected.

 

Returns

TRUE if successful, or FALSE on error.


call_audio_enable_speaker_async ()

gboolean
call_audio_enable_speaker_async (gboolean enable,
                                 CallAudioCallback cb,
                                 gpointer data);

Enable or disable speaker output.

Parameters

enable

Desired speaker state

 

cb

Function to be called when operation completes

 

data

User data to be passed to the callback function after completion

 

call_audio_mute_mic ()

gboolean
call_audio_mute_mic (gboolean mute,
                     GError **error);

Mute or unmute microphone. This function is synchronous, and will return only once the operation has been executed.

Parameters

mute

TRUE to mute the microphone, or FALSE to unmute it

 

error

The error that will be set if the audio mode could not be selected.

 

Returns

TRUE if successful, or FALSE on error.


call_audio_mute_mic_async ()

gboolean
call_audio_mute_mic_async (gboolean mute,
                           CallAudioCallback cb,
                           gpointer data);

Mute or unmute microphone.

Parameters

mute

TRUE to mute the microphone, or FALSE to unmute it

 

cb

Function to be called when operation completes

 

data

User data to be passed to the callback function after completion

 

Types and Values

enum CallAudioMode

Enum values to indicate the mode to be selected.

Members

CALL_AUDIO_MODE_DEFAULT

Default mode (used for music, alarms, ringtones...)

 

CALL_AUDIO_MODE_CALL

Voice call mode