Skip to content
This repository was archived by the owner on Apr 17, 2022. It is now read-only.
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

Description

@wzdev-ci

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

Activity

  1. wzdev-ci commented on Jul 31, 2009

    @wzdev-ci
    ContributorAuthor

    Buginator uploaded file soundPatchNSM.patch (12.0 KiB)

  2. wzdev-ci commented on Jul 31, 2009

    @wzdev-ci
    ContributorAuthor

    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!

  3. wzdev-ci commented on Jul 31, 2009

    @wzdev-ci
    ContributorAuthor

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

    --crash

  4. wzdev-ci commented on Jul 31, 2009

    @wzdev-ci
    ContributorAuthor

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

  5. wzdev-ci commented on Jul 31, 2009

    @wzdev-ci
    ContributorAuthor

    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. :)

  6. wzdev-ci commented on Aug 1, 2009

    @wzdev-ci
    ContributorAuthor

    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.

  7. wzdev-ci commented on Aug 1, 2009

    @wzdev-ci
    ContributorAuthor

    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

  8. wzdev-ci commented on Aug 2, 2009

    @wzdev-ci
    ContributorAuthor

    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.

  9. wzdev-ci commented on Aug 2, 2009

    @wzdev-ci
    ContributorAuthor

    Buginator uploaded file soundPatchNSM2a.patch (13.5 KiB)

  10. wzdev-ci commented on Aug 5, 2009

    @wzdev-ci
    ContributorAuthor

    anonymous commented


    Thanx! This werks very well!!!!

  11. wzdev-ci commented on Aug 13, 2009

    @wzdev-ci
    ContributorAuthor

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

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

  12. wzdev-ci commented on Aug 13, 2009

    @wzdev-ci
    ContributorAuthor

    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

  13. wzdev-ci commented on Aug 16, 2009

    @wzdev-ci
    ContributorAuthor

    the_cybersphinx changed status from new to closed

  14. wzdev-ci commented on Aug 16, 2009

    @wzdev-ci
    ContributorAuthor

    the_cybersphinx set resolution to fixed

  15. wzdev-ci commented on Aug 16, 2009

    @wzdev-ci
    ContributorAuthor

    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.

  16. wzdev-ci commented on Aug 16, 2009

    @wzdev-ci
    ContributorAuthor

    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.

  17. wzdev-ci commented on Aug 21, 2009

    @wzdev-ci
    ContributorAuthor

    Buginator commented


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

  18. wzdev-ci commented on Aug 21, 2009

    @wzdev-ci
    ContributorAuthor

    Buginator commented


    Fixed in [8026]

  19. wzdev-ci commented on Aug 21, 2009

    @wzdev-ci
    ContributorAuthor

    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions