|
Crossfire Client, Trunk
R18666
|
#include "config.h"#include <stdio.h>#include <stdlib.h>#include <ctype.h>#include "client-types.h"#include "newclient.h"#include "client.h"#include "def_sounds.h"#include "common.h"
Go to the source code of this file.
Functions | |
| int | init_sounds (void) |
| int | sound_to_soundnum (const char *name, uint8 type) |
| int | type_to_soundtype (uint8 type) |
| int | StdinCmd (char *data, int len) |
| int | write_settings (void) |
| int | read_settings (void) |
Variables | |
| const char * | rcsid_sound_src_common_c = "$Id: common.c 13995 2010-10-14 04:01:47Z kbulgrien $" |
| Sound_Info | normal_sounds [MAX_SOUNDS] |
| Sound_Info | spell_sounds [MAX_SOUNDS] |
| Sound_Info | default_normal |
| Sound_Info | default_spell |
| char * | client_sounds_path = NULL |
| char * | user_sounds_path = NULL |
| char * | user_sounds_file = NULL |
| char * | user_config_file = NULL |
| char * | buffers = NULL |
| int | stereo = 0 |
| int | bit8 = 0 |
| int | sample_size = 0 |
| int | frequency = 0 |
| int | sign = 0 |
| int | zerolevel = 0 |
Definition in file common.c.
| int init_sounds | ( | void | ) |
Opens the audio device, allocates buffers, and reads any configuration files that need to be.
http://en.wikipedia.org/wiki/Comparison_of_file_systems seems to show that 255 characters is the maximum file name length for most file systems. The same page notes that many file systems have no defined limit to directory depth. Some operating environments have a maximum that is quite large - for example, Windows NT can handle paths up to 32,767 bytes. This data, along with the fact that the server Music command from the server has no inherent limitation (other than MAXSOCKBUF), is why MAXSOCKBUF is chosen for the maximum size of the path buffer. MAXSOCKBUF is rather large, but the buffer size is practically only temporarily allocated (via the stack).
Definition at line 329 of file common.c.


| int read_settings | ( | void | ) |
| int sound_to_soundnum | ( | const char * | name, |
| uint8 | type | ||
| ) |
Convert a sound name to a sound number to help with the transition of the sound server from sound support to sound2 capability. This is not an end solution, but one that gets the sound server working a little bit until a better one can be implemented.
| name | |
| type |
Definition at line 461 of file common.c.

| int StdinCmd | ( | char * | data, |
| int | len | ||
| ) |
Preliminary handler for Crossfire server sound2 and music commands that are received from the client via stdin.
The sound player differentiates sound2 and music commands by looking at the first parameter that comes in. Music commands consist of a single, quoted string that identifies the music to play, while a sound effect command has various numeric parameters followed by strings that identify what to play.
Sound2 data consists of whitespace delimited values: x, y, dir, vol, type, sound, and source. Type, sound, and source define what to play, while the other parameters may be used to figure out how to play it. x and y are offsets from the player to identify where the sound originated. dir can be set to indicate a direction that the source is travelling in. vol is an attenuation factor (0-100) that may be applied to the sound volume to make it possible, for example, to give map-designers the ability to suggest relative loudness of sounds in the environment.
FIXME: This is a work-in-progress. The sound2 was put into the server without a plan to fix the clients. cfsndserv is basically made obsolete by sound2. The basic fix resurrects some sound support but does not fully implement the features sound2 is supposed to provide.
| data | A text buffer that (hopefully) has a sound or music command. |
| len | The length of the text data in the command buffer. |
Definition at line 519 of file common.c.


| int type_to_soundtype | ( | uint8 | type | ) |
Convert a sound type to legacy type to help with the transition of the sound server from sound support to sound2 capability. This is not an end solution, but one that gets the sound server working a little bit until a better one can be implemented. Basically, all types except 2 get changed to 1.
| type |
Definition at line 480 of file common.c.

| int write_settings | ( | void | ) |
| char* client_sounds_path = NULL |
| const char* rcsid_sound_src_common_c = "$Id: common.c 13995 2010-10-14 04:01:47Z kbulgrien $" |
| int sample_size = 0 |
| char* user_config_file = NULL |
| char* user_sounds_file = NULL |
| char* user_sounds_path = NULL |
1.7.6.1