Skip to content
This repository was archived by the owner on Apr 17, 2022. It is now read-only.

Sound patch which should vastly help our sound issues. #770

Closed
wzdev-ci opened this issue Jul 31, 2009 · 19 comments
Closed

Sound patch which should vastly help our sound issues. #770

wzdev-ci opened this issue Jul 31, 2009 · 19 comments

Comments

@wzdev-ci
Copy link
Contributor

resolution_fixed type_bug | by Buginator


In a nutshell, if we can't hear the sound, then we kill it (correctly this time).

This is NOT the source manager version!

When you use the cheat 'showsamples', it will show 3 things in the top corner of the screen.

"Que" is used to show how many samples are pending. (think 'unit lost', or "Structure completed" or things of that nature.)

"lst" is used to show how many samples are waiting to be played.

"Act" is used to show how many samples are actually playing right now.

Before, lst would be huge, since we didn't really kill off the samples correctly, and we were under the impression this had to do with sources. That was incorrect, at least partly.
We still can run out of sources, however, the frequency of this happening is vastly improved. (When the new Source manager is done, this will help people that are limited to 16 or 32 voices or less.)

Since lst had a ton of samples in it, the game thought it was a duplicate sample, and didn't add it to the act list. That is why people would lose sound, and then they would hit ESC to improve the issue.

Remaining items, some samples are stereo, which means, those use up 2 openAL sources. (Speaking of this, can someone run a utility to tell us which samples are stereo, and which are mono? I know most are mono, so just listing the stereo ones is fine. All the .ogg files in data\base\audio*)

The music is almost always stereo, and it uses 2 more sources for that as well.

The orientation is ... quirky. It seems we don't really calculate which way the player is facing, or should I say, we don't calculate it correctly. check :

	playerPos = audio_GetPlayerPos();
	audio_GetPlayerOrientation(&playerForward, &playerUp);
	sound_SetPlayerPos(playerPos);
	sound_SetPlayerOrientation(playerForward, playerUp);

If you are located at the top of the map versus the bottom, then it seems the channels are flipped when you go in/out range of things.
I didn't have time to check the cause of this, other than noticing this, both before my modifications, and after them.

I was thinking this would make a nice patch for both 2.2.2 and trunk.


Issue migrated from trac:770 at 2022-04-15 19:04:13 -0700

@wzdev-ci
Copy link
Contributor Author

Buginator uploaded file soundPatchNSM.patch (12.0 KiB)

@wzdev-ci
Copy link
Contributor Author

Buginator commented


Forgot to mention, soundPatchNSM2.patch is the one where I query openAL for what it thinks is available.

For those that are testing, please attach the crash dump file, after you do --crash on the command line.

Thanks!

@wzdev-ci
Copy link
Contributor Author

stiv uploaded file warzone2100.gdmp-WvpLOo (11.1 KiB)

--crash

@wzdev-ci
Copy link
Contributor Author

Buginator uploaded file soundPatchNSM-trunk.patch (12.0 KiB)

@wzdev-ci
Copy link
Contributor Author

Buginator commented


Note, the trunk patch is no different than 2.2. You could have used the same file...

BTW, I tested a 8p autogame with warcam on units to track sounds. Works for me. :)

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Aug 1, 2009

cybersphinx commented


Had a look at soundPatchNSM2.patch - you have some distracting whitespace changes in that. In sound_SetObjectPosition you could do "if (!psSample) return;" to prevent some of that. The changes in track.h/tracklib.h seem completely unnecessary.

Then in some places you add "f" to float constants, but in other places you add them without "f". And is a comparison to 0.0 really useful (since floats can have some precision problems)? Especially when you test for the volume to not play samples, a very small value like 0.00001 seems better to me.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Aug 1, 2009

i-NoD commented


Replying to [#770 Buginator]:

Remaining items, some samples are stereo, which means, those use up 2 openAL sources. (Speaking of this, can someone run a utility to tell us which samples are stereo, and which are mono? I know most are mono, so just listing the stereo ones is fine. All the .ogg files in data\base\audio*)

looks like the only stereo file is \data\base\audio\sfx\explons\richet2.ogg

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Aug 2, 2009

Buginator commented


Replying to Warzone2100/old-trac-import#770 (comment:3):

Had a look at soundPatchNSM2.patch - you have some distracting whitespace changes in that. In sound_SetObjectPosition you could do "if (!psSample) return;" to prevent some of that. The changes in track.h/tracklib.h seem completely unnecessary.

Then in some places you add "f" to float constants, but in other places you add them without "f". And is a comparison to 0.0 really useful (since floats can have some precision problems)? Especially when you test for the volume to not play samples, a very small value like 0.00001 seems better to me.

For the whiespace changes, most of the patch is from a bigger patch, and I didn't have time to fix everything correctly.

For the lack of "f" on floating point stuff, I just forgot. As for the 0.0f vs 0.00001f not really sure there would be much of a difference there.

Uploading a newer version.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Aug 2, 2009

Buginator uploaded file soundPatchNSM2a.patch (13.5 KiB)

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Aug 5, 2009

anonymous commented


Thanx! This werks very well!!!!

@wzdev-ci
Copy link
Contributor Author

cybersphinx uploaded file soundPatchNSM2a-cleanup.patch (10.4 KiB)

Same as soundPatchNSM2a.patch, just removed unnecessary whitespace changes and fixed the codingstyle.

@wzdev-ci
Copy link
Contributor Author

cybersphinx uploaded file soundPatch-addon-0.001-cutoff.patch (1.6 KiB)

Based on my previous patch, change "if (gain == 0.0) don't play" to if (gain < 0.001) don't play" to a

@wzdev-ci
Copy link
Contributor Author

the_cybersphinx changed status from new to closed

@wzdev-ci
Copy link
Contributor Author

the_cybersphinx set resolution to fixed

@wzdev-ci
Copy link
Contributor Author

the_cybersphinx commented


(In [8010]) Commit the cleaned up version of Buginator's sound patch. Closes #770.

This fixes the removal of unused sources, which didn't work correctly before.
The number of sources is still not limited, but the number of sounds used
concurrently is much lower now.

@wzdev-ci
Copy link
Contributor Author

the_cybersphinx commented


(In [8012]) Commit the cleaned up version of Buginator's sound patch. Closes #770.

This fixes the removal of unused sources, which didn't work correctly before.
The number of sources is still not limited, but the number of sounds used
concurrently is much lower now.

@wzdev-ci
Copy link
Contributor Author

Buginator commented


Erm, I forgot to add the patch for the sound looping fix. Will commit shortly.

@wzdev-ci
Copy link
Contributor Author

Buginator commented


Fixed in [8026]

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Aug 21, 2009

Buginator commented


Replying to Warzone2100/old-trac-import#770 (comment:4):

Replying to [#770 Buginator]:

Remaining items, some samples are stereo, which means, those use up 2 openAL sources. (Speaking of this, can someone run a utility to tell us which samples are stereo, and which are mono? I know most are mono, so just listing the stereo ones is fine. All the .ogg files in data\base\audio*)

looks like the only stereo file is \data\base\audio\sfx\explons\richet2.ogg

Ok, thanks for checking!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant