Commit Graph
170 Commits
Author SHA1 Message Date
Dean Galvin f200a93447 Merge main into this branch 2026-11-01 12:07:53 +13:00
Dean Galvin 31cf82a8a3 Merge #13988 into this branch 2026-11-01 12:07:47 +13:00
alfalfa-starandClaude Opus 5.5 c34ab0258d fix(libSceAudioOut): play the PCM a port was given at the set when an AudioOut2 context advances
Advance read each port's buffer when it completed the grain. Crash
Bandicoot 4 (PPSA02433) runs Wwise, which sets each object port's buffer
after mixing and clears the buffer for the next frame before it calls
Advance, so every grain was read as silence and the menu and gameplay had
no sound. A grain given by a set now plays the copy taken at that set; a
repeated buffer is still read at Advance.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 15:56:36 +01:00
alfalfa-starandClaude Opus 5.5 11f217b14f fix(libSceAudioOut): play silence for a regiven AudioOut2 buffer that is not set again
A port without a new buffer for a grain repeated its last one whenever the
buffer had not moved on, which also covered a port given the same buffer
every grain. Crash Bandicoot 4 (PPSA02433) gives each Wwise object port the
same buffer every grain and none for about 350 ms while it loads; the
repeat then played the memory Wwise had reused, a loud burst of noise.
Only a port given a buffer once since it was created or cleared repeats it
now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 15:29:32 +01:00
MarcZX10 2bdcad1490 Merge upstream/main into fix/host-device-changes 2026-10-30 23:52:24 +00:00
Adrià b55fa1b387 Merge pull request #13223 from kyon-eth/feat/audio-out-320-exports
feat(libSceAudioOut): declare 33 callable exports
2026-10-30 23:57:31 +01:00
MarcZX10 9b6c28b8bd Merge upstream/main into fix/host-device-changes
Bring the branch up to the current upstream main. The only conflict was the
AudioOut debt doc, where both sides added a Functional entry; both are kept.
2026-10-30 19:52:07 +00:00
MarcZX10 737bcb8f69 refactor(libScePad): own the shared host volume state
The volume, mute and focus state that libSceAudioOut applies and libSceVideoOut changes now lives in libScePad, which both libraries already link, instead of in libSceAudioOut. The tests that compile the state directly and the environment reference follow the file.
2026-10-30 16:29:55 +01:00
MarcZX10 14b0b4b5f2 refactor(libScePad): move the host volume headers from libSceAudioOut
libSceVideoOut reads and changes the shared host volume state, and linking libSceAudioOut for it puts a second shared library with its own static SDL2 into libSceVideoOut. Both libraries already link libScePad, so the headers that describe that state move there first; the include paths and guards follow.
2026-10-30 16:29:55 +01:00
MarcZX10 c255f112db feat(libSceAudioOut): apply the host volume where AudioOut2 hands PCM to the device
DeviceCallback applies the context's ramp to the stereo float it just filled, which is the only place the AudioOut2 main mix reaches the speakers; the title's own volumes and the mastering stay before it. At the default volume the ramp is at unity and the call returns without touching the stream. The controller sound card keeps its own path and is not touched.
2026-10-30 16:29:55 +01:00
MarcZX10 1e82fc5a7e feat(libSceAudioOut): give each AudioOut2 context a host gain ramp
Ten milliseconds of the 48 kHz stereo output for a full-scale change.
2026-10-30 16:29:55 +01:00
MarcZX10 0b8656250b feat(libSceAudioOut): apply the host volume where AudioOut queues PCM to SDL
Every non-vibration port goes through HostGainFilter just before SDL_QueueAudio, after the title's volume and channel order. With the default volume the filter returns the title's buffer untouched. Vibration ports go to the controller's sound card and are not touched.
2026-10-30 16:29:55 +01:00
MarcZX10 30cca88304 feat(libSceAudioOut): give every AudioOut port its own host gain ramp
The ramp is ten milliseconds of the port's own frame rate for a full-scale change, and a reopened port starts from unity.
2026-10-30 16:29:55 +01:00
MarcZX10 31c54b6cb3 feat(libSceAudioOut): keep one shared host volume for the process
The state sits behind a mutex and publishes its gain through an atomic, so the audio threads read it without locking. HostVolumeConfigure replaces the state, parsing ANYPS5_VOLUME and ANYPS5_MUTE_ON_FOCUS_LOSS before changing anything, so an invalid value leaves it untouched and throws an error naming the variable.
2026-10-30 16:29:55 +01:00
Adrià 01069f4d2b Merge pull request #12954 from hugodearaujo/fix/audioout2-blocking-push
fix(libSceAudioOut): return from a blocking AudioOut2 push once the queue has room
2026-10-30 15:45:36 +01:00
MarcZX10 ccaac6602b fix(libSceAudioOut): reopen a controller sound card the host stopped
A vibration port plays through the controller's own sound card, such as
a DualSense over Bluetooth. When the backend disables that device, SDL
keeps the port's device disabled until it is closed (see the default
output fix), so the port's haptic audio stopped for the rest of the run.

