Mail Archives: djgpp/1997/12/22/23:30:22
Klaas wrote:
>
> > My problem is that a lot of events happen, some on the visible area of
> > the screen, some others not visible.
> > In case of an event how can I decide if I must play the according
> > soundeffect (depending on the position of the vehicle in relation to the
> > visible area)
>
> My guess would be to see if the explosion is with the screen ie.
> if ObjX > ScreenLeft and ObjX < ScreenLeft + ScreenWidth and (Y
> tests...)
> (play sound)
>
> > How is the volume altered in relation to the distance and position of
> > the event.
>
> well, most games just play the sound at a certain loudness if the event
> is on the screen, and very faintly otherwise (example: Z) Though, I
> suppose teh volume could be scaled using pythagorean distance:
>
> sqr((ObjX-CurX)^2 + (ObjY-CurY)^2) (where CurX/Y are player's position)
> then scale that value from your lowest desired volume to your highest,
> then
> to compute final volume, subtract it from highest desired volume.
It is much beter to use the inversed squared distance (IE vol = 1/
((y1-y2)^2 + (x1-x2)^2). This is more acurate and faster as well
as it eliminates the sqrt.
>
> > Is it possible to include surround soundeffects?
> Yes! The one catch is that to do this over the midi channal you have to
have a wavetable card. For the digital chanal its just a matter of mixing
a couple of pre filtered sources.
- Raw text -