From the NannyMUD documentation
2002-08-19
mudsound - NannyMUD sound implementation.
map_sound_class mud_sound
INTRODUCTION NannyMUD can send sound information to the players client. The client can then use the information to play an apropriate sound at the players terminal. Two protocols are supported. The first is the Zuggsoft MSP, while the second is built-in to the XML terminal mode. Both are activated by the 'toggle' command. The XML mode takes precedence if both are toggled on. The client must have sounds to play. Eventually, there will be an archive of sounds to download from our WWW, a so-called 'soundpack'. The structure of the soundpack maps against the implementation in the MUD, but nothing stops the player from using his own sound files. THE SOUND CLASS STRUCTURE The MUD separates the sound events into separate classes. The structure of those classes are as follows: NannyMUD +-event | +- kill | +- die | +- login | +- logout | +- wrongness | +- sober | ... +-soul | +- laugh_he | +- laugh_she | +- laugh_it | +- burp_he | ... +-combat | +-slash | | +- slash-sound1 | | +- slash-sound2 | | ... | +-chop | | ... | +... +-spells | +- spell-sound1 | +- spell-sound2 | ... +-ambient | +... +-music | +... +-guild | +... +-weather | +... +-misc | +... ... At the top, there is the node 'NannyMUD', since it is conceivable that a player attends more than one MUD. Then there are the sub-classes 'event', 'soul', 'combat', 'spell', and 'misc'. For 'combat', further sub-classes exists for all damage types. At the bottom of the tree structure are the leaf nodes, which corresponds to the sounds. THE XML MODE The sound information sent in the XML mode adheres to the following XML specification:"ON"> The following restrictions apply, and should really be part of a formal DTD for what is delivered by the mud. There is none such, and there won't be one either due to the work involved. 'PRIORITY' is only meaningful if 'KIND' equals 'SOUND'. 'CONTINUE' is only meaningful if 'KIND' equals 'MUSIC' 'GENDER' is only meaningful if 'KIND' equals 'FEELING'. The info could then be as simple as: or as complex as
msp in obj/msp
NAME
map_sound_class - Get a sound path from the class.SYNTAX
string map_sound_class(string class, int gender)DESCRIPTION
This function maps a 'sound class' to a 'sound path'. The function returns the path if it succeds, or the empty string if it fails.NOTE
The sound files must be in the right place on your system for your client to find them.EXAMPLE
In: "event/kill" Out: "NannyMUD/event/kill.wav"EXAMPLE
In: "combat/chop/hit-1" Out: "NannyMUD/combat/chop/chop_1.wav"
FUNCTION
NAME
mud_sound - Send sound specs to the client.SYNTAX
varargs int mud_sound(string class, // Class of sound. string kind, // 'music', 'sound', 'feeling'. int to_all, // To one or all. int volume, // Volume, 1 - 100. int repeats, // Nr. of repeats. int priority, // Priority. int cont, // Continue or restart. int gender // 0, 1 or 2.DESCRIPTION
This function will send a sound specification to the client, whch will hopefully play an appropriate sound for you. 'class' is the sound class path. This is how the events etc. are grouped in the MUD. This is the only mandatory parameter. 'kind' is one of "music", "sound" or "feeling". This will influence default values. For example, 'feeling' needs gender information while the others do not. 'to_all' tells if the sound should be given to everyone in the location, or the active player only. Default is 'to active only'. 'volume' is the requested volume in percent of max. The default value is 50. 'repeats' is how many times the sound should be repeated. The default value is 1. 'priority' is the priority of a 'sound' and has no meaning for the other kinds. It is a number between 1 and 100, with the default value being 50. 'cont' is only valid for kind "music". If non-zero, requested music that is already playing will continue, instead of restart, if requested again. 'gender' should only be used with feelings, and should show the gender of whoever performs the feeling.