## gnome-sound

gnome-sound — Sound playing routines.

## Synopsis

    #include <libgnome/libgnome.h>

    void                gnome_sound_init                    (const char *hostname);
    void                gnome_sound_shutdown                (void);
    void                gnome_sound_play                    (const char *filename);
    int                 gnome_sound_sample_load             (const char *sample_name,
                                                             const char *filename);
    int                 gnome_sound_connection_get          (void);

## Description

This module provides wrapper functions for playing sound samples. Currently it just wraps the esound daemon, but the API is flexible enough that other sound infrastructures can be included in the future.

These functions also allow for the fact that no sound may be supported on the current platform. So applications can safely call these functions to play sounds and they will just quietly return if no action is possible.

## Details

### gnome_sound_init ()

    void                gnome_sound_init                    (const char *hostname);

Initialize the esd connection.

`hostname` : | Hostname where esd daemon resides.

### gnome_sound_shutdown ()

    void                gnome_sound_shutdown                (void);

Shuts down the gnome sound support.

### gnome_sound_play ()

    void                gnome_sound_play                    (const char *filename);

Plays the audio stored in `filename`, if possible. Fail quietly if playing is not possible (due to missing sound support or for other reasons).

`filename` : | File containing the sound sample.

### gnome_sound_sample_load ()

    int                 gnome_sound_sample_load             (const char *sample_name,
                                                             const char *filename);

Loads the audio from `filename` and load it into the esd cache for later playing. Programs will rarely want to call this function directly. Use `gnome_sound_play()` instead for fire and forget sound playing.

`sample_name` : | The name of the sample.
`filename` : | The filename where the audio is stored.
Returns : | The esound sample_id or `-1` if the sample was unable to be cached for esound.

### gnome_sound_connection_get ()

    int                 gnome_sound_connection_get          (void);

Rarely needed to by programs directly, this function may be useful if a program has cached a sample with `gnome_sound_sample_load()` and now wishes to call `esd_sample_play()` to play the sample.

Returns : | the file descriptor of our esound connection or `-1` on error.