Opened 6 years ago

Closed 3 years ago

#5265 closed defect (fixed)

Audio issues on Mac OS

Reported by: Eszett Owned by: wraitii
Priority: Must Have Milestone: Alpha 24
Component: Music & Sound FX Keywords: OpenAl macOS
Cc: Krinkle Patch: Phab:D3445

Description (last modified by Langbart)

Many game sounds are missing, and I get notifications in the top-left corner of the screen telling me that sound effects failed to load.

Could not initialize ogg data at audio/interface/ui/ui_button_click.ogg Failed to create initial buffer. OpenAL error: Invalid Value

This seems to randomly affect specific sounds, and increases as the game continues

https://i.ibb.co/MZhVMDb/Screenshot-2021-01-20-at-16-19-33.png

Attachments (7)

14jan21interestinglog.html (726 bytes ) - added by Langbart 3 years ago.
14jan21mainlog.html (145.4 KB ) - added by Langbart 3 years ago.
24725interestinglog.html (783 bytes ) - added by Langbart 3 years ago.
24725mainlog.html (350.8 KB ) - added by Langbart 3 years ago.
24727interestinglog.html (6.3 KB ) - added by Langbart 3 years ago.
24727mainlog.html (261.3 KB ) - added by Langbart 3 years ago.
24727system_info.txt (3.8 KB ) - added by Langbart 3 years ago.

Download all attachments as: .zip

Change History (24)

comment:1 by Stan, 6 years ago

Can you give us more info about the platform and make sure your sound card is enabled.

comment:2 by elexis, 6 years ago

and the logfiles wiki:GameDataPaths

comment:3 by Krinkle, 5 years ago

I see the same issue.

Game: Alpha 23 (21946MP). Hardware: MacBook Pro (Retina, 15-inch, 16 GB RAM). OS: macOS 10.14.4.

When I use the game for a short time, or only single player, everything is fine. But after 1 multiplayer game and a replay, things start getting wonky. Sometimes the music and attack sounds are just missing (no errors). Other times, the UI sounds are missing. At that point, when clicking on anything in the menus during the replay or in the MP lobby, it keeps showing this, for every click.

 OpenAL error: Invalid Value
 Could not initialize ogg data at audio/interface/ui/ui_button_click.ogg Failed to create initial buffer.

After a restart it is fine, but it eventually comes back. Next time I see it will try to get the interestinglogs.html contents.

comment:4 by Krinkle, 5 years ago

Cc: Krinkle added

comment:5 by Stan, 5 years ago

Does your MacBook overheat ? Does it also happen when you open the modselector and return in game ? Did it happen with the previous versions of the game ?

comment:6 by Rolf Dew, 4 years ago

Hi Stanislas, I also get this error sometimes too. I also use a mac, I believe it is a memory related error, it generally happens for me on maps with a lot of detail or polygons and can happen on a light map if to many high poly units are on the screen at once, it can happen if you play a match too long, as the memory gets fuller over time, perhaps related too a memory leak or weaker specs. In my case it only happens with Hyrule Conquest with specific maps, I have never experienced it with the vanilla game. It seems that openAL causes problems with mac os when thüe memory gets full perhaps.

Last edited 4 years ago by Rolf Dew (previous) (diff)

comment:7 by asterix, 4 years ago

Keywords: OpenAl added
Milestone: BacklogAlpha 24
Priority: Should HaveRelease Blocker

Hmmm...openAL is deprecated in recent versions of mac 10.14 (latest update) and especially 10.15. For mac users this is basically release blocker due to missing sounds.

comment:9 by Stan, 4 years ago

Milestone: Alpha 24Backlog
Priority: Release BlockerMust Have
Summary: Sounds missingAudio issues on Mac OS

Apple has decided to deprecate OpenAL and OpenGL.

We currently do not have the ability to fix this. This requires rewriting all our rendering code and all our audio code to fix only 1 platform.

OpenAL should be replaced by AVAudio a proprietary library of Apple https://developer.apple.com/documentation/ios_ipados_release_notes/ios_ipados_13_1_release_notes#3380407

OpenGL should be replaced by either Metal (Meaning writing a custom renderer for Apple OS) or Molten VK meaning rewriting all our rendering code to use Vulkan. We currently do not have the resources for that. Using vulkan would also mean dropping a lot of our player base whose GPUs do not support it.

I'm setting this to high priority because I believe it is but we can't block a release because of that, or there won't be any release any more.

comment:10 by Langbart, 3 years ago

While playing the game I encountered this error message. So far this has only happened once. Will update this description if it occurs again.

macOS 10.15.7 using macOS TestBundle14,Jan2021

0 A.D. (0.0.24) Main log (warnings and errors only)
ERROR: OpenAL error: Unknown Internal Error; called from Pause (line 376)
ERROR: Failed to create initial buffer. OpenAL error: Invalid Value
ERROR: could not initialize ogg data at audio/attack/siege/ram_attack.ogg
ERROR: error loading sound: pathname=audio/attack/siege/ram_attack.ogg, error=Function failed (no details available)

I will attach two files.

  • 14jan21mainlog.html
  • 14jan21interestinglog.html

by Langbart, 3 years ago

Attachment: 14jan21interestinglog.html added

by Langbart, 3 years ago

Attachment: 14jan21mainlog.html added

comment:11 by Langbart, 3 years ago

Playing SVN version 24725 on macOS 10.15.7 the OpenAl error came up again. There seems to be no hard and fast rule when this problem occurs. I will attach two files.

I will attach two files.

  • 24725mainlog.html
  • 24725interestinglog.html

by Langbart, 3 years ago

Attachment: 24725interestinglog.html added

by Langbart, 3 years ago

Attachment: 24725mainlog.html added

comment:12 by Langbart, 3 years ago

Description: modified (diff)
Keywords: macOS added
Milestone: BacklogAlpha 24

comment:13 by Langbart, 3 years ago

At Stan's suggestion, I tested a scenario map called "Combat Demo (huge)". When I played through the map from start to finish, no errors occurred, even when I played the map several times in a row. But when I repeatedly quit and restarted the game immediately after spawning, a continuous stream of error messages occurred. As seen in the attached files. It took me about 10 restarts before the first message appeared and then it goes on and on, generating new error messages with each new restart.

SVN version 24727 on macOS 10.15.7

I will attach three files.

  • 24727mainlog.html
  • 24727interestinglog.html
  • 24727system_info.txt

by Langbart, 3 years ago

Attachment: 24727interestinglog.html added

by Langbart, 3 years ago

Attachment: 24727mainlog.html added

by Langbart, 3 years ago

Attachment: 24727system_info.txt added

comment:14 by wraitii, 3 years ago

I can reproduce this consistently by starting a lot of games, as reported by langbart.

From what I can tell, the errors pop up once we have 1000 openAL buffers "in flight", which can happen quickly because music/ambient sounds take 50 buffers, and sometimes don't clear until 0 A.D. is exited.

I think i've read somewhere that Mac OS had that limit, but I literally can't find where again :P (edit: https://stackoverflow.com/questions/3894044/maximum-number-of-openal-sound-buffers-on-iphone, thanks stan)

Anyways, the cause here is that we have leaks, because we're not properly clearing "stream" items. They end up paused, and then they're never deleted until game's exit.

Last edited 3 years ago by wraitii (previous) (diff)

comment:15 by wraitii, 3 years ago

Patch: Phab:D3445

comment:16 by Stan, 3 years ago

Owner: set to wraitii

comment:17 by wraitii, 3 years ago

Resolution: fixed
Status: newclosed

In 24762:

Fix audio leak that resulted in openAL errors after a while.

Sound items were only deleted after 'last play' when stopped, but they could also be left in 'paused' or 'initial' states, and were then not cleared until the game exits (effectively a memory leak). This affected particularly music & ambient sounds, which also used the most buffers(/memory).
On MacOS (at least), this resulted in OpenAL errors & sound failures after a while playing the game, because MacOS has a max "in flight buffers" of 1024.

Also clean up some control flow in CStreamItem

Reported by: Eszett

Thanks langbart for the consistent repro'.

Fixes #5265

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

Note: See TracTickets for help on using tickets.