Crossfire Client, Branches  R11627
sound.c File Reference
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <client-types.h>
#include "client.h"
+ Include dependency graph for sound.c:

Go to the source code of this file.

Functions

int init_sounds (void)
 
void MusicCmd (const char *data, int len)
 
static void play_sound (int soundnum, int soundtype, int x, int y)
 
void Sound2Cmd (unsigned char *data, int len)
 
void SoundCmd (unsigned char *data, int len)
 

Variables

const char *const rcsid_gtk2_sound_c
 
FILE * sound_pipe =NULL
 
ChildProcesssound_process
 

Detailed Description

This file contains the sound support for the GTK V2 client. It does not actually play sounds, but rather tries to run cfsndserve, which is responsible for playing sounds.

Definition in file sound.c.

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 51 of file sound.c.

References CHILD_STDERR, CHILD_STDIN, CHILD_STDOUT, CONFIG_SOUND, LOG(), LOG_ERROR, LOG_INFO, logChildPipe(), MAX_BUF, raiseChild(), sound_pipe, sound_server, ChildProcess::tube, and want_config.

+ Here is the call graph for this function:

void MusicCmd ( const char *  data,
int  len 
)

Definition at line 208 of file sound.c.

References LOG(), and LOG_WARNING.

+ Here is the call graph for this function:

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

Plays sound 'soundnum'. This procedure seems to be very slow - much slower than expected. It might need to run in a thread or fork off.

Parameters
soundnumThe sound to play.
soundtype0 for normal sounds, 1 for spell_sounds. This might get extended in the future.
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 114 of file sound.c.

References CONFIG_SOUND, LOG(), LOG_ERROR, sound_pipe, and use_config.

Referenced by SoundCmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Sound2Cmd ( unsigned char *  data,
int  len 
)

Definition at line 158 of file sound.c.

References LOG(), LOG_WARNING, and name.

+ Here is the call graph for this function:

void SoundCmd ( unsigned char *  data,
int  len 
)

?

Parameters
data
len

Definition at line 136 of file sound.c.

References GetShort_String(), LOG(), LOG_WARNING, and play_sound().

+ Here is the call graph for this function:

Variable Documentation

const char* const rcsid_gtk2_sound_c
Initial value:
=
"$Id: sound.c 9215 2008-06-02 18:31:04Z anmaster $"

Definition at line 1 of file sound.c.

FILE* sound_pipe =NULL

Definition at line 41 of file sound.c.

Referenced by init_sounds(), and play_sound().

ChildProcess* sound_process

Definition at line 42 of file sound.c.