View Issue Details

IDProjectCategoryView StatusLast Update
0004614The Dark ModSoundpublic08.09.2017 03:35
Reporternbohr1more Assigned Tostgatilov  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionSVN 
Target VersionTDM 2.06Fixed in VersionTDM 2.06 
Summary0004614: Audio Loss in No Honor Among Thieves
DescriptionThis has happened in various missions sometime after 2.05 but No Honor Among Thieves has the most replicable version.
Steps To Reproduce1) Launch NHAT mission 1 politics
2) Navigate to the room with the jewels on the desk (right of the Priest's room in the courtyard)
3) Grab the Jewels
4) Note that the audio cuts in and out and henceforth the mission has audio issues
TagsNo tags attached.
Attached Files
NHAT_SOUND.save (2,307,696 bytes)
NHAT_SOUND2.save (2,314,684 bytes)
NHAT_SOUND2.jpg (195,158 bytes)   
NHAT_SOUND2.jpg (195,158 bytes)   

Relationships

has duplicate 0004553 resolvedstgatilov Some gameplay sounds stop playing after noclipping 

Activities

nbohr1more

nbohr1more

05.09.2017 03:46

developer   ~0009138

The 2nd save is after the replication.
grayman

grayman

06.09.2017 07:14

viewer   ~0009139

Is all audio cutting in and out, or some specific audio?

I loaded NHAT_SOUND and picked up the jewels and didn't hear any audio changes. The torch sound is still playing. Picking up the candle and dropping it sounded fine. Opening and closing the door sounded fine.

I checked the ambient sound and "silence" plays in that room. When I left the room, the ambient garden sound outside kicked in.

I loaded NHAT_SOUND2 and had the same experience as above.

This is using binaries built from the latest sources (7111).

Since I can't reproduce the problem, I suggest you post it to the forums to see if anyone else is experiencing this.
grayman

grayman

06.09.2017 07:20

viewer   ~0009140

The above tests were with the 32-bit binary.

I tested the 64-bit binary and had the same results.
stgatilov

stgatilov

06.09.2017 09:16

administrator   ~0009142

Does your issue look similar to 0004553?

Do you hear sword swinging sound after the issue? More details on "mission has audio issues", please...
Does saving and loading solve the problem?
Is it really perfectly reproducible for you? or it happens only sometimes?

BTW, Could you try to reproduce 0004553 on your machine and post a message in that issue if you succeed?
nbohr1more

nbohr1more

06.09.2017 12:40

developer   ~0009143

Q: Is all audio cutting in and out, or some specific audio?
A: Seems to affect mostly loot collection sounds

Q: Does your issue look similar to 0004553?
A: There is a similarity but I can reproduce this without noclipping it just takes awhile to get to the affected room.

Q: Is it really perfectly reproducible for you? or it happens only sometimes?
A: Yes. On a fresh start of the mission if I travel to this room it happens every time.

Q: Does saving and loading solve the problem?
A: I'll check again. I don't recall this working the last time I checked.
I will feel foolish if a save doesn't preserve the issue, I assumed it would
because I can reproduce it on demand from a fresh run of the mission.
stgatilov

stgatilov

06.09.2017 14:19

administrator   ~0009144

Last edited: 06.09.2017 14:43

I can reproduce it.

Enable noclip and notarget and fly directly to the garden. Then disable noclip. Pick a bit of locks to small rooms around the garden. Now run around the garden entering the rooms and exiting them. Also take a blackjack and start hitting with it constantly.

I must admit that "has audio issues" is the most precise thing I can say about it. Sometimes some sounds are missed: weapon swing, weapon hit upon both walls and guards, arrow hitting wall, clicks during lock picking, footsteps, guards talk (even parts of it). This happens quite regularly for me.

This looks like OpenAL issue. For instance, too many sounds overflow hardware limit of voices and some voices are randomly silenced... My console says "OpenAL: found 256 hardware voices", which should be more than enough.

BTW, going to another area does not fix the problem. But if I save and load then the problem is gone.

EDIT: Tried to reproduce afresh two more times. The first of them I did not succeed at all. The second time most sounds (swings, hits, click) gone away completely and did not return back. Save/load fixed it as usual.

nbohr1more

nbohr1more

06.09.2017 19:23

developer   ~0009146

Hmm. Sounds a lot like an allocation leak of some sort.
Not that I know how we "request a voice" and how we "release a voice".

Note: Native\GPL Audio has always been threaded:

        Sys_StartAsyncThread();
        {
            // Create a thread that will block on hTimer in order to run at 60Hz (every 16 milliseconds).
            // The Thread calls common->Async over and over for Sound mixing and input generation.
            
                 while ( 1 )
                 {
                        usleep( 16666 );
                        common->Async();
                        Sys_TriggerEvent( TRIGGER_EVENT_ONE );
                        pthread_testcancel();
                }
        }

This no longer exists in Windows code but is still in Linux and OSX?

Probably not helpful to dwell on that...
nbohr1more

nbohr1more

06.09.2017 19:40

developer   ~0009147

Hmm:

