[PR #1986] [MERGED] audio: Accurate audio output timing. #2421

Closed
opened 2026-02-27 21:16:26 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/1986
Author: @squidbus
Created: 12/30/2024
Status: Merged
Merged: 12/31/2024
Merged by: @georgemoralis

Base: mainHead: audio-timing


📝 Commits (3)

  • cf4bd54 audio: Accurate audio output timing.
  • 3a02d28 audio: Handle SDL audio queue stalls.
  • 3c86a99 audio: Format info cleanup.

📊 Changes

15 files changed (+170 additions, -821 deletions)

View changed files

📝 .gitmodules (+0 -4)
📝 CMakeLists.txt (+1 -4)
LICENSES/ISC.txt (+0 -7)
📝 externals/CMakeLists.txt (+0 -10)
externals/cubeb (+0 -1)
📝 src/common/config.cpp (+0 -17)
📝 src/common/config.h (+0 -2)
src/common/ringbuffer.h (+0 -374)
📝 src/core/libraries/audio/audioout.cpp (+82 -158)
📝 src/core/libraries/audio/audioout.h (+32 -13)
📝 src/core/libraries/audio/audioout_backend.h (+4 -17)
src/core/libraries/audio/cubeb_audio.cpp (+0 -174)
📝 src/core/libraries/audio/sdl_audio.cpp (+51 -11)
📝 src/qt_gui/settings_dialog.cpp (+0 -6)
📝 src/qt_gui/settings_dialog.ui (+0 -23)

📄 Description

Implements accurate timing for audio output, using a single-buffer queue same as the actual audio out library and a thread to manage audio timing.

This also removes cubeb for now at least as with this fix, SDL seems to be working just as well, and debugging is simpler if we just have to worry about one audio backend configuration. We can re-add this in the future if needed but for some Windows users it seems to be resulting in strange crashes.

Needs testing with various OSes and games to make sure this works for all audio systems, as the timing might be tight. From my testing it seems to work pretty well on Mac.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/1986 **Author:** [@squidbus](https://github.com/squidbus) **Created:** 12/30/2024 **Status:** ✅ Merged **Merged:** 12/31/2024 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `audio-timing` --- ### 📝 Commits (3) - [`cf4bd54`](https://github.com/shadps4-emu/shadPS4/commit/cf4bd5446fff57de0b6eedbe8c223d71088e65f9) audio: Accurate audio output timing. - [`3a02d28`](https://github.com/shadps4-emu/shadPS4/commit/3a02d2860cc5e0b5013bcab3979612bea04b0aa9) audio: Handle SDL audio queue stalls. - [`3c86a99`](https://github.com/shadps4-emu/shadPS4/commit/3c86a9906a67f5856afd3e87f5aa9b1e9e7e8bd8) audio: Format info cleanup. ### 📊 Changes **15 files changed** (+170 additions, -821 deletions) <details> <summary>View changed files</summary> 📝 `.gitmodules` (+0 -4) 📝 `CMakeLists.txt` (+1 -4) ➖ `LICENSES/ISC.txt` (+0 -7) 📝 `externals/CMakeLists.txt` (+0 -10) ➖ `externals/cubeb` (+0 -1) 📝 `src/common/config.cpp` (+0 -17) 📝 `src/common/config.h` (+0 -2) ➖ `src/common/ringbuffer.h` (+0 -374) 📝 `src/core/libraries/audio/audioout.cpp` (+82 -158) 📝 `src/core/libraries/audio/audioout.h` (+32 -13) 📝 `src/core/libraries/audio/audioout_backend.h` (+4 -17) ➖ `src/core/libraries/audio/cubeb_audio.cpp` (+0 -174) 📝 `src/core/libraries/audio/sdl_audio.cpp` (+51 -11) 📝 `src/qt_gui/settings_dialog.cpp` (+0 -6) 📝 `src/qt_gui/settings_dialog.ui` (+0 -23) </details> ### 📄 Description Implements accurate timing for audio output, using a single-buffer queue same as the actual audio out library and a thread to manage audio timing. This also removes cubeb for now at least as with this fix, SDL seems to be working just as well, and debugging is simpler if we just have to worry about one audio backend configuration. We can re-add this in the future if needed but for some Windows users it seems to be resulting in strange crashes. Needs testing with various OSes and games to make sure this works for all audio systems, as the timing might be tight. From my testing it seems to work pretty well on Mac. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:16:26 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#2421
No description provided.