Crossfire Client, Trunk  R18666
Data Structures | Defines | Typedefs | Functions | Variables
/home/leaf/crossfire/client/trunk/sound-src/common.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Sound_Info
struct  sound_settings

Defines

#define CLIENT_SOUNDS_PATH   CF_DATADIR "/sounds/"
#define USER_SOUNDS_PATH   "/.crossfire/sound.cache/"
#define USER_CONFIG_FILE   "/.crossfire/sndconfig"
#define USER_SOUNDS_FILE   "/.crossfire/sounds"
#define MAX_SOUNDS   1024
#define SOUND_DEBUG

Typedefs

typedef struct Sound_Info Sound_Info
typedef struct sound_settings sound_settings

Functions

int init_audio (void)
void play_sound (int soundnum, int soundtype, int x, int y)
void play_music (const char *name)
char * strdup_local (const char *str)
void replace_chars_with_string (char *buffer, const uint16 buffer_size, const char find, const char *replace)

Variables

char * def_sounds []
char * client_sounds_path
char * user_sounds_path
char * user_config_file
char * user_sounds_file
char * buffers
Sound_Info normal_sounds [MAX_SOUNDS]
Sound_Info spell_sounds [MAX_SOUNDS]
Sound_Info default_normal
Sound_Info default_spell
sound_settings settings
int stereo
int bit8
int sample_size
int frequency
int sign
int zerolevel
int * sounds_in_buffer

Detailed Description

Definition in file common.h.


Define Documentation

#define CLIENT_SOUNDS_PATH   CF_DATADIR "/sounds/"

Definition at line 31 of file common.h.

#define MAX_SOUNDS   1024

Definition at line 35 of file common.h.

#define SOUND_DEBUG

Definition at line 37 of file common.h.

#define USER_CONFIG_FILE   "/.crossfire/sndconfig"

Definition at line 33 of file common.h.

#define USER_SOUNDS_FILE   "/.crossfire/sounds"

Definition at line 34 of file common.h.

#define USER_SOUNDS_PATH   "/.crossfire/sound.cache/"

Definition at line 32 of file common.h.


Typedef Documentation

typedef struct Sound_Info Sound_Info

Function Documentation

int init_audio ( void  )

Initialize the Alsa9 sound system.

Returns:
Zero if audio initialized successfully, otherwise -1.

Definition at line 113 of file alsa9.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void play_music ( const char *  name)

Stub for playing music with the Alsa 9 sound system.

Parameters:
nameA name of a song to play that does not include anything like path or file extensions. It is up to this function to map the name to a file.

Music is not supported by the legacy (non-SDL_mixer) sound systems.

Parameters:
nameA name of a song to play that does not include anything like path or file extensions. It is up to this function to map the name to a file.

Definition at line 479 of file alsa9.c.

Here is the caller graph for this function:

void play_sound ( int  soundnum,
int  soundtype,
int  x,
int  y 
)

Add a sound to the buffer to be played later on. This function is common to all systems except SDL_SOUND.

Parameters:
soundnumThe sound to play.
soundtype0 for normal sounds, 1 for spell_sounds.
xOffset (assumed from player) to play sound used to determine value and left vs. right speaker balance.
yOffset (assumed from player) to play sound used to determine value and left vs. right speaker balance.

Definition at line 302 of file alsa9.c.

Here is the caller graph for this function:

void replace_chars_with_string ( char *  buffer,
const uint16  buffer_size,
const char  find,
const char *  replace 
)

Convert a buffer of a specified maximum size by replacing token characters with a provided string. Given a buffered template string "/input/to/edit", the maximum size of the buffer, a token '/', and a replacement string ":", the input string is transformed to ":input:to:edit". If the replacement string is empty, the token characters are simply removed. The template is processed from left to right, replacing token characters as they are found. Replacement strings are always inserted whole. If token replacement would overflow the size of the conversion buffer, the token is not replaced, and the remaining portion of the input string is appended after truncating it as required to avoid overfilling the buffer.

Parameters:
bufferA string to perform a find and replace operation on.
buffer_sizeAllocated buffer size (used to avoid buffer overflow).
findA token character to find and replace in the buffer.
replaceA string that is to replace each token in the buffer.

Definition at line 60 of file misc.c.

char* strdup_local ( const char *  str)

A replacement of strdup(), since it's not defined at some unix variants.

Definition at line 170 of file misc.c.

Here is the caller graph for this function:


Variable Documentation

int bit8

Definition at line 63 of file common.c.

char* buffers

Definition at line 57 of file common.c.

Definition at line 52 of file common.c.

char* def_sounds[]

Definition at line 49 of file common.c.

Definition at line 50 of file common.c.

int frequency

Definition at line 65 of file common.c.

Definition at line 47 of file common.c.

Definition at line 64 of file common.c.

Definition at line 100 of file alsa9.c.

int sign

Definition at line 66 of file common.c.

Definition at line 94 of file alsa9.c.

Definition at line 48 of file common.c.

int stereo

Definition at line 62 of file common.c.

Definition at line 55 of file common.c.

Definition at line 54 of file common.c.

Definition at line 53 of file common.c.

int zerolevel

Definition at line 67 of file common.c.