Before a vibration port's device is used, close it and open the
controller sound card again when its status is stopped. A failed reopen
leaves the port with no device, so its output runs as a virtual port,
as a vibration port opened with no controller card does today. Such a
port is not retried later.
2026-10-30 13:58:28 +00:00
MarcZX10 b87075aad9 fix(libSceAudioOut): reopen the default output after the host stops it
SDL marks an opened device as disabled when the backend reports it lost
(SDL_OpenedAudioDeviceDisconnected in src/audio/SDL_audio.c of the
bundled 3rdparty/SDL2 at 4b69833bc). The flag is set back only when a
device is opened again, so a disabled device stays silent until it is
closed, and SDL_GetAudioDeviceStatus reports SDL_AUDIO_STOPPED.

AudioOut never checked that status for a port's default output, so
after the output went away the title's audio stayed silent for the rest
of its run while every output call still returned success.

Before a default-output port is used, reopen its device when its status
is stopped. A failed reopen leaves the port with no device, so it runs
as a virtual port, as a port opened with no output does today. Such a
port is not retried later.
2026-10-30 13:57:41 +00:00
Kyon e4b274109f feat(libSceAudioOut): declare 33 callable exports 2026-10-30 07:02:41 +00:00
Adrià a36ff7f47e Merge pull request #12584 from Biologisten/fix/audio-pad-speaker-mute
feat(audio): add controller speaker fallback override
2026-10-30 07:12:28 +01:00
hugodearaujo 56fd9eac87 Merge main into fix/audioout2-blocking-push
# Conflicts:
#	core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp
2026-10-30 03:03:08 -03:00
Adrià 4628011bc8 Merge pull request #12727 from XairRrR/fix-audioout-context-handles
fix(libSceAudioOut): reject AudioOut2 context handles that are not live contexts
2026-10-30 05:51:47 +01:00
hugodearaujo 2aca989548 test(libSceAudioOut): hold a blocking push on a test clock until playback frees a slot
A device-less context can run its queue model on a clock the test sets. With the clock frozen, a blocking push that fills the queue is seen still waiting with its grain queued and not counted, and returns once the test plays one grain; a blocking push that meets a queue filled by non-blocking pushes does not queue past the depth.
2026-10-29 22:14:23 -03:00
Adrià 7a225bb303 Merge pull request #12686 from MarcZX10/feat/pad-rumble-intensity
feat(libSceVideoOut): add ANYPS5_RUMBLE to scale or turn off host controller vibration
2026-10-29 23:46:17 +01:00
Dean 85ae67061d Merge pull request #12856 from slopgobblercobbler/fix/audioout-param-buffer-validation
fix(libSceAudioOut): validate open format parameter and virtual port buffer boundaries
2026-10-30 10:18:42 +13:00
Dean af4e595327 Merge pull request #11762 from oneandonlydean/salvage/small-exports-9541
feat(prx): declare 34 PS5 JSON, AudioOut, AudioIn and Sdma exports
2026-10-30 08:13:52 +13:00
hugodearaujo 7a75ea95b3 docs(libSceAudioOut): record the blocking push wait as inferred from PPSA02530
The wait is described in the debt file instead of in code comments.
2026-10-29 13:29:53 -03:00
hugodearaujo 42beeaa468 fix(libSceAudioOut): return from a blocking AudioOut2 push once the queue has room
A blocking sceAudioOut2ContextPush waited only before queueing its grain, so the push that filled the queue returned at once. PRAGMATA's Wwise feeds its context from a thread that pushes and then wakes the renderer; the renderer sees a full queue, sleeps, and is woken again only by the game's next RenderAudio, so the mix advanced four grains per game frame. A blocking push now also waits after queueing until a grain finishes, bounded by the existing 200 ms limit.
2026-10-29 12:39:32 -03:00
slopgobblercobbler 120b2036a5 fix(libSceAudioOut): validate open format parameter and virtual port buffer boundaries 2026-10-29 14:27:50 +01:00
XairRrR 03decdabe0 fix(libSceAudioOut): reject AudioOut2 context handles that are not live contexts
An AudioOut2 context handle was the host pointer itself, and every
sceAudioOut2Context* call and sceAudioOut2PortCreate only rejected 0. A
second sceAudioOut2ContextDestroy of the same handle deleted the context
twice, Push, Advance, GetQueueLevel and SetAttributes on a destroyed
context used freed memory, and PortCreate accepted any nonzero value and
kept it as the port's context, so the next PCM attribute on that port read
the grain size through it.

