[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-devel] Audio module

From: ksterker
Subject: [Adonthell-devel] Audio module
Date: Tue, 24 Aug 2004 11:45:53 +0200

Just now I had some thoughts about the audio module for v0.4 that I would like 
to share. Mainly, it's all about SFX.

For v0.4 it would be cool to have actual sound effects, like bird song, 
waterfalls, etc ...

So I suggest we have something like a sound source that could be attached to a 
mapobject. If the player comes near to it or goes away from it, the sound could 
change accordingly. (SDL_mixer has some premade effects for this).

Parameters for a sound source would be its volume. We also need to define how 
often it loops, as not all SFX would loop forever. We should also be able to 
specify a timeframe after which a sound is restarted once it has finished 

As there will be more sound sources than channels, we need an algorithm to only 
activate those that are nearest to the player. 

Apart from these sound sources that are tied to map objects or characters, we'd 
also have to be able to play sound effects whenever we want. So I guess we 
should reserve a number of channels for ambient sounds and a smaller number for 
the rest, like doors creaking or combat noises, etc.

Say if we allow a total number of 16 simultanous channels playing, we could 
have 10 for ambient sounds and 6 for the rest, which should be more than enough.

We should however be able to hold more sounds in memory, through some sort of 
cache. One interesting feature of SDL_mixer is its ability to use Ogg Vorbis 
for SFX, so we could simply load them into memory without wasting as many 
resources as we would when loading wav's. When finally using them, they could 
be opened from memory, which should be much faster than opening them from a 

The problem is of course that other backends might not provide this ability, 
meaning they will become harder to use. OTOH, they should at least be able to 
read a .wav from memory, and decompressing the .ogg shouldn't be too difficult 
with standard vorbis functions.

So much for now. Consider this as a kind of TODO for the audio module and feel 
free to start coding ;-). More ideas and suggestions are welcome too.


P.S: SDL_mixer manual available at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]