pnmixer
Volume mixer for the system tray
Typedefs | Enumerations | Functions
alsa.h File Reference

Header for alsa.c. More...

#include <glib.h>
Include dependency graph for alsa.h:

Go to the source code of this file.

Typedefs

typedef struct alsa_card AlsaCard
 
typedef void(* AlsaCb) (enum alsa_event event, gpointer data)
 

Enumerations

enum  alsa_event { ALSA_CARD_ERROR, ALSA_CARD_DISCONNECTED, ALSA_CARD_VALUES_CHANGED }
 

Functions

GSList * alsa_list_cards (void)
 
GSList * alsa_list_channels (const char *card_name)
 
AlsaCardalsa_card_new (const char *card, const char *channel, gboolean normalize)
 
void alsa_card_free (AlsaCard *card)
 
void alsa_card_install_callback (AlsaCard *card, AlsaCb callback, gpointer data)
 
const char * alsa_card_get_name (AlsaCard *card)
 
const char * alsa_card_get_channel (AlsaCard *card)
 
gboolean alsa_card_has_mute (AlsaCard *card)
 
gboolean alsa_card_is_muted (AlsaCard *card)
 
void alsa_card_toggle_mute (AlsaCard *card)
 
gdouble alsa_card_get_volume (AlsaCard *card)
 
void alsa_card_set_volume (AlsaCard *card, gdouble value, int dir)
 

Detailed Description

Header for alsa.c.

Header for alsa.c.

Definition in file alsa.h.

Typedef Documentation

◆ AlsaCard

typedef struct alsa_card AlsaCard

Definition at line 25 of file alsa.h.

◆ AlsaCb

typedef void(* AlsaCb) (enum alsa_event event, gpointer data)

Definition at line 36 of file alsa.h.

Enumeration Type Documentation

◆ alsa_event

enum alsa_event
Enumerator
ALSA_CARD_ERROR 
ALSA_CARD_DISCONNECTED 
ALSA_CARD_VALUES_CHANGED 

Definition at line 30 of file alsa.h.

Function Documentation

◆ alsa_card_free()

void alsa_card_free ( AlsaCard card)

Free a card instance, therefore closing mixer and freeing any allocated ressources.

Parameters
carda Card instance.

Definition at line 862 of file alsa.c.

◆ alsa_card_get_channel()

const char* alsa_card_get_channel ( AlsaCard card)

Get the name of the channel. This is an internal string that shouldn't be modified.

Parameters
carda Card instance.
Returns
the name of the channel.

Definition at line 750 of file alsa.c.

◆ alsa_card_get_name()

const char* alsa_card_get_name ( AlsaCard card)

Get the name of the card. This is an internal string that shouldn't be modified.

Parameters
carda Card instance.
Returns
the name of the card.

Definition at line 737 of file alsa.c.

◆ alsa_card_get_volume()

gdouble alsa_card_get_volume ( AlsaCard card)

Get the volume in percent (value between 0 and 100).

Parameters
carda Card instance.
Returns
the volume in percent.

Definition at line 804 of file alsa.c.

◆ alsa_card_has_mute()

gboolean alsa_card_has_mute ( AlsaCard card)

Whether the card has mute capabilities.

Parameters
carda Card instance.
Returns
TRUE if the card can be muted, FALSE otherwise.

Definition at line 762 of file alsa.c.

◆ alsa_card_install_callback()

void alsa_card_install_callback ( AlsaCard card,
AlsaCb  callback,
gpointer  user_data 
)

Set a callback invoked on volume/mute changes.

Parameters
carda Card instance.
callbackthe callback to be invoked.
user_datathe user data passed to the callback.

Definition at line 850 of file alsa.c.

◆ alsa_card_is_muted()

gboolean alsa_card_is_muted ( AlsaCard card)

Get the mute state, either TRUE or FALSE.

Parameters
carda Card instance.
Returns
TRUE if the card is muted, FALSE otherwise.

Definition at line 774 of file alsa.c.

◆ alsa_card_new()

AlsaCard* alsa_card_new ( const char *  card_name,
const char *  channel,
gboolean  normalize 
)

Create a new Card instance. Look for the selected card among the available cards. If found, open it, and look for the selected channel. If found, all is well, the card is ready to be used. Otherwise, NULL is returned.

Parameters
card_namethe name of the card, or NULL to use the default card.
channelthe name of the channel, or NULL to use the first playable channel.
normalizewhether we use normalized volume or not.
Returns
a newly allocated Card instance, or NULL on failure.

Definition at line 891 of file alsa.c.

◆ alsa_card_set_volume()

void alsa_card_set_volume ( AlsaCard card,
gdouble  value,
int  dir 
)

Set the volume in percent (value between 0 and 100).

Parameters
carda Card instance.
valuethe volume in percent.
dirthe direction of the volume change (-1: lowering, +1: raising, 0: setting).

Definition at line 827 of file alsa.c.

◆ alsa_card_toggle_mute()

void alsa_card_toggle_mute ( AlsaCard card)

Toggle the mute state.

Parameters
carda Card instance.

Definition at line 788 of file alsa.c.

◆ alsa_list_cards()

GSList* alsa_list_cards ( void  )

Return the list of playable cards as a GSList. Must be freed using g_slist_free_full() and g_free().

Returns
a list of playable cards.

Definition at line 966 of file alsa.c.

◆ alsa_list_channels()

GSList* alsa_list_channels ( const char *  card_name)

For a given card name, return the list of playable channels as a GSList. Must be freed using g_slist_free_full() and g_free().

Parameters
card_namethe name of the card for which we list the channels
Returns
a list of playable channels.

Definition at line 1002 of file alsa.c.