Sound fix

Discuss the future of Warzone 2100 with us.
User avatar
EVIL386
Trained
Trained
Posts: 80
Joined: 05 Jan 2007, 02:11

Sound fix

Post by EVIL386 »

Hey people.

I was looking through the sound code earlier and I came across something interesing.

It seems that in the code the maximum amount of SAME samples added to the audio queue (i.e. two object playing the cannon noise) is hard coded at 2....

Bascially if two tanks are fighting it out just outside ear shot (which will be almost silent) the tanks you are looking at directly infront of you will be silent.

And that sucks imho.

So as a quick fix I came up with this:

Code: Select all

Index: audio.c
===================================================================
--- audio.c	(revision 6391)
+++ audio.c	(working copy)
@@ -29,7 +29,7 @@
 
 // defines
 #define NO_SAMPLE				- 2
-#define MAX_SAME_SAMPLES		2
+#define MAX_SAME_SAMPLES		20
 
 // global variables
 static AUDIO_SAMPLE *g_psSampleList = NULL;


It increases the amount of SAME sounds allowed to be played simultaneously, this should help those busy scenes. It's not perfect and the alogrithm for detecting what is in ear shot needs to be revised (I'll look into this).

Tbh I think 20 is more than enough and a more fair amount. To test this I put 35 hellstorms in my base and them placed a WSS Tower in an enemy's and let em rip. All the sounds played perfectly, the firing, flight and explosions all played nicely and god did it scare the bejesus out of my GF xD (Read high volume and subwoofer lol)

What do you Dev's think? Hack patch I know but what isn't in this game xD xD
For those of you interested the algorithm starts on Line 611 in lib\sound\audio.c
User avatar
whippersnapper
Regular
Regular
Posts: 1183
Joined: 21 Feb 2007, 15:46

Re: Sound fix

Post by whippersnapper »

.
Devs pass thru these bbs regularly but the following will be helpful in the ways of contributing:
.

the following page will afford guidance for contributing to the project:

http://wiki.wz2100.net/Coding
Per wrote:Add the patch to a new ticket at http://developer.wz2100.net/

Thanks for contributing!
.
"I need no warrant for being, and no word of sanction upon my being. I am the warrant and the sanction." Anthem

"Art is the selective recreation of reality according to the artist's metaphysical value judgments." A. Rand
.
User avatar
Buginator
Professional
Professional
Posts: 3285
Joined: 04 Nov 2007, 02:20

Re: Sound fix

Post by Buginator »

I wouldn't exactly call this a fix, and yeah, there is a cap on the # of same sounds.

Bottom line is, the sound system sucks, and needs a rewrite.

Oh, and don't forget, if you have 8p total, your 20 limit is going to be over the limit VERY fast.
The sound system don't care where the sound is, it still adds it into the queue, (and since it isn't within ear shot, the volume is 0)... so it still gets 'played'. What? When it is 0, just don't add it? No, you need to work with warzone logic, and the dreaded callbacks. It isn't as easy as it sounds.


We need a real sound manager, not the current code.
and it ends here.