Live contexts are now kept in a set: ContextCreate adds the context,
ContextDestroy removes it before releasing it, and the other context calls
and PortCreate return SCE_AUDIO_OUT2_ERROR_INVALID_HANDLE for a handle that
is not in the set. The queue level test that passed a stack object as a
handle now uses a created context with its device closed.

AI-assisted: yes
2026-10-29 06:38:00 +01:00
Biologisten 80df59b666 test(audio): isolate AudioOut2 tests from APS5_PAD_SPEAKER_FALLBACK_DB
CreateContext() reads the variable, so a value exported in the developer's shell reached the AudioOut2 tests: garbage aborted seven of the sixty audio tests and -15 broke the unity fold in audio_out2_port_layouts. Every test that creates a context now unsets the variable at the start of main(), and the tests that exercise it set it themselves.

Throws() now takes the exception type it expects, so the two port checks still require std::invalid_argument while the environment check requires std::runtime_error. The rejection error keeps the original pointer to the value, so a value with leading whitespace is reported verbatim and the test checks the name=value prefix.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <[email protected]>
2026-10-29 05:46:33 +01:00
MarcZX10 38a08d2d43 feat(libSceAudioOut): apply ANYPS5_RUMBLE to AudioOut2 vibration ports on a controller sound card
The AudioOut2 mixer queues the pad mix on the controller sound card unscaled. Pass the rumble percentage to the actuator write so 0 plays silence and the default is unchanged. The fallback that turns the same mix into motor rumble when no sound card plays it is scaled once, later, by the pad output.
2026-10-29 02:06:36 +00:00
MarcZX10 705163bd27 feat(libSceAudioOut): apply ANYPS5_RUMBLE to legacy vibration ports on a controller sound card
The legacy AudioOut vibration port queues its PCM on the controller sound card unscaled. Pass the rumble percentage to the actuator write so 0 plays silence and the default is unchanged.
2026-10-29 02:06:36 +00:00
MarcZX10 1bb8e8b2fd feat(libSceAudioOut): add an actuator percentage to AudioOut2WritePadFrames
Vibration ports that play on a controller sound card write their PCM to the actuator channels with no way to reduce it. Add a trailing percentage parameter, defaulting to 100 which writes the same samples as before, that scales only the two actuator channels and writes silence at 0. The controller speaker channels are never scaled.
2026-10-29 02:06:36 +00:00
Biologisten 315050d000 fix(audio): reject invalid APS5_PAD_SPEAKER_FALLBACK_DB values and read the gain once
A set-but-invalid value, including an empty one, a non-finite number, a
number outside -60 to 0 or trailing text, stops the title with an error
naming the variable and the value instead of silently keeping 0 dB. The
gain is parsed once when the AudioOut2 context is created, kept in the
context and passed to the mix loop, so the audio thread never reads the
environment.

