Opened 9 years ago

Last modified 3 years ago

#3285 new defect

Sound error when no sound device or disabled

Reported by: Vladislav Belov Owned by:
Priority: Must Have Milestone: Backlog
Component: Music & Sound FX Keywords:
Cc: Patch:

Description (last modified by Imarok)

If the sound device is disabled then we have next error on start:

ERROR: Sound: AlcInit failed, m_Device=0x0 m_Context=0x0 dev_name=OpenAL Soft err=a004

And in game:

OpenAL error: (null); called from COggData::InitOggFile (line 74)
ERROR: Failed to create initial buffer. OpenAL error: (null)
ERROR: could not initialize ogg data at audio/voice/latin/civ/civ_male_what_is_it_1.ogg
ERROR: OpenAL error: (null); called from COggData::~COggData (line 36)
ERROR: OpenAL error: (null); called from COggData::~COggData (line 40)
ERROR: OpenAL error: (null); called from COggData::~COggData (line 44)
ERROR: OpenAL error: (null); called from CSoundData::~CSoundData (line 37)
ERROR: OpenAL error: (null); called from CSoundData::~CSoundData (line 41)
ERROR: error loading sound: pathname=audio/voice/latin/civ/civ_male_what_is_it_1.ogg, error=Function failed (no details available)

Second problem, that if we will miss the sound device in game (pull out minijack of headphones) then sound dissapear, and doesn't appear after return headphones on the place.

My suggestions:

  • check (nullptr and alc* functions) Device & Context every time when something want to play sound
  • show to player nice message that the sound device is missing and sounds will not play.

Change History (9)

comment:1 by historic_bruno, 9 years ago

I think the old sound manager would attempt to init every time its API was used, if it had previously failed, so that is possibly worth doing.

The other thing is there shouldn't be multiple errors if init fails, as you say, one message would suffice. I guess there are some missing checks in parts of the API.

comment:2 by Itms, 9 years ago

Component: Core engineMusic & Sound FX
Keywords: sound removed
Milestone: Alpha 19Backlog

comment:3 by Imarok, 6 years ago

Description: modified (diff)

When disabling sounds by starting 0ad with "--nosound" these errors I also get errors at startup, but none ingame:

ERROR: Sound: AlcInit failed, m_Device=0x0 m_Context=0x0 dev_name=OpenAL Soft err=a004

ERROR: OpenAL error: (null); called from CSoundManager::~CSoundManager (line 277) 

Edit: Seems like the whole thing is only broken on windows.

Last edited 6 years ago by Imarok (previous) (diff)

comment:4 by Imarok, 6 years ago

Patch: Phab:D1481

comment:5 by elexis, 5 years ago

Milestone: BacklogAlpha 24

Duplicate at #3285

Imaroks messages can be reproduced in a windows VM with disabled soundcard.

comment:6 by Stan, 4 years ago

Owner: set to Stan

comment:7 by Marco Amadori, 3 years ago

For the second part, it happens also on linux since by default OpenAL does not permit to e.g. pulseaudio to switch device on the fly (with some reasons). It should be handled properly in the code in 0ad by polling for a disconnect (or trap the error) and reinitialize.

As a work-around on linux you could edit:

~/.alsoftrc

[pulse]
allow-moves = true

comment:8 by Stan, 3 years ago

In 24551:

Fix sound errors when no sound card is detected.

Based on a patch by: @Imarok
Refs: #3285

Differential Revision: https://code.wildfiregames.com/D1481

comment:9 by Stan, 3 years ago

Milestone: Alpha 24Backlog
Owner: Stan removed
Patch: Phab:D1481

First part is done, there is no longer endless spamming, now we need a way to hotload soundcards.

Note: See TracTickets for help on using tickets.