i guess everyone who ever worked with custom sounds noticed that it is very laggy and limited. Well i run into a limit, but i don't understand what the actual limit is. So maybe someone can help me with that and explain what is limited.
What i know so far: If you load too many sounds, some disappear. I guess it's first come first serve. But is it the amount of sound lvl or the amount of actual sound files that is limited?
About my problem:
You know about the missing sound fixes from Rayman?
https://www.moddb.com/games/star-wars-b ... ound-fixes
https://www.moddb.com/games/star-wars-b ... -sound-fix
https://www.moddb.com/games/star-wars-b ... -music-fix
I included it into remaster, but got the feedback that with this installed some sounds from a 123 mod are missing. Important battlesounds, and not just those ambiente fixes.
With my knowledge of SWBF2 sounds, it was clear that there are too many sounds loaded and yeah, it makes no sense to load tatooine, wookie and ki adi munid sound fixes on gcw Yavin IV map. So i came around with this piece of code:
Hidden/Spoiler:
ScriptPostLoad:
Every time a mission is loaded, there is one(!) ScriptPostLoad and this code modification waits for it beeing finished and set some additional properties. This happens ALWAYS since it doesn't hurt anyone if there is no wok_inf_warrior, who cares if he has some properties?
ReadDataFile:
This one is more tricky, since there are a lot of ReadDataFile calls while a match is loaded. So i analyze the parameters passed to the function. If mos eisley or jabbas palace is loaded, the tatooine sound fix is loaded. If one of the native's side lvl is loaded, well the native sound fix is loaded, too. This guarantees that the fix does not only work for the stock maps, but for custom maps/mods, too.
Finally the mundi sound fix goes a similar way, but there are a lot of republic mods that do not have mundi, so i further analyze the actual units that are loaded and not just the side's lvl file. If mundi is found, load the sound fix.
This works very well, the files are loaded whenever they should be loaded and the reported missing sounds on custom mods where fixed. Well but the soundfixes do no longer work. Don't misunderstand me, the soundfixes are loaded, but the swbf2 sound system mess up and do not play them. Just like there were too many sound files loaded. When i do not use all those code stuff and load the sound fixes immediately when the user script is executed, it works fine. But in that case the sound fix is applied to EVERY mod, map and era and causes problems with large era mods that come with custom sounds.
Any idea what actually limits the sounds, or how to fix this?