[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Adonthell-devel] Audio module
Re: [Adonthell-devel] Audio module
Wed, 25 Aug 2004 09:02:18 +0200
Von: James Nash <address@hidden>
> Dunno if this is what you intended, but it would be cool if the
> sounds gradually fade in as the player gets closer to the object that
> emits them. Perhaps there could be a parameter for the mapobjects that
> defines the radius within which you start to hear it. The volume from
> there until right next to the object could just incremented linearly (
> volume = distance from object / sound radius ).
Yeah, that's what I had in mind. SDL_mixer allows to specify a distance (0-255)
and an angle (0-360) for each channel and plays the sfx according to that. (The
manual says that the effect achieved isn't as good as it would be with OpenAL,
but it might be okay for our purpose.
If a sound source is attached to a map object or character, we can pretty
easily figure out distance and angle relative to the players location. Pass
that to SDL_mixer and we're done.
Of course, other backends might need an additional layer to achieve this
effect, but that shouldn't stop us from taking the easy path right now.
> > 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.
> That sounds good. I guess if there are more than 10 audible
> mapobjects/characters within range of the player the engine could just
> figure out which are the 10 closest and discard the rest.
> Dunno how hard this would be to do - but I guess there might also be
> cases when there are multiple objects within range of the player that
> use the same sound effect. It would be good if the engine could let them
> share the same channel (basically just playing one instance of the sound
> effect). Presumably this would free up resources for other sound effects
> and may avoid problems where the same effect is being played several
> times but each one not being quite in sync and thus just sound a mess
> (OTOH there may be other situations where this is just what you want
> (imagine a crowd of people in a town) so perhaps this feature
> should be optional.
I was thinking of that ... if sfx really take into account angle and position,
we should be able to safely play the same sound simultanously. Avoiding this
wouldn't be too much additional effort, though. It could be easily done in the
method that figures out the 10 nearest sound sources. If it finds duplicates,
it could simply discard the one that is further away.
As an additional idea, I think that the number of channels should be
configurable at runtime. On slow hardware, one may want to reduce the number of
FX in order to play smoothly. That's not very hard and could even be changed
while the engine is running.
> Also, it would be cool if we could add effects to the sounds (like an
> echo). Lots of old SNES games had this and it's a nice touch.
> Perhaps it could be a parameter of the map (or a part of a map)
> to turn on such effects.
Yeah, that would indeed be nice. If we'd implement an echo filter (or something
else) this can be done by a set of map events that turns such filter on and
off. No need to add extra attributes to maps or mapobjects just for that. With
a little event script, we'd be way more flexible.
P.S: I think we should collect a few such TODOs and post them on our website.
Perhaps somebody will then come an step in to code stuff. We could do with
another programmer and a few TODOs with enough detail would make the task much
easier for any newcomer.
Another canditate would be the character/combat stuff, which could easily be
split into several tasks.
Oh, just out of interest: any advancements on mapengine or gui?