=====================
idSoundEmitterLocal::Free
They are never truly freed, just marked so they can be reused by the soundWorld
=====================
*/
void idSoundEmitterLocal::Free( bool immediate ) {
    if ( removeStatus != REMOVE_STATUS_ALIVE ) {
        return;
    }

    if ( idSoundSystemLocal::s_showStartSound.GetInteger() ) {
        common->Printf( "FreeSound (%i,%i)\n", index, (int)immediate );
    }
    if ( soundWorld && soundWorld->writeDemo ) {
        soundWorld->writeDemo->WriteInt( DS_SOUND );
        soundWorld->writeDemo->WriteInt( SCMD_FREE );
        soundWorld->writeDemo->WriteInt( index );
        soundWorld->writeDemo->WriteInt( immediate );
    }

    if ( !immediate ) {
        removeStatus = REMOVE_STATUS_WAITSAMPLEFINISHED;
    } else {
        Clear();
    }
}
stgatilov

stgatilov

07.09.2017 16:29

administrator   ~0009171

Last edited: 07.09.2017 17:08

Copied post from 0004553 (I debugged that case).
===============================================

I found why sounds are muted.

In idSampleDecoderLocal::DecodeOGG, new OGG file is opened:

  // open OGG file if not yet opened
  if ( lastSample == NULL ) {
    // make sure there is enough space for another decoder
    if ( decoderMemoryAllocator.GetFreeBlockMemory() < MIN_OGGVORBIS_MEMORY ) {
      return 0;
    }
    if ( sample->nonCacheData == NULL ) {
      assert( false ); // this should never happen
      failed = true;
      return 0;
    }
    file.SetData( (const char *)sample->nonCacheData, sample->objectMemSize );
    if ( ov_openFile( &file, &ogg ) < 0 ) {

As you see, if decoderMemoryAllocator has not enough free memory, then sound data is not written (results in perfectly zero sounds). The decoderMemoryAllocator is a custom memory allocator with 10 blocks (fixed number) of size 1 MB each.

I suppose nbohr1more is right and some sound memory is not freed properly. So the samples stack indefinitely. The fact that they are muted is just a safeguard against unlimited memory growth.

stgatilov

stgatilov

07.09.2017 17:40

administrator   ~0009173

Added a screenshot with "com_showSoundDecoders 1" in NHAT 1 mission.
As you see, there are tons of looped sounds, which simply stay indefinitely without being freed.

In the shot, I am in the place where zombie lurks. Why is machine_noise sound still played? Shouldn't underground_caves sound already stop by that moment?
Why is something like weather_wind present many times?
stgatilov

stgatilov

07.09.2017 17:58

administrator   ~0009174

Here is the offending code (in idSoundEmitterLocal::CheckForCompletion):
  // free decoder memory if no sound was decoded for a while
  /* if ( chan->decoder != NULL && chan->decoder->GetLastDecodeTime() < current44kHzTime - SOUND_DECODER_FREE_DELAY ) {
    chan->decoder->ClearDecoder();
  } */

This code was commented out in x64 branch:
  Revision: 6660
  Author: nbohr1more
  Message: nbohr1more: begin process converting int to long to match trunk for 3954

Given the message I guess this was some sort of temporary local modification which was accidentally committed to SVN. Or not?

P.S. Living with dozens of local changes is dangerous =)
nbohr1more

nbohr1more

07.09.2017 18:01

developer   ~0009175

Last edited: 07.09.2017 18:02

Good find.

I believe without this commented out, the initial x64 merge was
crashing due to variance in the code between ours and Dhewm.

Time to un-comment and see if the crash comes back...

nbohr1more

nbohr1more

08.09.2017 01:06

developer   ~0009176

Src Rev 7121
Binaries 14907

Issue History

Date Modified Username Field Change
05.09.2017 03:45 nbohr1more New Issue
05.09.2017 03:45 nbohr1more Status new => assigned
05.09.2017 03:45 nbohr1more Assigned To => grayman
05.09.2017 03:45 nbohr1more File Added: NHAT_SOUND.save
05.09.2017 03:45 nbohr1more File Added: NHAT_SOUND2.save
05.09.2017 03:45 nbohr1more File Added: NHAT_SOUND2.jpg
05.09.2017 03:46 nbohr1more Note Added: 0009138
06.09.2017 07:14 grayman Note Added: 0009139
06.09.2017 07:20 grayman Note Added: 0009140
06.09.2017 09:12 stgatilov Relationship added related to 0004553
06.09.2017 09:16 stgatilov Note Added: 0009142
06.09.2017 12:40 nbohr1more Note Added: 0009143
06.09.2017 14:19 stgatilov Note Added: 0009144
06.09.2017 14:22 stgatilov Note Edited: 0009144
06.09.2017 14:43 stgatilov Note Edited: 0009144
06.09.2017 19:23 nbohr1more Note Added: 0009146
06.09.2017 19:40 nbohr1more Note Added: 0009147
07.09.2017 16:29 stgatilov Note Added: 0009171
07.09.2017 17:08 stgatilov Note Edited: 0009171
07.09.2017 17:36 stgatilov File Added: nhat3_2017-09-08_00.36.36.jpg
07.09.2017 17:40 stgatilov Note Added: 0009173
07.09.2017 17:58 stgatilov Note Added: 0009174
07.09.2017 18:01 nbohr1more Note Added: 0009175
07.09.2017 18:02 nbohr1more Note Edited: 0009175
08.09.2017 01:05 nbohr1more Assigned To grayman => stgatilov
08.09.2017 01:05 nbohr1more Status assigned => resolved
08.09.2017 01:05 nbohr1more Resolution open => fixed
08.09.2017 01:05 nbohr1more Fixed in Version => TDM 2.06
08.09.2017 01:06 nbohr1more Note Added: 0009176
08.09.2017 03:35 stgatilov Relationship replaced has duplicate 0004553