Re: [Freeciv-Dev] sound coordinator
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Hi,
I could not resist to add my 2c, even although I do not code FreeCiv
:-)
Martin Willemoes Hansen wrote:
> There are no currently plan for the implementing of sound, tho the
> subject has been up from time to time.
>
> First of all we need the sounds :) Then to have them implemented. Now
> you say that there is allready a lot of FREE sounds available?
No. First we need to add some API for sound playing, then support it
throughout the code (i.e. generate events / call the api). I believe
that the free sounds will come as a result.
The API could look something like:
BOOL sound_init (...)
void sound_done ()
void sound_load (NATION, SOUND_CODE, FILENAMES)
void sound_play (NATION, SOUND_CODE)
void sound_stop (SOUND_CODE)
void sound_stop_all ()
and the same/similar for music_*
It should be possible to define more files for each sound code, so that
the actually played sound could be chosen randomly.
The api could be used in the code like this:
(event handler for clicking on unit, pseudocode)
....
if (my_nation == unit->nation) {
sound_stop (SND_UNIT_ARMY_READY);
sound_stop (SND_UNIT_NAVAL_READY);
sound_stop (SND_UNIT_AIR_READY);
sound_play (unit->nation, SND_UNIT_READY + unit->type_army_naval_air);
}
else {
sound_stop (SND_UNIT_FOREIGN_PISSOFF);
sound_play (unit->nation, SND_UNIT_FOREIGN_PISSOFF);
}
....
Of course, it could (and should) be simplified a bit - something like
sound groups would be needed.
(the stop's are needed if the sounds are mixed - else it would
overlap (ugly)).
> We also needs to find out what the best format would be. wav, au, mp3
> or?
Name the sound files in config file and let the sound library to
handle them. If it can't recognize them, nothing/noise will be heard.
I can send you a source which does more or less this, but
it's old and ugly. I hope that the PenguinSound will come with
something better soon.
Edheldil
|
|