Crossfire Client, Branches  R11627
cfsndserv.c File Reference
#include <config.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include "newclient.h"
#include "soundsdef.h"
+ Include dependency graph for cfsndserv.c:

Go to the source code of this file.

Data Structures

struct  Sound_Info
 
struct  sound_settings
 

Macros

#define CONFIG_FILE   "/.crossfire/sndconfig"
 
#define MAX_SOUNDS   1024
 
#define SOUND_DECREASE   0.1
 

Typedefs

typedef struct Sound_Info Sound_Info
 

Functions

int init_sounds (void)
 
int main (int argc, char *argv[])
 
static void parse_sound_line (char *line, int lineno)
 
static void play_sound (int soundnum, int soundtype, int x, int y)
 
int read_settings (void)
 
int SoundCmd (unsigned char *data, int len)
 
char * strdup_local (char *str)
 
int write_settings (void)
 

Variables

int bit8 =0
 
char * buffers =NULL
 
int current_buffer =0
 
Sound_Info default_normal
 
Sound_Info default_spell
 
int first_free_buffer =0
 
int frequency =0
 
Sound_Info normal_sounds [MAX_SOUNDS]
 
static char * rcsid_cfsndserv_c
 
int sample_size =0
 
struct sound_settings settings ={0,1,0,11025,100,1024,4,AUDIODEV}
 
int sign =0
 
int soundfd =0
 
int * sounds_in_buffer =NULL
 
Sound_Info spell_sounds [MAX_SOUNDS]
 
int stereo =0
 
int zerolevel =0
 

Macro Definition Documentation

#define CONFIG_FILE   "/.crossfire/sndconfig"

Definition at line 103 of file cfsndserv.c.

Referenced by read_settings(), and write_settings().

#define MAX_SOUNDS   1024

Definition at line 104 of file cfsndserv.c.

Referenced by init_sounds(), parse_sound_line(), and play_sound().

#define SOUND_DECREASE   0.1

Definition at line 130 of file cfsndserv.c.

Referenced by play_sound().

Typedef Documentation

typedef struct Sound_Info Sound_Info

Function Documentation

int init_sounds ( void  )

Opens the audio device, and reads relevant configuration files.

Returns
Returns 0 on success. On failure, the calling function will likely disable sound support/requests from the server.

Definition at line 611 of file cfsndserv.c.

References sound_settings::audiodev, sound_settings::bit8, bit8, sound_settings::buffers, buffers, sound_settings::buflen, Sound_Info::data, def_sounds, Sound_Info::filename, sound_settings::frequency, frequency, init_audio(), MAX_SOUNDS, parse_sound_line(), sample_size, settings, sound_settings::sign, sign, Sound_Info::size, sounds_in_buffer, sound_settings::stereo, stereo, Sound_Info::volume, and zerolevel.

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

The client entry point.

Parameters
argc
argv
Returns

Definition at line 947 of file cfsndserv.c.

References audio_play(), sound_settings::buffers, buffers, sound_settings::buflen, current_buffer, err, first_free_buffer, init_sounds(), rcsid_cfsndserv_c, read_settings(), settings, sndbuf_pos, SoundCmd(), soundfd, sounds_in_buffer, write_settings(), and zerolevel.

+ Here is the call graph for this function:

static void parse_sound_line ( char *  line,
int  lineno 
)
static

Definition at line 167 of file cfsndserv.c.

References Sound_Info::filename, MAX_SOUNDS, strdup_local(), Sound_Info::symbolic, and Sound_Info::volume.

Referenced by init_sounds().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 903 of file cfsndserv.c.

References sound_settings::audiodev, sound_settings::bit8, sound_settings::buffers, sound_settings::buflen, CONFIG_FILE, sound_settings::frequency, settings, sound_settings::sign, sound_settings::simultaneously, sound_settings::stereo, and strdup_local().

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int SoundCmd ( unsigned char *  data,
int  len 
)

?

Parameters
data
len

Definition at line 859 of file cfsndserv.c.

References play_sound().

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char* strdup_local ( char *  str)

Definition at line 111 of file cfsndserv.c.

Referenced by parse_sound_line(), and read_settings().

+ Here is the caller graph for this function:

int write_settings ( void  )

Variable Documentation

int bit8 =0

Definition at line 141 of file cfsndserv.c.

Referenced by init_sounds(), and play_sound().

char* buffers =NULL

Definition at line 133 of file cfsndserv.c.

Referenced by audio_play(), draw_keybindings(), init_sounds(), main(), and play_sound().

int current_buffer =0

Definition at line 135 of file cfsndserv.c.

Referenced by main(), and play_sound().

Sound_Info default_normal

Definition at line 127 of file cfsndserv.c.

Sound_Info default_spell

Definition at line 127 of file cfsndserv.c.

int first_free_buffer =0

Definition at line 136 of file cfsndserv.c.

Referenced by main().

int frequency =0

Definition at line 141 of file cfsndserv.c.

Referenced by init_sounds().

Sound_Info normal_sounds[MAX_SOUNDS]

Definition at line 127 of file cfsndserv.c.

Referenced by play_sound().

char* rcsid_cfsndserv_c
static
Initial value:
=
"$Id: cfsndserv.c 8649 2008-03-29 10:58:58Z ryo_saeba $"

Definition at line 1 of file cfsndserv.c.

Referenced by main().

int sample_size =0

Definition at line 141 of file cfsndserv.c.

Referenced by init_sounds(), and play_sound().

struct sound_settings settings ={0,1,0,11025,100,1024,4,AUDIODEV}
int sign =0

Definition at line 141 of file cfsndserv.c.

Referenced by init_sounds().

int soundfd =0

Definition at line 138 of file cfsndserv.c.

Referenced by main(), and play_sound().

int* sounds_in_buffer =NULL

Definition at line 134 of file cfsndserv.c.

Referenced by init_sounds(), main(), and play_sound().

Sound_Info spell_sounds[MAX_SOUNDS]

Definition at line 127 of file cfsndserv.c.

Referenced by play_sound().

int stereo =0

Definition at line 141 of file cfsndserv.c.

Referenced by init_sounds(), and play_sound().

int zerolevel =0

Definition at line 141 of file cfsndserv.c.

Referenced by init_sounds(), and main().