[PR #2776] [MERGED] libraries: Initial Audio3d implementation. #2970

Closed
opened 2026-02-27 22:01:57 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/2776
Author: @squidbus
Created: 4/13/2025
Status: Merged
Merged: 4/14/2025
Merged by: @squidbus

Base: mainHead: a3d


📝 Commits (8)

  • b98f528 feat: Audio3d
  • 5bd10c5 feat: Audio3d
  • 8a50c9a audio3d: disable output
  • f0b4afa audio3d: Implement central Audio3d output.
  • 4600680 audio3d: Ignore AudioOut already initialized error.
  • 0a731b2 audio3d: Convert and retain sample buffers when queued.
  • f75f4ca audio3d: Treat object audio as single channel.
  • 0f3d3eb audio3d: Clean up.

📊 Changes

8 files changed (+556 additions, -319 deletions)

View changed files

📝 CMakeLists.txt (+0 -2)
📝 src/core/libraries/audio/audioout.cpp (+2 -1)
📝 src/core/libraries/audio/audioout.h (+9 -1)
📝 src/core/libraries/audio3d/audio3d.cpp (+443 -192)
📝 src/core/libraries/audio3d/audio3d.h (+102 -92)
📝 src/core/libraries/audio3d/audio3d_error.h (+0 -2)
src/core/libraries/audio3d/audio3d_impl.cpp (+0 -13)
src/core/libraries/audio3d/audio3d_impl.h (+0 -16)

📄 Description

Continuing off of https://github.com/shadps4-emu/shadPS4/pull/2694 to get Audio3d to a good-enough state to start getting some games working.

This has a few changes over the PR:

  • Fixed queued audio to output to a dedicated Audio3d output opened on initialize, with the same parameters as the real library uses.
  • Fixed sceAudio3dAudioOut* to use separate audio out handles from queued audio, so that audio properly plays at the same time. This fixes issues in Project DIVA X where the audio would be slow and full of gaps, since the audio was being interleaved instead of overlapped.
  • Fixed issues with channel counts and formats. For sceAudio3dBedWrite2, both the format and channel count are respected, and for sceAudio3dObjectSetAttributes, format is respected and number of channels is always 1. In both cases, the audio is properly converted down to the signed 16-bit stereo that Audio3d uses for its primary audio output.
  • Fix audio pointers being passed on directly instead of retaining audio data in the queue.
  • Fix up advance vs push to properly advance to the next item in the queue on advance and then send the current item to audio out on push.
  • Implement some other functions like sceAudio3dAudioOutClose and sceAudio3dGetDefaultOpenParameters.
  • Misc clean up and formatting.

With this, Project DIVA X has working audio from my testing. Other testing indicates some more complex games at least have fewer audio issues up to the point they can currently be tested, for example loud garbage audio should be gone in many cases.

There are still many missing features (e.g. handling actual positional audio attributes, some port modes) so I don't expect this to be perfect for many games yet.


🔄 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/2776 **Author:** [@squidbus](https://github.com/squidbus) **Created:** 4/13/2025 **Status:** ✅ Merged **Merged:** 4/14/2025 **Merged by:** [@squidbus](https://github.com/squidbus) **Base:** `main` ← **Head:** `a3d` --- ### 📝 Commits (8) - [`b98f528`](https://github.com/shadps4-emu/shadPS4/commit/b98f528834350c968455a406fadd70464cdfc207) feat: Audio3d - [`5bd10c5`](https://github.com/shadps4-emu/shadPS4/commit/5bd10c5f8a941ad998d19feeccd3e85a49588419) feat: Audio3d - [`8a50c9a`](https://github.com/shadps4-emu/shadPS4/commit/8a50c9a1eb3c21c3a83962ed81625dd5a9785a50) audio3d: disable output - [`f0b4afa`](https://github.com/shadps4-emu/shadPS4/commit/f0b4afaec6f9de22ab134abffbe82a1dde4e3724) audio3d: Implement central Audio3d output. - [`4600680`](https://github.com/shadps4-emu/shadPS4/commit/46006806c820fc870ebb6b9b2b62f094bc1f8984) audio3d: Ignore AudioOut already initialized error. - [`0a731b2`](https://github.com/shadps4-emu/shadPS4/commit/0a731b2cc02b639b3d3db5b1b1e5bdb52a1b8537) audio3d: Convert and retain sample buffers when queued. - [`f75f4ca`](https://github.com/shadps4-emu/shadPS4/commit/f75f4ca94f77698aea83775839ceb084036a2896) audio3d: Treat object audio as single channel. - [`0f3d3eb`](https://github.com/shadps4-emu/shadPS4/commit/0f3d3eb8aec90542d9d49f0c402a27eb4c874a6f) audio3d: Clean up. ### 📊 Changes **8 files changed** (+556 additions, -319 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+0 -2) 📝 `src/core/libraries/audio/audioout.cpp` (+2 -1) 📝 `src/core/libraries/audio/audioout.h` (+9 -1) 📝 `src/core/libraries/audio3d/audio3d.cpp` (+443 -192) 📝 `src/core/libraries/audio3d/audio3d.h` (+102 -92) 📝 `src/core/libraries/audio3d/audio3d_error.h` (+0 -2) ➖ `src/core/libraries/audio3d/audio3d_impl.cpp` (+0 -13) ➖ `src/core/libraries/audio3d/audio3d_impl.h` (+0 -16) </details> ### 📄 Description Continuing off of https://github.com/shadps4-emu/shadPS4/pull/2694 to get Audio3d to a good-enough state to start getting some games working. This has a few changes over the PR: * Fixed queued audio to output to a dedicated Audio3d output opened on initialize, with the same parameters as the real library uses. * Fixed `sceAudio3dAudioOut*` to use separate audio out handles from queued audio, so that audio properly plays at the same time. This fixes issues in Project DIVA X where the audio would be slow and full of gaps, since the audio was being interleaved instead of overlapped. * Fixed issues with channel counts and formats. For `sceAudio3dBedWrite2`, both the format and channel count are respected, and for `sceAudio3dObjectSetAttributes`, format is respected and number of channels is always 1. In both cases, the audio is properly converted down to the signed 16-bit stereo that Audio3d uses for its primary audio output. * Fix audio pointers being passed on directly instead of retaining audio data in the queue. * Fix up advance vs push to properly advance to the next item in the queue on advance and then send the current item to audio out on push. * Implement some other functions like `sceAudio3dAudioOutClose` and `sceAudio3dGetDefaultOpenParameters`. * Misc clean up and formatting. With this, Project DIVA X has working audio from my testing. Other testing indicates some more complex games at least have fewer audio issues up to the point they can currently be tested, for example loud garbage audio should be gone in many cases. There are still many missing features (e.g. handling actual positional audio attributes, some port modes) so I don't expect this to be perfect for many games yet. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:01:57 +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#2970
No description provided.