Re: [Freeciv-Dev] adding sound
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
With "running parallel", I meant to fork a process. It was annoying, when you
can't
continue
playing while the sound was played.
I'll add a option to turn on/off the sounds in "game/options". So, a bool
variable
will be set.
Everywhere where a sound is appreciated a function < sound(SOUND_NO); > will be
called.
There is checked, if the variable is set. If it's disabled, the funtion returns
immediatly, else
the program tries to open the /dev/audio device and closes it after the sound
was
played.
So it's always free when there's no sound.
Well, if the /dev/audio is installed must be checked in configure (no idea how,
remember, I'm
really new to it, I've never programmed for a project).
basti
>
> Actually a better method would be to write a generic set of calls to play
> sounds..eg.. (warning: silly interface coming up, please make the real thing
> much more sophisticated than this)
>
> sounds.h:
> #define ELEPHANT_NOISE 12
> ..
>
> void sound_activate(int sound_num);
>
> someotherfile.c:
> /* Elephant is attacking */
> sound_activate(ELEPHANT_NOISE);
>
> and then use configure checks to enable/disable various sound backends.
> ...he
> says without writing a line of code...
>
> Daniel
>
> --
> It is hard to think of anything less sentient than a pumpkin.
>
> -- Terry Pratchett, _Witches Abroad_
|
|