delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/22/02:02:39

From: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Smart stereo sound effects
Date: Mon, 22 Dec 1997 07:53:00 +0100
Organization: Lehrstuhl fuer Stroemungsmechanik
Lines: 38
Message-ID: <349E0E4C.C40AE2DC@LSTM.Ruhr-UNI-Bochum.De>
References: <349AA5AA DOT 5372 AT oce DOT nl> <349DF2E5 DOT 2848 AT ns DOT sympatico DOT ca>
NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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)
> 
[...]
> 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.

Hmm. I think you can drop the sqrt(). The power of a soundwave
decreases in a 2d world proportional to distance^2, so scaling
with 1/r^2 should be OK. But then again, I never really thought
about that.


- 
Ciao
Tom

*************************************************************
* Thomas Demmer                                             *
* Lehrstuhl fuer Stroemungsmechanik                         *
* Ruhr-Uni-Bochum                                           *
* Universitaetsstr. 150                                     *
* D-44780  Bochum                                           *
* Tel: +49 234 700 6434                                     *
* Fax: +49 234 709 4162                                     *
* http://www.lstm.ruhr-uni-bochum.de/~demmer                *
*************************************************************

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019