Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Dragon on September 04, 2012, 03:05:37 pm

Title: Found the cause of my sound problems
Post by: Dragon on September 04, 2012, 03:05:37 pm
From time to time, I posted a thread complaining about a strange bug with rapid firing weapons causing sounds to randomly disappear. It was hard to reproduce on different configurations, inconsistent and didn't register on debug builds, making it a nightmare to nail, and I never got around to compiling my own build to track the problem more precisely.
However, last time someone mentioned that it's possible that the sound card has problems handling the amount of sounds that appeared. I dismissed that at first, since the sounds seemed rather short (if they weren't, the result would be unlistenable noise). But then, I took a close look at them.

It turned out those short cracks of gunfire had a lengthy, slowly fading reverb, going on for up to 6 seconds! Now, with two guns firing at 50-100 RPS (I know the tricks to make it work with other FSO limits), the soundcard has to cope with playing up to 1200 sounds at the time, most of them inaudible (though them more typical amount would be about 300 simultaneously played sounds. Still enough to cause problems). No wonder it couldn't cope. Turns out you need to be very careful when choosing gatling gun sounds.
Title: Re: Found the cause of my sound problems
Post by: headdie on September 04, 2012, 03:36:35 pm
defiantly something to keep in mind when selecting sounds for mods.
Title: Re: Found the cause of my sound problems
Post by: Kobrar44 on September 04, 2012, 04:27:26 pm
Shouldn't this be in the modding section?
Title: Re: Found the cause of my sound problems
Post by: Dragon on September 04, 2012, 06:47:19 pm
I wasn't sure. I wrote this to bring a closure to multiple "bug" threads I posted here, but the topic is obviously more modding related. Mods can move it there if they want. I'm not sure how much it's a sound card limit and how much it's an FSO limit (let's face it, anything might have trouble processing 1000+ sounds at the same time).
Title: Re: Found the cause of my sound problems
Post by: karajorma on September 04, 2012, 06:54:14 pm
Or we can leave it here a while and then move it to modding. That way everyone sees it. :)
Title: Re: Found the cause of my sound problems
Post by: Dragon on September 04, 2012, 07:20:51 pm
Good idea. This thread could save a great deal of frustration to anybody who wishes to venture into such ROF extremes.
Title: Re: Found the cause of my sound problems
Post by: Iss Mneur on September 05, 2012, 10:47:12 pm
Having spent a great deal of time working with the FSO sound code, I thought I would offer my knowledge.

The first limit that you would have been hitting is an FSO limit, which is currently 48 concurrent voices (of which only 32 are available for gameplay sound effects, the rest are used for music and other things).  However, even the best virtual sound cards available can only do 256 concurrent voices so, even if FSO was able to exploit every available voice, it would still hit the limits of the sound card.

It is hard to find the number of concurrent voices for modern hardware sound cards.  The vendors don't really say and the OpenAL allows for the vendor to fake it by 1, 2, 16, or 32 voices on the hardware and the rest in software.   The best hardware I could find only expclitly states supporting 32 concurrent voices on the the hardware, but this hardware is long out of production and presumably things have improved since then, but then so a cpu power so it is just as likely that the fancy hardware only supports a couple on the hardware and does the rest in software.