libcallaudio

libcallaudio — Call audio control library

Functions

Types and Values

Object Hierarchy

    GEnum
    ├── CallAudioMicState
    ├── CallAudioMode
    ╰── CallAudioSpeakerState

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. This data is owned by the caller, which is responsible for freeing it.

 

call_audio_get_audio_mode ()

CallAudioMode
call_audio_get_audio_mode (void);

Returns

The selected CallAudioMode.


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. This data is owned by the caller, which is responsible for freeing it.

 

call_audio_get_speaker_state ()

CallAudioSpeakerState
call_audio_get_speaker_state (void);

Returns

CALL_AUDIO_SPEAKER_ON if the speaker is on, CALL_AUDIO_SPEAKER_OFF if it is off or CALL_AUDIO_SPEAKER_UNKNOWN if the state is not known.


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. This data is owned by the caller, which is responsible for freeing it.

 

call_audio_get_mic_state ()

CallAudioMicState
call_audio_get_mic_state (void);

Returns

CALL_AUDIO_MIC_ON if the microphone is on, CALL_AUDIO_MIC_OFF if it is off or CALL_AUDIO_MIC_UNKNOWN if the state is not known.

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

 

CALL_AUDIO_MODE_UNKNOWN

Mode unknown

 

enum CallAudioSpeakerState

Members

CALL_AUDIO_SPEAKER_OFF

Speaker disabled

 

CALL_AUDIO_SPEAKER_ON

Speaker enabled

 

CALL_AUDIO_SPEAKER_UNKNOWN

Unknown

 

enum CallAudioMicState

Members

CALL_AUDIO_MIC_OFF

Mic disabled

 

CALL_AUDIO_MIC_ON

Mic enabled

 

CALL_AUDIO_MIC_UNKNOWN

Unknown