Atrinik Client 2.5
Functions | Variables
client/sound.c File Reference
#include <global.h>

Go to the source code of this file.

Functions

static void sound_free (sound_data_struct *tmp)
void sound_init ()
void sound_deinit ()
static void sound_add_effect (const char *filename, int volume, int loop)
void sound_play_effect (const char *filename, int volume)
void sound_start_bg_music (const char *filename, int volume, int loop)
void sound_stop_bg_music ()
void update_map_bg_music (const char *bg_music)
void sound_update_volume ()
const char * sound_get_bg_music ()
const char * sound_get_bg_music_basename ()
uint8 sound_map_background (int new)
void SoundCmd (uint8 *data, int len)
void sound_pause_music ()
void sound_resume_music ()
int sound_playing_music ()

Variables

static char * sound_background
static uint8 sound_map_background_disabled = 0
static sound_data_structsound_data
static size_t sound_data_num
static uint8 enabled = 0

Detailed Description

Sound related functions.

Definition in file sound.c.


Function Documentation

static void sound_add_effect ( const char *  filename,
int  volume,
int  loop 
) [static]

Add sound effect to the playing queue.

Parameters:
filenameSound file name to play. Will be loaded as needed.
volumeVolume to play at.
loopHow many times to loop, -1 for infinite number.

Definition at line 165 of file sound.c.

void sound_deinit ( )

Deinitialize the sound system.

Definition at line 142 of file sound.c.

static void sound_free ( sound_data_struct tmp) [static]

Free one sound data entry.

Parameters:
tmpWhat to free.

Definition at line 96 of file sound.c.

const char* sound_get_bg_music ( )

Get the currently playing background music, if any.

Returns:
Background music file name, NULL if no music is playing.

Definition at line 386 of file sound.c.

const char* sound_get_bg_music_basename ( )

Get the background music base file name.

Returns:
The background music base file name, if any. NULL otherwise.

Definition at line 394 of file sound.c.

void sound_init ( )

Initialize the sound system.

Definition at line 122 of file sound.c.

uint8 sound_map_background ( int  new)

Get or set sound_map_background_disabled.

Parameters:
newIf -1, will return the current value of sound_map_background_disabled; any other value will set sound_map_background_disabled to that value.
Returns:
Value of sound_map_background_disabled.

Definition at line 412 of file sound.c.

void sound_pause_music ( )

Pause playing background music.

Definition at line 488 of file sound.c.

void sound_play_effect ( const char *  filename,
int  volume 
)

Play a sound effect.

Parameters:
filenameSound file name to play.
volumeVolume to play at.

Definition at line 219 of file sound.c.

int sound_playing_music ( )

Check whether background music is being played.

Returns:
1 if background music is being played, 0 otherwise.

Definition at line 507 of file sound.c.

void sound_resume_music ( )

Resume playing background music.

Definition at line 497 of file sound.c.

void sound_start_bg_music ( const char *  filename,
int  volume,
int  loop 
)

Start background music.

Parameters:
filenameFilename of the music to start.
volumeVolume to use.
loopHow many times to loop, -1 for infinite number.

Definition at line 232 of file sound.c.

void sound_stop_bg_music ( )

Stop the background music, if there is any.

Definition at line 304 of file sound.c.

void sound_update_volume ( )

Update volume of the background sound being played.

Definition at line 352 of file sound.c.

void SoundCmd ( uint8 data,
int  len 
)

Sound command, used to play a sound.

Parameters:
dataData to initialize the sound data from.
lenLength of 'data'.

Definition at line 429 of file sound.c.

void update_map_bg_music ( const char *  bg_music)

Update map's background music.

Parameters:
bg_musicNew background music.

Definition at line 324 of file sound.c.


Variable Documentation

uint8 enabled = 0 [static]

Whether the sound system is active.

Definition at line 41 of file sound.c.

char* sound_background [static]

Path to the background music file being played.

Definition at line 33 of file sound.c.

Loaded sounds.

Definition at line 37 of file sound.c.

size_t sound_data_num [static]

Number of sound_data.

Definition at line 39 of file sound.c.

If 1, will not allow music change based on map.

Definition at line 35 of file sound.c.