====== Crossfire Client Sound ====== The Crossfire client has abilities to play sounds, when the server sends sound commands. \\ The sound command at older clients / servers was named //sound// , \\ newer versions of Crossfire use //music// and //sound2// as commands. \\ These command definitions are to be found in //client/common/client.c// inside //struct CmdMapping commands[] = {// . { "sound", SoundCmd, MIXED /* int8, int8, int16, int8 */}, and { "music", (CmdProc)MusicCmd, ASCII }, { "sound2", Sound2Cmd, MIXED /* int8, int8, int8, int8, * int8, int8, chars, int8, * chars */}, When the client understands the sound commands it receives from the server, then it has the ability to play at least sounds for events, \\ as the sounds folder of the Crossfire SVN repository contains around 30 or 40 .raw sound files. \\ These sound.raw files are named like //Teeswing.raw// .\\ ===== Technical ===== The Crossfire client uses a helper binary to play sounds. \\ When the client compiles, it usually creates two different sound server binaries named //cfsndserv// and //cfsndserv_alsa9// . By default, the client uses the //cfsndserv// , the //cfsndserv_alsa9// can be switched on by the commandline parameter [[:client:optional_parameters#-sound_server ]] . \\ The default //cfsndserv// server can be divided into several sound systems. These sound systems are switched on when the client is getting compiled. Either : - very legacy //alsa 0.5// - legacy OSS - SGI - SUN - SDL since v1.60.0 , needs SDL_mixer later than at least v1.2.9 Most people will very likely have the OSS version of the cfsndserv, since the legacy ALSA code does not compile with recent 1.x ASLA libraries and their headers, and the SDL music is not enabled by default while configuring the client before compiling it: >>>--enable-sdl_mixer Enable use of the SDL_mixer library, default is not to use it ===== Configuration File sounds ===== :!: For recent 1.71+ versions of the client, see [[#Configuration File sounds.conf]] . To make these event sounds working inside the client, the client has to know, where these event files are located on the system . \\ When the client starts, it checks for two sound related configuration files in the HOME directory [[:client:crossfire|.crossfire]] : //sndconfig// and //sounds// . \\ From the //client/sound-src/common.c// : int init_sounds(void) sprintf(path,"%s/.crossfire/sounds", getenv("HOME")); i=0; if (!(fp=fopen(path,"r"))) { fprintf(stderr,"Unable to open %s - will use built in defaults\n", path); The file //sounds// should be a simple copy of the //client/common/soundsdef.h// file, \\ without the compiling related lines. \\ I am running a root Linux distribution named Puppy Linux, so my HOME is /root , and have put the files from the sounds package into the folder myself named "cf_sounds" inside the **.**crossfire/ folder : \\ :!: Note: I have shortened the entries of that file to not overload this page. # Since the client has to load the sounds on its own, full path names # are needed. # # There are two sections - one for normal sounds, and one for spell # sounds. They are differentiated by the header 'Standard Sounds:' and # 'Spell Sounds:' # # Empty lines and lines starting with # are ignored. # # Format of the file: pathname to sound, default volume (what volume gets # played if it is centered on the player), symbolic name (not currently # used for anything, but may be in the future for the server to communicated # to the client), and sound number.. Symbolic name and sound number may # be ommitted. If sound number is missing, the sound will be assigned one # higher than the last sound read in. # # the symbolic name can be DEFAULT, in which case all sounds for that section # which are otherwise not set will be set to that value. This can be # especially useful for that magic section, since new spells get added # fairly often. # # The volume of 100 means max volume. Anything higher may break the sound # handling. # # The server currently communicates what sound to play via the sound # number - you should not change those. However, you can change most # of the other sounds without problem. # # If a copy of this file is in ~/.crossfire/, it will be loaded # Standard Sounds: /root/.crossfire/cf_sounds/su-fanf.raw 30 SOUND_NEW_PLAYER 0 /root/.crossfire/cf_sounds/Teeswing.raw 80 SOUND_FIRE_ARROW 1 /root/.crossfire/cf_sounds/chord.raw 100 SOUND_LEARN_SPELL 2 /root/.crossfire/cf_sounds/Missed.raw 70 SOUND_FUMBLE_SPELL 3 /root/.crossfire/cf_sounds/Missed.raw 70 SOUND_WAND_POOF 4 Spell Sounds: /root/.crossfire/cf_sounds/magic.raw 100 DEFAULT /root/.crossfire/cf_sounds/swish.raw 70 "magic bullet" /* 0 */ /root/.crossfire/cf_sounds/swish.raw 60 "small fireball" /root/.crossfire/cf_sounds/first_try.raw 100 "dimension door" /root/.crossfire/cf_sounds/magic.raw 100 "create earth wall" /root/.crossfire/cf_sounds/Tear.raw 100 "paralyze" /root/.crossfire/cf_sounds/Missle1.raw 80 "icestorm" ===== Configuration File sounds.conf ===== Since version 1.71.0 of the client, the above [[#sounds]] file name has changed to sounds.conf. \\ A look inside the [[https://debian.org|Debian]] package //crossfire-client-sounds_1.71.0-3_all.deb// revealed, that it may be located inside the //usr/share/games/crossfire-client/sounds// directory among the various now .wav and since version 1.72 also .ogg files. \\ The header has not changed, but the syntax it seems : # Normal Sounds SOUND_CLOCK:130:TowerClock SOUND_DRINK_POISON:130:Puke SOUND_FALL_HOLE:200:MetalCrash SOUND_FIRE_ARROW:80:Teeswing # Spells aggravation:100:bugle_charge alchemy:100:magic antimagic rune:100:magic armour:100:magic ball lightning:110:lightning1 ===== Configuration File sndconfig ===== TODO