Forum

Fix ambient sound never starting

Post tutorials on how to do certain tasks within game or engine code here.

Moderator: InsideQC Admins

Fix ambient sound never starting

Postby Baker » Fri Apr 17, 2015 11:26 am

In about any typical normal Quake engine, set the host_maxfps or whatever to 999999. Do "map start".

You should hear wind howling. But you likely won't.

In snd_dma.c there is something like this:

Code: Select all
chan->master_vol +=  (int)(host_frametime * ambient_fade.value)


host_frametime can be a very small number with high frame rates. The (int) part will round it to zero.

I don't have a perfect + non-complicated solution, that code is supposed to fade it in. If you are running high frame rates, you could make sure it increases by a minimum of 1. Or you could implement a more complicated solution and accumulate some time.

I don't know what the "right" solution is. Ambient fade has a default value of 100, a consistent fps over 100 is unlikely to allow the sound to progress until something causes an fps drop. Quake was meant to run at 20 fps (or was it 10?). So maybe it was meant to take 10 seconds?
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3661
Joined: Tue Mar 14, 2006 5:15 am

Re: Fix ambient sound never starting

Postby Spike » Fri Apr 17, 2015 12:52 pm

tbh I'm not sure anyone would really mind if those sounds were removed right now. they're too loud, too annoying, and flood through too much of the map, imho.
standing on the start spot, what I hear is both ambience/water1.wav and ambience/wind2.wav
that single spot has both full volume water+sky ambient volumes. which kinda demonstrates all that is wrong with leaf-based ambient sounds - its just noise.
most qw players use ambient_level 0 - many of them without even realising that this isn't even the vanilla default.

that += bug works both ways. you can also find yourself stuck with high ambient noise even in areas that should have none.

the fix I used was to do the += using a float instead (and then copy that into the master_vol value). you'd need a muuuuch higher framerate for any issues then.
Spike
 
Posts: 2878
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Fix ambient sound never starting

Postby Baker » Fri Apr 17, 2015 7:02 pm

Heh I agree with all of that!

1) Yeah, ProQuake has a "no ambient sounds" setting in preferences.
2) Likewise, I removed the "int"
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3661
Joined: Tue Mar 14, 2006 5:15 am


Return to Programming Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest