Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Simple but Nice 3D Sound Function

Author
Message
Game Master1330
18
Years of Service
User Offline
Joined: 19th Oct 2007
Location: (GetReaderXYZ() * 42 ) / 0
Posted: 26th Mar 2012 20:10 Edited at: 26th Mar 2012 20:17
Hey,
I wrote a nice little 3D sound function for a game I am working on and just thought I would share.

You have to set the maximum hearing distance, and the maximum volume, but it does everything else.

You put in the 3D sound number, the source, and the listener, and it will calculate the volume based on the distance, and size of the source and listener. It also uses the built in sound positioning function.

The outcome is pretty nice, but needs a bit more fine tuning.

Also, I recommend putting a position listener command in your loop if your listener dosent change

Variables to set:
maxsounddistance#
maxsoundvolume#



Matt
Wolf4D
16
Years of Service
User Offline
Joined: 5th Oct 2009
Location:
Posted: 31st May 2012 16:44
Thanks for a good code Hmm, yes, it's simple, but... I did not previously hit upon to it

In addition, it makes some nice effects even on non-3D-sounds. It took some time to rewrite this code for DGDK and to make non-3D simplified variant, but the result is pretty impressive. It's an interesting and simple enough way to make each game sound much more ear-candy.

But I think it would be better with a "rotate listener" line somewhere in the end.

Sorry for my bad English.

Login to post a reply

Server time is: 2026-07-10 10:51:54
Your offset time is: 2026-07-10 10:51:54