Crossfire Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: Improved sound support III



Hi,

I have improved my improved sound support a bit. Mainly bug-fixes.
Still no autoconf support - I have tried, but maybe someone else would
like to do it?

New files are uploaded to ftp://ftp.ifi.uio.no/pub/crossfire/incoming:

    2438 sty  9 15:57 README.cfsndserv-990109
   11256 sty  9 16:02 client-sndserver-990109.patch.gz
  326199 sty  9 14:56 sounds-990109.tar.gz

I have attached the README file. I hope it is English enough to
understand something :-)

Greets,
      Jacek
-- 
+---------+--------------------------------------------------------+
!      ,  !            Jacek Konieczny, Gliwice, Poland            !      
! Jajcus  !   email: jajcus@zeus.polsl.gliwice.pl, jacek@kde.org   !
!         ! ICQ# 7149127                           WWW: none (yet) !
+---------+--------------------------------------powered-by-Linux--+

This is a README file for new sound support code patch for crossfire client.

The patch should be applied to the client-0.95.1

Sound can now be played by separate process invoked from crossfire client.
The process - called sound server - adjusts sounds' volume according to
relative position of player and sound source on map and mixes the sounds
together, so many sounds can be played simultaneously.

CONFIG FILE

The config file ~/.crossfire/sndconfig contains some configurable settings. If
there is no such file, one with default settings will be created.

The file contains following fields:

stereo:  	1 means stereo sound, 0 - mono

bits: 		bitrate of generated sound - 8 or 16
		16 means better quality, especially when more sounds
		are to be played simultaneously, but takes more memory
		
signed: 	if we should sent signed data to the soundcard. 1 means yes.

frequency:	speed of playing data. This should be 11025, or sound pitch
		will change 
		
buffers: 	how many buffers to allocate
buflen: 	how big the buffers should be. buffers*buflen shouldn't be
                smaller than the longest sound to be played.
		
simultaneously: home many sound can be played at the same time. When this
		setting is bigger, each sound volume will decrease.

HOW DOES IT WORK?

The sound server gets information about sounds to be played on standard input.
The information is a line:
<sound number> <sound type> <relative x> <relative y>
All those numbers are hex.
The file ~/.crossfire/sounds contains description of sound numbers and types.
For example:
3 0 5 0
Means that normal sound SOUND_FUMBLE spell should be played as it's source was
5 units to the right of player.

Sounds are mixed in special buffers, which are in fact one buffer, which should
be big enough for the biggest sound to be played.

The buffers, if contain anything, are sent one by one to the sound device.
Each buffer is cleaned after playing.

Sounds data is multiplied by some ratio (<1) evaluated from it's position and
volume and added to the buffers, starting from the next after the one being
played. 

So bigger buffer means bigger delay, before th sound is actually played, but
the smaller buffer is, the bigger is possibility, we won't succeed filling the
next buffer, before last is played.

BUGS

- lack of autoconf support

And probably still many more...
If you have found one, please mail me.

			Jacek Konieczny <jajcus@zeus.polsl.gliwice.pl>