www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/22/00:17:37

From: Klaas <klaas AT ns DOT sympatico DOT ca>
Newsgroups: rec.games.programmer,comp.ai.games,comp.os.msdos.djgpp
Subject: Re: Smart stereo sound effects
Date: Mon, 22 Dec 1997 00:56:05 -0400
Organization: Home
Lines: 29
Message-ID: <349DF2E5.2848@ns.sympatico.ca>
References: <349AA5AA DOT 5372 AT oce DOT nl>
Reply-To: klaas AT ns DOT sympatico DOT ca
NNTP-Posting-Host: 142.177.11.117
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> 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.

> Is it possible to include surround soundeffects?

doubt that it's impossible, I really don't know.  But, wouldn't you have
to use stereo wav files?

-Mike

- Raw text -


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