The one-read rule is pinned end to end: a play that changes the variable
to a value that would stop the title after the context was created keeps
the parsed fold and never re-reads the environment.
2026-10-29 00:16:16 +01:00
Biologisten 84b5542fdc feat(audio): add controller speaker fallback override
Add APS5_PAD_SPEAKER_FALLBACK_DB for AudioOut2 controller-speaker ports
folded into the main mix when no controller speaker is present. The
default 0 dB keeps the existing unity mix; mute removes the fallback
copy so a title's own main-port copy is heard instead.
2026-10-29 00:16:16 +01:00
SeaSunPTandClaude Opus 5.5 9f6c3527ed fix(libSceAudioOut): refuse system debug state and chat calls before sceAudioOut2Initialize
#9838 read sceAudioOut2SetSystemDebugState in PS5 firmware 3.20 and 4.03:
it returns 0x80268006 (not initialized) before sceAudioOut2Initialize,
ahead of its pointer, id and size checks. The debt entry for
sceAudioOut2EnableChat and sceAudioOut2DisableChat records the same
0x80268006 before AudioOut2 initialization. Both were left out while
AudioOut2 initialization was not tracked; AudioOut2IsInitialized_nid_no_patch
now tracks it, so all three return 0x80268006 first and change no state.
The two debt entries drop the closed gap.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 12:56:22 +00:00
Dean Galvin d64880a5a4 Merge branch 'main' into salvage/small-exports-9541
# Conflicts:
#	docs/dev/debt/libSceAudioOut.md
2026-10-28 22:38:37 +13:00
Dean c2d14b444c Merge pull request #11918 from kyon-eth/feat/audioout2-1360-inventory
feat(libSceAudioOut): declare 11 additional exports
2026-10-28 22:30:28 +13:00
Dean a1f5ae4e8b Merge pull request #11244 from SeaSunPT/fix/audioout2-mastering-not-initialized
fix(libSceAudioOut): refuse sceAudioOut2Mastering calls before sceAudioOut2Initialize
2026-10-28 13:02:46 +13:00
Dean 091967e234 Merge pull request #11055 from JJenkx/fix/audioout2-device-queue-poll
fix(audioout2): poll device queues without the callback mutex
2026-10-28 13:02:30 +13:00
Dean 6c48f35a95 Merge pull request #8098 from LuisAguilarDev/fix/audioout2-silent-ports
fix(audioout2): keep each port's grain when ports share a buffer
2026-10-28 12:59:20 +13:00
Dean 7461dd1ed3 Merge pull request #10532 from LeandroLP23/fix/audioout-skip-open-without-output-devices
fix(libSceAudioOut): skip the default open only when Windows reports no default output endpoint
2026-10-28 02:31:48 +13:00
Kyon fadf15081d feat(libSceAudioOut): declare 11 additional exports 2026-10-27 12:31:40 +00:00
xdCloudy 278754be7c feat(prx): declare 27 PS5 JSON and AudioOut exports 2026-10-27 19:57:19 +13:00
Dean 38cda53b52 Merge pull request #11160 from p3n1cillin/claude/audioout-padspk-volume
fix(libSceAudioOut): declare sceAudioOutSetPadSpkVolume as PSBox calls it
2026-10-27 14:05:56 +13:00
Dean fc7e583e6e Merge pull request #11035 from orezraey/fix/libsceaudioout-repeated-init-measured-ps5
fix(libSceAudioOut): fail a repeated sceAudioOut2Initialize and sceAudioOutInit as measured on a PS5
2026-10-27 09:16:48 +13:00
SeaSunPTandClaude Opus 5.5 d736ea814e Merge branch 'main' into fix/audioout2-mastering-not-initialized
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 15:34:06 +00:00
SeaSunPTandClaude Opus 5.5 4128be2f60 fix(libSceAudioOut): refuse sceAudioOut2Mastering calls before sceAudioOut2Initialize
The PS5 module read for #9027 returns 0x80268006 from sceAudioOut2MasteringInit,
sceAudioOut2MasteringInitEx, sceAudioOut2MasteringTerm,
sceAudioOut2MasteringGetState and sceAudioOut2MasteringSetParam before
sceAudioOut2Initialize. #9027 left the check out because AudioOut2
initialization was not tracked; AudioOut2IsInitialized_nid_no_patch now
tracks it, so each of these returns 0x80268006 first, before its own
mastering-state and argument checks, and changes no state. The debt entry
drops the closed gap.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 22:07:11 +00:00
Dean Galvin 91039afff1 Merge branch 'main' into feat/audioout-set-main-output 2026-10-26 09:57:37 +13:00
p3nicillinandClaude Opus 5.5 6d4247f45f fix(libSceAudioOut): declare sceAudioOutSetPadSpkVolume as PSBox calls it
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 20:12:50 +00:00